summaryrefslogtreecommitdiff
path: root/mcon/U
diff options
context:
space:
mode:
authorRaphael Manfredi <Raphael_Manfredi@pobox.com>2020-05-16 09:50:30 +0200
committerRaphael Manfredi <Raphael_Manfredi@pobox.com>2020-05-16 10:39:29 +0200
commit2cec35331a912b165e2dd135d22de81f34bbc83f (patch)
tree7cfd7dfc001b8c7603192730a2e0559e0d5c7b96 /mcon/U
parented9965c886297c329bb6530a3cb34870666a252a (diff)
Note that gccversion only contains major version.
We used to say things like: case "$gccversion" in 1*) ... but that was wrong because it now starts to catch version 10 as well, for cases that only pertained to gcc version 1! We now need to say: case "$gccversion" in 1) ... 2) ... etc. to handle versions 1 and 2 differently. Thanks to Dmitry Butskoy for spotting this bug.
Diffstat (limited to 'mcon/U')
-rw-r--r--mcon/U/ccflags.U8
-rw-r--r--mcon/U/gccvers.U7
2 files changed, 9 insertions, 6 deletions
diff --git a/mcon/U/ccflags.U b/mcon/U/ccflags.U
index 942e462..b134f57 100644
--- a/mcon/U/ccflags.U
+++ b/mcon/U/ccflags.U
@@ -174,11 +174,11 @@ dflt=''
case "$hint" in
default|recommended)
case "$gccversion" in
- 1*) dflt='-fpcc-struct-return' ;;
+ 1) dflt='-fpcc-struct-return' ;;
esac
?X: check for POSIXized ISC
case "$gccversion" in
- 2*) if test -d /etc/conf/kconfig.d &&
+ 2) if test -d /etc/conf/kconfig.d &&
$contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
then
dflt="$dflt -posix"
@@ -187,7 +187,7 @@ default|recommended)
esac
?X: turn warnings on if they're using gcc
case "$gccversion" in
- 1*|2*) dflt="$dflt -Wall";;
+ 1|2) dflt="$dflt -Wall";;
?X: starting with version 3, add "-W -Wall -Wformat=2 -Wshadow" by default
*) dflt="$dflt -W -Wall -Wformat=2 -Wshadow";;
esac
@@ -265,7 +265,7 @@ esac
: the following weeds options from ccflags that are of no interest to cpp
cppflags="$ccflags"
case "$gccversion" in
-1*) cppflags="$cppflags -D__GNUC__"
+1) cppflags="$cppflags -D__GNUC__"
esac
case "$mips_type" in
'');;
diff --git a/mcon/U/gccvers.U b/mcon/U/gccvers.U
index 702a5e9..b5abb47 100644
--- a/mcon/U/gccvers.U
+++ b/mcon/U/gccvers.U
@@ -17,6 +17,9 @@
?S: If GNU cc (gcc) is used, this variable holds '1' or '3' (for instance)
?S: to indicate whether the compiler is version 1 or 3. This is used in
?S: setting some of the default cflags. It is set to '' if not gcc.
+?S: Note that it only contains the major version number, and, when using
+?S: case statements to do different things depending on the major, do not
+?S: use statements like "1*)" because it will match version 1, 10, 11, etc.
?S:.
?S:gccosandvers:
?S: If GNU cc (gcc) is used, this variable the operating system and
@@ -58,7 +61,7 @@ else
fi
$rm -f try try.*
case "$gccversion" in
-1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
+1) cpp=`./loc gcc-cpp $cpp $pth` ;;
esac
case "$gccversion" in
'') gccosandvers='' ;;
@@ -99,7 +102,7 @@ esac
: gcc 3.1 complains about adding -Idirectories that it already knows about,
: so we will take those off from locincpth.
case "$gccversion" in
-3*)
+3)
echo "main(){}">try.c
for incdir in `$cc -v -c try.c 2>&1 | \
sed '1,/^#include <\.\.\.>/d;/^End of search list/,$d;s/^ //'` ; do