How can Autoconf help with the transition to stricter compilation defaults?
Paul Eggert via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 17 14:27:30 PST 2022
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.
More information about the cfe-commits
mailing list