|
From: | Paul Eggert |
Subject: | Re: How can Autoconf help with the transition to stricter compilation defaults? |
Date: | Thu, 17 Nov 2022 14:27:30 -0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 |
On 11/17/22 13:35, Bruno Haible wrote:
Clang will surely not acquire knowledge about "every library", right, only about the C library according to relevant standards (ISO C, POSIX)?
I don't know the Clang developers' plans. But if I wanted Clang to be picky then yes, I'd have it know about every library the program links to. It's some work but doable via techniques like -flto. Let's hope this isn't enabled by default.
There is a documented way to ask Clang and GCC "assume a free-standing implementation, not an environment that has the ISO C / POSIX / LSB / ... functions": 1) -ffreestanding [1][2] 2) -fno-builtin
Thanks, good suggestion. If this suffices to pacify Clang, we can use it in Autoconf: that is, we cause ./configure to link a simple program with -fno-builtin and if that works, then ./configure uses -fno-builtin when doing "does this function exist?" link-time tests.
This hack wouldn't suffice if Clang starts doing link-time type checking by default. However, link-time type checking doesn't seem to be on the Clang developers' to-do list, so we should be OK at least for now.
[Prev in Thread] | Current Thread | [Next in Thread] |