Enable -Wall if compiling with clang
authorTobias Grosser <tobias@grosser.es>
Thu, 2 Jun 2011 16:29:06 +0000 (13:29 -0300)
committerSven Verdoolaege <skimo@kotnet.org>
Tue, 7 Jun 2011 19:40:29 +0000 (21:40 +0200)
isl is at the moment free of warnings with 'clang -Wall'. To maintain this
enable -Wall by default. In case false positives show up, we disable the
corresponding warning type by adding e.g. -Wno-return-type. To disable all
warnings configure or compile with CFLAGS=-Wno-all.

Signed-off-by: Tobias Grosser <tobias@grosser.es>
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
Makefile.am
configure.ac
m4/ax_set_warning_flags.m4 [new file with mode: 0644]

index eb1c817..feff343 100644 (file)
@@ -30,6 +30,7 @@ GET_MEMORY_FUNCTIONS=mp_get_memory_functions.c
 endif
 
 INCLUDES = -I. -I$(srcdir) -I$(srcdir)/include -Iinclude/ 
+AM_CFLAGS = @WARNING_FLAGS@
 
 libisl_la_SOURCES = \
        $(ISL_PIPLIB) \
index 65c3e4a..57b592a 100644 (file)
@@ -83,6 +83,10 @@ if test "$with_piplib" != "no"; then
 fi
 AM_CONDITIONAL(HAVE_PIPLIB, test x$have_piplib = xtrue)
 
+AX_SET_WARNING_FLAGS
+
+AC_SUBST(WARNING_FLAGS)
+
 PACKAGE_CFLAGS="$GMP_CPPFLAGS"
 PACKAGE_LDFLAGS="$GMP_LDFLAGS"
 PACKAGE_LIBS="-lisl -lgmp"
diff --git a/m4/ax_set_warning_flags.m4 b/m4/ax_set_warning_flags.m4
new file mode 100644 (file)
index 0000000..c64ad7d
--- /dev/null
@@ -0,0 +1,17 @@
+dnl Add a set of flags to WARNING_FLAGS, that enable compiler warnings for
+dnl isl. The warnings that are enabled vary with the compiler and only include
+dnl warnings that did not trigger at the time of adding these flags.
+AC_DEFUN([AX_SET_WARNING_FLAGS],[dnl
+       AX_COMPILER_VENDOR
+
+       WARNING_FLAGS=""
+
+       if test "${ax_cv_c_compiler_vendor}" = "clang"; then
+               dnl isl is at the moment clean of -Wall warnings.  If clang adds
+               dnl new warnings to -Wall which cause false positives, the
+               dnl specific warning types will be disabled explicitally (by
+               dnl adding for example -Wno-return-type). To temporarily disable
+               dnl all warnings run configure with CFLAGS=-Wno-all.
+               WARNING_FLAGS="-Wall"
+       fi
+])