summaryrefslogtreecommitdiff
path: root/cflags.SH
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2014-06-18 09:04:24 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2014-06-18 14:14:28 -0400
commitd2d4920436bb51d6c73fd2bcc6e942f68f22269d (patch)
treeb19ec139bd1534bce3746e0a22aa6d58d74d86d7 /cflags.SH
parentea14a82db6693ddbf3ec60c43dba5225e888c876 (diff)
downloadperl-d2d4920436bb51d6c73fd2bcc6e942f68f22269d.tar.gz
Enable -Werror=declaration-after-statement.
For C89 compliancy, this is the most common thinko people make. While waiting for -pedantic -std=c89, which will catch the same.
Diffstat (limited to 'cflags.SH')
-rwxr-xr-xcflags.SH15
1 files changed, 12 insertions, 3 deletions
diff --git a/cflags.SH b/cflags.SH
index 3ab5180e8b..21f1bbb22a 100755
--- a/cflags.SH
+++ b/cflags.SH
@@ -159,7 +159,11 @@ case "$gccversion" in
'') ;;
[12]*) ;; # gcc versions 1 (gasp!) and 2 are not good for this.
Intel*) ;; # # Is that you, Intel C++?
-*) for opt in -ansi -std=c89 -W -Wextra -Wdeclaration-after-statement \
+# XXX if -pedantic (or -pedantic-errors!) is ever added,
+# the -Werror=declaration-after-statement can be removed
+# since -std=c89 -pedantic implies the -Werror=...
+*) for opt in -ansi -std=c89 -W -Wextra \
+ -Werror=declaration-after-statement \
-Wendif-labels -Wc++-compat -Wwrite-strings
do
case " $ccflags " in
@@ -232,7 +236,12 @@ case "$cc" in
# Extra paranoia in case people have bad canned ccflags:
# bad in the sense that the flags are accepted by g++,
# but then whined about.
- for f in -Wdeclaration-after-statement -std=c89
+ #
+ # -Werror=d-a-s option is valid for g++, by definition,
+ # but we remove it just for cleanliness and shorter command lines.
+ for f in -Wdeclaration-after-statement \
+ -Werror=declaration-after-statement \
+ -std=c89
do
case "$ccflags" in
*"$f"*)
@@ -243,7 +252,7 @@ case "$cc" in
;;
esac
-for f in -Wdeclaration-after-statement
+for f in -Wdeclaration-after-statement -Werror=declaration-after-statement
do
case "$cppflags" in
*"$f"*)