How can Autoconf help with the transition to stricter compilation defaults?
Bruno Haible via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 17 13:35:44 PST 2022
Paul Eggert wrote:
> > AC_CHECK_FUNC *should not* just probe for linkability of a symbol
>
> ... Autoconf cannot
> be expected to know every signature of every function in every library.
Clang will surely not acquire knowledge about "every library", right,
only about the C library according to relevant standards (ISO C, POSIX)?
> ... In the meantime if
> Clang becomes pickier by default it would be helpful if there were a
> well-defined way to shut off Clang's pickiness.
To me it seems the problem is not Clang's pickiness, but rather the
assumptions that it makes about the target environment. 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
Can we assume that these options will continue to work?
If so, all Autoconf needs to do is to pass these options to the compiler
in AC_CHECK_FUNC checks. Then we don't need to add knowledge about each
of the hundreds of standard libc functions into Autoconf.
Bruno
[1] https://clang.llvm.org/docs/ClangCommandLineReference.html
[2] https://gcc.gnu.org/onlinedocs/gcc-12.2.0/gcc/C-Dialect-Options.html
More information about the cfe-commits
mailing list