enable bunch of gcc warning CFLAGS
authorTommi Komulainen <tommi.komulainen@iki.fi>
Thu, 16 Oct 2008 17:37:46 +0000 (17:37 +0000)
committerTommi Komulainen <tko@src.gnome.org>
Thu, 16 Oct 2008 17:37:46 +0000 (17:37 +0000)
2008-10-16  Tommi Komulainen  <tommi.komulainen@iki.fi>

* configure.ac: enable bunch of gcc warning CFLAGS

svn path=/trunk/; revision=731

ChangeLog
configure.ac

index 0849aac..4fdac6c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2008-10-16  Tommi Komulainen  <tommi.komulainen@iki.fi>
 
+       * configure.ac: enable bunch of gcc warning CFLAGS
+
+2008-10-16  Tommi Komulainen  <tommi.komulainen@iki.fi>
+
        Bug 556543 – reduce compiler warnings
 
        * girepository/ginfo.c:
index 230ab2e..5202bdc 100644 (file)
@@ -46,6 +46,29 @@ if test "$YACC" = :; then
        AC_MSG_ERROR([bison not found but required])
 fi
 
+changequote(,)dnl
+ensureflag() {
+  flag="$1"; shift
+  result="$@"
+
+  case " ${result} " in
+  *[\ \        ]${flag}[\ \    ]*) ;;
+  *) result="${flag} ${result}" ;;
+  esac
+
+  echo ${result}
+}
+changequote([,])dnl
+
+if test "$GCC" = "yes"; then
+    for flag in -Wall -Wchar-subscripts -Wmissing-declarations \
+        -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align \
+        -Wsign-compare -fno-strict-aliasing;
+    do
+        CFLAGS="$(ensureflag $flag $CFLAGS)"
+    done
+fi
+
 # Checks for libraries.
 GI_ENABLE_GCOV