[pacman-dev] [PATCH 1/2] Fix --enable-warningflags

Allan McRae allan at archlinux.org
Sun Feb 10 10:01:25 EST 2013


gcc gives an error on an unknown warning flag, but clang just gives a
warning.  Upgrade the warning in clang to an error by activating
-Werror=unknown-warning-option if available.

Signed-off-by: Allan McRae <allan at archlinux.org>
---

Tested with clang and gcc.  Both give the right result.

 m4/acinclude.m4 | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/m4/acinclude.m4 b/m4/acinclude.m4
index e601f0e..294507e 100644
--- a/m4/acinclude.m4
+++ b/m4/acinclude.m4
@@ -114,6 +114,10 @@ AC_DEFUN([CFLAGS_ADD],
 [AS_VAR_PUSHDEF([my_cflags], [cflags_cv_warn_$1])dnl
 AC_CACHE_CHECK([whether compiler handles $1], [my_cflags], [
   save_CFLAGS="$CFLAGS"
+  CFLAGS="${CFLAGS} -Werror=unknown-warning-option"
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
+                    [],
+                    [CFLAGS="$save_CFLAGS"])
   CFLAGS="${CFLAGS} $1"
   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
                     [AS_VAR_SET([my_cflags], [yes])],
-- 
1.8.1.3



More information about the pacman-dev mailing list