I got some feedback (a long time ago now) that removing -Werror altogether wasn't desirable because of the benefit it adds to the collectd project in shipping code that compiles without warnings. But, I still feel that just about anyone other than the developers finds it annoying when their build breaks on a newer compiler for no good reason. So, this new patch instead adds a configure option to allow users to drop the -Werror option if desired.
>>> Dan
From 46dc71732287117879936d7b6be58a5f6f0ee50d Mon Sep 17 00:00:00 2001 From: Dan Fandrich <d...@coneharvesters.com> Date: Thu, 27 Mar 2014 23:58:47 +0100 Subject: [PATCH] configure.ac: add --disable-warning-as-error option While the goal of building warning-free is noble, always erroring out on warnings makes the build too brittle with ever-changing warning behaviour in newer versions of gcc. --- configure.ac | 20 +++++++++++++++++--- src/Makefile.am | 2 +- src/libcollectdclient/Makefile.am | 2 +- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index f1c7b8a..5fe1a10 100644 --- a/configure.ac +++ b/configure.ac @@ -585,11 +585,25 @@ AC_CHECK_FUNCS(gettimeofday select strdup strtol getaddrinfo getnameinfo strchr AC_FUNC_STRERROR_R +AC_ARG_ENABLE(warning-as-error, + AS_HELP_STRING([--disable-warning-as-error], + [stop treating compile warnings as errors on gcc]), + if test "x$enableval" = "xyes" + then + CFLAG_ERROR="-Werror" + else + CFLAG_ERROR="" + fi + , + CFLAG_ERROR="-Werror" +) +AC_SUBST(CFLAG_ERROR) + SAVE_CFLAGS="$CFLAGS" # Emulate behavior of src/Makefile.am if test "x$GCC" = "xyes" then - CFLAGS="$CFLAGS -Wall -Werror" + CFLAGS="$CFLAGS -Wall $CFLAG_ERROR" fi AC_CACHE_CHECK([for strtok_r], @@ -718,7 +732,7 @@ AC_CHECK_FUNCS(getutxent, [have_getutxent="yes"], [have_getutxent="no"]) if test "x$GCC" = "xyes" then SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Wall -Wextra -Werror" + CFLAGS="$CFLAGS -Wall -Wextra $CFLAG_ERROR" fi AC_CHECK_FUNCS(strptime, [have_strptime="yes"], [have_strptime="no"]) @@ -3225,7 +3239,7 @@ then SAVE_LDFLAGS="$LDFLAGS" # trigger an error if Perl_load_module*() uses __attribute__nonnull__(3) # (see issues #41 and #42) - CFLAGS="$CFLAGS $PERL_CFLAGS -Wall -Werror" + CFLAGS="$CFLAGS $PERL_CFLAGS -Wall $CFLAG_ERROR" LDFLAGS="$LDFLAGS $PERL_LDFLAGS" AC_CACHE_CHECK([for broken Perl_load_module()], diff --git a/src/Makefile.am b/src/Makefile.am index a9d8582..459eecc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,7 +4,7 @@ SUBDIRS += liboconfig endif if COMPILER_IS_GCC -AM_CFLAGS = -Wall -Werror +AM_CFLAGS = -Wall $(CFLAG_ERROR) endif AM_CPPFLAGS = -DPREFIX='"${prefix}"' diff --git a/src/libcollectdclient/Makefile.am b/src/libcollectdclient/Makefile.am index 1d4dff5..2a086c5 100644 --- a/src/libcollectdclient/Makefile.am +++ b/src/libcollectdclient/Makefile.am @@ -1,7 +1,7 @@ AUTOMAKE_OPTIONS = foreign no-dependencies if COMPILER_IS_GCC -AM_CFLAGS = -Wall -Werror +AM_CFLAGS = -Wall $(CFLAG_ERROR) endif pkginclude_HEADERS = collectd/client.h collectd/network.h collectd/network_buffer.h collectd/lcc_features.h -- 1.8.1.5
_______________________________________________ collectd mailing list collectd@verplant.org http://mailman.verplant.org/listinfo/collectd