From: Zack Weinberg <zack@owlfolio.org>
Specifically, on top of Petr Vorel’s patch, eliminate all use of
old-style function definitions and implicit function declarations.
Many of the C programs embedded in config.guess are only used on very
old systems that may never have had an ISO C compiler (other than gcc,
which we cannot assume has been installed) so we have to do this
carefully. I assume that stdio.h exists unconditionally, and that
either it declares puts and printf, or the compiler is so old that
implicit function declarations are the order of the day. I also
assume it is safe to declare main as ‘int main (void)’; that may need
to get reverted. All uses of ‘exit’ are replaced with returning from
main, so that we do not need to worry about whether stdlib.h exists.
The only C program that took command line arguments, and therefore
needed to declare main with arguments, is replaced with a
preprocessor-only check and string manipulation from shell.
Wherever possible, uses of printf are demoted to puts.
---
config.guess | 111 ++++++++++++++++++++++++---------------------------
1 file changed, 52 insertions(+), 59 deletions(-)
diff --git a/config.guess b/config.guess
index ff5146b..1059f76 100755
--- a/config.guess
+++ b/config.guess
@@ -4,7 +4,7 @@
# shellcheck disable=SC2006,SC2268 # see below for rationale
-timestamp='2024-01-03'
+timestamp='2024-04-04'
# 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
@@ -534,29 +534,22 @@ case
$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION in
mips:*:*:UMIPS | mips:*:*:RISCos)
set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c"
[...]
EOF
- $CC_FOR_BUILD -o "$dummy" "$dummy.c" &&
- dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` &&
- SYSTEM_NAME=`"$dummy" "$dummyarg"` &&
+ SYSTEM_TYPE="`$CC_FOR_BUILD -E - < "$dummy.c" |
+ sed -n 's/^ *SYSTYPE *= *//p'`" &&
+ SYSTEM_REL="`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'`" &&
+ SYSTEM_NAME="mips-mips-riscos${SYSTEM_REL}${SYSTEM_TYPE}" &&