On 2026-06-19 05:36, Florian Weimer wrote:
Agreed, overriding the default seems problematic.  Soon enough, it will
mean downgrading the compiler version.  And can be really problematic
because some installed headers may assume the default GCC version,
especially for C++.

It could be helpful to have an option to lift the standard to a version
that is known to be needed for successful compilation.  But it should
never downgrade the version.

As I understand it, Autoconf 2.73 no longer messes with the C++ version, and for C it adds --std=gnu23 only if that causes some C23-required features to start working. So Autoconf will downgrade the compiler version only if some hypothetical future C compiler defaults to rejecting one of those C23 features.

The biggest such glitch that I recall is that Autoconf 2.73 generates a 'configure' script that can use -std=gnu23, which causes many warnings when you compile ancient code that still uses the K&R syntax that C17 still requires but C23 disallows. But even here, in practice compilation fails only when you also specify a non-default compiler option like -Werror or -std=c23, so this has been merely an irritation rather than a showstopper. And given that K&R syntax is significantly more dangerous than function prototypes, it's not a major problem that this particular irritation exists: developers and builders should be warned about the problem, after all.

Of course it'd be fine to add an Autoconf option to disable its default test for the current C standard. But at least for C23, it still seems like a reasonable-enough default when such an option is not specified.

Reply via email to