summaryrefslogtreecommitdiff
path: root/cflags.SH
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2019-12-17 11:32:40 +1100
committerKarl Williamson <khw@cpan.org>2019-12-17 14:44:20 -0700
commitda255c79e19b6d6937fe9fe83c3bc7cd7ae8db5f (patch)
tree4c1ae9ad03963fb756082a37dea2b5ce05e487bf /cflags.SH
parent9f16475a53933d1d9c547f871b97b3b12160cece (diff)
downloadperl-da255c79e19b6d6937fe9fe83c3bc7cd7ae8db5f.tar.gz
don't use -Werror=declaration-after-statement with C++
declaration after statement is normal for C++ and C++ compilers rightly complain if we try to warn (or error) on them, so don't try to. fixes #17353
Diffstat (limited to 'cflags.SH')
-rwxr-xr-xcflags.SH16
1 files changed, 11 insertions, 5 deletions
diff --git a/cflags.SH b/cflags.SH
index f1bcd6c38e..90bf7057b5 100755
--- a/cflags.SH
+++ b/cflags.SH
@@ -178,11 +178,17 @@ Intel*) ;; # # Is that you, Intel C++?
# -std=c89 before -ansi
# -pedantic* before -Werror=d-a-s
#
-*) for opt in -std=c89 -ansi $pedantic \
- -Werror=declaration-after-statement \
- -Werror=pointer-arith \
- -Wextra -W \
- -Wc++-compat -Wwrite-strings
+*) warns=-std=c89 -ansi $pedantic \
+ -Werror=pointer-arith \
+ -Wextra -W \
+ -Wc++-compat -Wwrite-strings
+ # declaration after statement is normal in C++ rather than an
+ # extension and compilers complain if we try to warn about it
+ case "$d_cplusplus" in
+ define) ;;
+ *) warns="$warns -Werror=declaration-after-statement" ;;
+ esac
+ for opt in $warns
do
case " $ccflags " in
*" $opt "*) ;; # Skip if already there.