summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2012-11-12 15:00:06 -0500
committerColin Walters <walters@verbum.org>2012-11-12 15:22:55 -0500
commitafad58ce8302acbff204685ae2df20f118753deb (patch)
treebc2b5d09634d4039d942d1130ef9ec6c75813034
parent502387df492d0c2b302a892d4cc59e3b246b8490 (diff)
downloadgnome-common-afad58ce8302acbff204685ae2df20f118753deb.tar.gz
compiler-warnings: code cleanup: Extract common warnings into variables
Will make future refactoring clearer, and also we have comments now. https://bugzilla.gnome.org/show_bug.cgi?id=688192
-rw-r--r--macros2/gnome-compiler-flags.m443
1 files changed, 23 insertions, 20 deletions
diff --git a/macros2/gnome-compiler-flags.m4 b/macros2/gnome-compiler-flags.m4
index 992ad5c..c4cc1c6 100644
--- a/macros2/gnome-compiler-flags.m4
+++ b/macros2/gnome-compiler-flags.m4
@@ -19,6 +19,27 @@ AC_DEFUN([GNOME_COMPILE_WARNINGS],[
warning_flags=
realsave_CFLAGS="$CFLAGS"
+ dnl These are warning flags that aren't marked as fatal. Can be
+ dnl overridden on a per-project basis with -Wno-foo.
+ base_warn_flags=" \
+ -Wall \
+ -Wstrict-prototypes \
+ "
+
+ dnl These compiler flags typically indicate very broken or suspicious
+ dnl code. Some of them such as implicit-function-declaration are
+ dnl just not default because gcc compiles a lot of legacy code.
+ dnl We choose to make this set into explicit errors.
+ base_error_flags=" \
+ -Werror=missing-prototypes \
+ -Werror=implicit-function-declaration \
+ -Werror=pointer-arith \
+ -Werror=init-self \
+ -Werror=format-security \
+ -Werror=format=2 \
+ -Werror=missing-include-dirs \
+ "
+
case "$enable_compile_warnings" in
no)
warning_flags=
@@ -27,29 +48,11 @@ AC_DEFUN([GNOME_COMPILE_WARNINGS],[
warning_flags="-Wall"
;;
yes)
- warning_flags="\
- -Wall \
- -Wstrict-prototypes \
- -Werror=missing-prototypes \
- -Werror=implicit-function-declaration \
- -Werror=pointer-arith \
- -Werror=init-self \
- -Werror=format-security \
- -Werror=format=2 \
- -Werror=missing-include-dirs"
+ warning_flags="$base_warn_flags $base_error_flags"
;;
maximum|error)
- warning_flags="\
- -Wall \
- -Wstrict-prototypes \
+ warning_flags="$base_warn_flags $base_error_flags \
-Wdeclaration-after-statement \
- -Werror=missing-prototypes \
- -Werror=implicit-function-declaration \
- -Werror=pointer-arith \
- -Werror=init-self \
- -Werror=format-security \
- -Werror=format=2 \
- -Werror=missing-include-dirs \
-Wnested-externs \
-Wno-sign-compare"
;;