From: Petr Vorel <petr.vo...@gmail.com> Implicit ‘int’ (e.g. ‘extern foo();’ meaning the same thing as ‘extern int foo();’) was dropped from the C standard in its 1999 edition. Twenty-five years later, free C compilers are finally starting to make this an error by default, so let’s not use it anymore in config.guess probe programs.
(Note: As of this writing, GCC 14 and Clang 16 are both more lenient for ‘main() { … }’ specifically than for other uses of implicit int. Still, the writing is clearly on the wall.) We continue to use ‘int main() { … }’, instead of ‘int main(void) { … }’, because these programs may be compiled by truly ancient compilers that do not recognize the keyword ‘void’. This leaves open the possibility of a compiler that errors by default on an empty argument list in a function definition, which, prior to the 2024 C standard, is technically still an “old-style” function definition; but we can worry about that if and when it comes up. Signed-off-by: Petr Vorel <petr.vo...@gmail.com> Co-authored-by: Zack Weinberg <z...@owlfolio.org> --- config.guess | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/config.guess b/config.guess index f6d217a..b7f5e24 100755 --- a/config.guess +++ b/config.guess @@ -4,7 +4,7 @@ # shellcheck disable=SC2006,SC2268 # see below for rationale -timestamp='2024-01-01' +timestamp='2024-04-03' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -634,7 +634,8 @@ EOF sed 's/^ //' << EOF > "$dummy.c" #include <sys/systemcfg.h> - main() + int + main () { if (!__power_pc()) exit(1); @@ -718,7 +719,8 @@ EOF #include <stdlib.h> #include <unistd.h> - int main () + int + main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); @@ -1621,6 +1623,7 @@ cat > "$dummy.c" <<EOF #endif #endif #endif +int main () { #if defined (sony) -- 2.43.2