summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip@tecnocode.co.uk>2013-09-04 00:48:19 -0600
committerPhilip Withnall <philip@tecnocode.co.uk>2013-09-04 09:03:06 -0600
commitc834b24651e1b0f510ede8610bde0be1e940de14 (patch)
tree4bb5d10c8c559fec62e8b26b22fda21fdcf3bd30
parentac800833454ab6d38afb288773079b8ad1d5503f (diff)
downloadgnome-common-c834b24651e1b0f510ede8610bde0be1e940de14.tar.gz
compiler-flags: Add an optional second argument for custom warnings
This allows module authors to choose to enforce stricter warnings on a per-module basis, to avoid the situation where an outside contributor submits a patch which introduces warnings the maintainer has enabled locally. Closes: https://bugzilla.gnome.org/show_bug.cgi?id=707475
-rw-r--r--macros2/gnome-compiler-flags.m414
1 files changed, 12 insertions, 2 deletions
diff --git a/macros2/gnome-compiler-flags.m4 b/macros2/gnome-compiler-flags.m4
index 4cb24aa..7504482 100644
--- a/macros2/gnome-compiler-flags.m4
+++ b/macros2/gnome-compiler-flags.m4
@@ -2,6 +2,11 @@ dnl GNOME_COMPILE_WARNINGS
dnl Turn on many useful compiler warnings and substitute the result into
dnl WARN_CFLAGS
dnl For now, only works on GCC
+dnl Pass the default value of the --enable-compile-warnings configure option as
+dnl the first argument to the macro, defaulting to 'yes'.
+dnl Additional warning/error flags can be passed as an optional second argument.
+dnl
+dnl For example: GNOME_COMPILE_WARNINGS([maximum],[-Werror=some-flag -Wfoobar])
AC_DEFUN([GNOME_COMPILE_WARNINGS],[
dnl ******************************
dnl More compiler warnings
@@ -41,6 +46,11 @@ AC_DEFUN([GNOME_COMPILE_WARNINGS],[
-Werror=missing-include-dirs \
"
+ dnl Additional warning or error flags provided by the module author to
+ dnl allow stricter standards to be imposed on a per-module basis.
+ dnl The author can pass -W or -Werror flags here as they see fit.
+ additional_flags="m4_default([$2],[])"
+
case "$enable_compile_warnings" in
no)
warning_flags=
@@ -49,10 +59,10 @@ AC_DEFUN([GNOME_COMPILE_WARNINGS],[
warning_flags="-Wall"
;;
yes)
- warning_flags="$base_warn_flags $base_error_flags"
+ warning_flags="$base_warn_flags $base_error_flags $additional_flags"
;;
maximum|error)
- warning_flags="$base_warn_flags $base_error_flags"
+ warning_flags="$base_warn_flags $base_error_flags $additional_flags"
;;
*)
AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)