summaryrefslogtreecommitdiff
path: root/cflags.SH
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2021-10-10 18:30:44 +0000
committerNicholas Clark <nick@ccl4.org>2021-10-13 08:09:16 +0200
commit694de2a9ab0f7acd2d3418a2031a022e0fd70ba7 (patch)
tree89344a074c9d95728f991208f3c02f4dacdcc10f /cflags.SH
parentd34aca5e9e57e3f0b5d25d451759237b40647664 (diff)
downloadperl-694de2a9ab0f7acd2d3418a2031a022e0fd70ba7.tar.gz
cflags.sh should not add -std=c99 if -std=gnu99 is already set
Having both looks like it ought to cause the build to fail, as with -std=c99 second it will override any previous -std=gnu99, and some platforms need the former to both compile C99 code and have correct includes during Configure probing. However testing on those platforms without this change doesn't show any errors. So this change doesn't seem to strictly be necessary. But it does prevent our generated compiler command lines having contradictory flags, and hence looking daft.
Diffstat (limited to 'cflags.SH')
-rwxr-xr-xcflags.SH6
1 files changed, 5 insertions, 1 deletions
diff --git a/cflags.SH b/cflags.SH
index 3244a56969..443f5fcc96 100755
--- a/cflags.SH
+++ b/cflags.SH
@@ -185,12 +185,16 @@ Intel*) ;; # # Is that you, Intel C++?
# -Wextra before -W
# -W before -Wno-long-long -Wno-declaration-after-statement
#
-*) warns="-std=c99 $pedantic \
+*) warns="$pedantic \
-Werror=pointer-arith \
-Werror=vla \
-Wextra -W \
-Wno-long-long -Wno-declaration-after-statement \
-Wc++-compat -Wwrite-strings"
+ case " $ccflags " in
+ *" -std="*) ;; # Already have -std=...
+ *) warns="-std=c99 $warns" ;;
+ esac
for opt in $warns
do
case " $ccflags " in