]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Don't build with warnings all the time. Use a WERROR_CFLAGS.
authorSimon Josefsson <simon@josefsson.org>
Mon, 18 May 2009 13:13:50 +0000 (15:13 +0200)
committerSimon Josefsson <simon@josefsson.org>
Mon, 18 May 2009 13:13:50 +0000 (15:13 +0200)
12 files changed:
NEWS
cfg.mk
configure.ac
doc/examples/Makefile.am
lib/Makefile.am
lib/configure.ac
lib/openpgp/Makefile.am
lib/x509/Makefile.am
libextra/Makefile.am
libextra/configure.ac
src/Makefile.am
tests/Makefile.am

diff --git a/NEWS b/NEWS
index 26df441dadda2dc306d6ead6d3a3cf6ce579fe52..8f55f341dba191da3e7a9c6f0c94742df5e0f566 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,9 @@ Reported by Andreas Metzler <ametzler@downhill.at.eu.org> in
 Reported by "Tom G. Christensen" <tgc@jupiterrise.com> in
 <http://permalink.gmane.org/gmane.comp.encryption.gpg.gnutls.devel/3560>
 
+** Building with many warning flags now requires --enable-gcc-warnings.
+This avoids crying wolf for normal compiles.
+
 ** API and ABI modifications:
 No changes since last version.
 
diff --git a/cfg.mk b/cfg.mk
index 1ceb691dbdeb50c2412dbd0ba7bbe2e37879088f..db54e7b9478aa60cfeeafb01e5d0dcd03e80e35f 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -18,9 +18,9 @@
 # along with this file; if not, write to the Free Software Foundation,
 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-WFLAGS ?= WARN_CFLAGS=-Werror
+WFLAGS ?= --enable-gcc-warnings
 ADDFLAGS ?=
-CFGFLAGS ?= --enable-gtk-doc $(ADDFLAGS)
+CFGFLAGS ?= --enable-gtk-doc $(ADDFLAGS) $(WFLAGS)
 
 INDENT_SOURCES = `find . -name \*.c|grep -v -e ^./lgl -e ^./gl -e ^./src/cfg -e -gaa.c -e asn1_tab.c`
 
@@ -52,7 +52,7 @@ update-po: refresh-po
        git commit -m "Sync with TP." $(PODIR)/LINGUAS $(PODIR)/*.po.in
 
 bootstrap: autoreconf
-       $(WFLAGS) ./configure $(CFGFLAGS)
+       ./configure $(CFGFLAGS)
 
 glimport:
        gnulib-tool --m4-base gl/m4 --import
index 4bfe58a7dd94e7ecf0886090bdba1dee01af7aa3..365173361e09e68fa23a5633014945396dd9a5be 100644 (file)
@@ -183,8 +183,20 @@ AC_PROG_LIBTOOL
 
 gl_INIT
 
-# Add many warnings, except some...
-if test "$GCC" = "yes"; then
+AC_ARG_ENABLE([gcc-warnings],
+  [AS_HELP_STRING([--enable-gcc-warnings],
+                 [turn on lots of GCC warnings (for developers)])],
+  [case $enableval in
+     yes|no) ;;
+     *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
+   esac
+   gl_gcc_warnings=$enableval],
+  [gl_gcc_warnings=no]
+)
+
+if test "$gl_gcc_warnings" = yes; then
+  gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
+
   nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
   nw="$nw -Wc++-compat"             # We don't care about C++ compilers
   nw="$nw -Wundef"                  # Warns on '#if GNULIB_FOO' etc in gnulib
@@ -205,11 +217,13 @@ if test "$GCC" = "yes"; then
   nw="$nw -Wformat-nonliteral"      # Incompatible with gettext _()
   nw="$nw -Wunsafe-loop-optimizations"
   nw="$nw -Wstrict-overflow"
+
   gl_MANYWARN_ALL_GCC([ws])
   gl_MANYWARN_COMPLEMENT(ws, [$ws], [$nw])
   for w in $ws; do
     gl_WARN_ADD([$w])
   done
+
   gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
   gl_WARN_ADD([-Wno-sign-compare])     # Too many warnings for now
   gl_WARN_ADD([-Wno-pointer-sign])     # Too many warnings for now
@@ -220,6 +234,7 @@ if test "$GCC" = "yes"; then
 fi
 
 # Export things for */configure.ac.
+export WERROR_CFLAGS
 export WARN_CFLAGS
 export use_cxx
 
@@ -269,7 +284,7 @@ AC_MSG_NOTICE([summary of build options:
   Host type:        ${host}
   Install prefix:   ${prefix}
   Compiler:         ${CC}
-  Warning flags:    ${WARN_CFLAGS}
+  Warning flags:    errors: ${WERROR_CFLAGS} warnings: ${WARN_CFLAGS}
   Library types:    Shared=${enable_shared}, Static=${enable_static}
   Valgrind:         ${VALGRIND}
   Guile wrappers:   $opt_guile_bindings
index 9cab8d4742567cfa071677bd192652a11a5da612..f5bc40a9a01d46c0160bfb73d01a257fb0b607ad 100644 (file)
@@ -19,7 +19,7 @@
 # along with this file; if not, write to the Free Software Foundation,
 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-AM_CFLAGS = $(WARN_CFLAGS)
+AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
 AM_CPPFLAGS = \
        -I$(top_srcdir)/lib/includes -I$(top_builddir)/lib/includes     \
        -I$(top_srcdir)/libextra/includes                               \
index 0d923d7ae36c3ad0742ecff0996828a69f794aa9..7180b3cd50c9ccc33990ed1c65f37597ad115626 100644 (file)
@@ -29,7 +29,7 @@ endif
 
 localedir = $(datadir)/locale
 
-AM_CFLAGS = $(WARN_CFLAGS)
+AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
 AM_CPPFLAGS = \
        -DLOCALEDIR=\"$(localedir)\"            \
        -I$(srcdir)/gl                          \
index a8616f86a1169b67f18a9ba85e09117cc70cd4fb..f77d10cc4fdf2ca3e4f129522dd90de1bbb26351 100644 (file)
@@ -88,6 +88,7 @@ AC_SUBST(LIBGNUTLS_CFLAGS)
 
 # Finish things from ../configure.ac.
 AC_SUBST([WARN_CFLAGS])
+AC_SUBST([WERROR_CFLAGS])
 AC_PROG_CXX
 AM_CONDITIONAL(ENABLE_CXX, test "$use_cxx" != "no")
 
index 1cdfb1bf101d1e4e43823f5ef62aa06d1e60b77b..b1f3e4efd285f74a6eac64807ede71ccbe5ccf45 100644 (file)
@@ -20,7 +20,7 @@
 # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA 02110-1301, USA
 
-AM_CFLAGS = $(WARN_CFLAGS)
+AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
 AM_CPPFLAGS = \
        -I$(srcdir)/../gl               \
        -I$(builddir)/../gl             \
index 3f145aae9008d818c461293e9161ff643dac25a8..bffaedd64003b3b12591dd6a966bdeaf86abd9cc 100644 (file)
@@ -18,7 +18,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
 # USA
 
-AM_CFLAGS = $(WARN_CFLAGS)
+AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
 AM_CPPFLAGS = \
        -I$(srcdir)/../gl               \
        -I$(builddir)/../gl             \
index 07227673b374e770f186cd06f3b206342897b1d7..5899e80b4fe0a9266c7ae878080b254cd317e2a6 100644 (file)
@@ -22,7 +22,7 @@
 
 ACLOCAL_AMFLAGS = -I m4 -I gl/m4 -I ../lib/m4
 
-AM_CFLAGS = $(WARN_CFLAGS)
+AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
 AM_CPPFLAGS = \
        -I$(srcdir)/../lib/gl           \
        -I$(builddir)/../lib/gl         \
index 61b6523a3dd3fcc0664d1c65f05eb0977fb92c65..6d7d1630bfa9ebb92e8fce38f0fac0ed4294e369 100644 (file)
@@ -47,6 +47,7 @@ AC_SUBST(LIBGNUTLS_EXTRA_CFLAGS)
 
 # Finish things from ../configure.ac.
 AC_SUBST([WARN_CFLAGS])
+AC_SUBST([WERROR_CFLAGS])
 
 AC_CONFIG_FILES([
   Makefile
index c792f3b0c71440c25598c5dbc7bb234d804d8959..92f59a23eafd5f915cefbc7cb815e50af756cc92 100644 (file)
@@ -21,7 +21,7 @@ EXTRA_DIST = README README.srptool
 
 SUBDIRS = cfg
 
-AM_CFLAGS = $(WARN_CFLAGS)
+AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
 AM_CPPFLAGS = \
        -I$(srcdir)/../gl                       \
        -I$(builddir)/../gl                     \
index d787a108cd27a4474681b1ecf9042b203d69ed32..0b09cc80decaa30f6e3ad78cf1bffae0315ba49c 100644 (file)
@@ -28,7 +28,7 @@ endif
 
 EXTRA_DIST = libgcrypt.supp hostname-check.README
 
-AM_CFLAGS = $(WARN_CFLAGS)
+AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
 AM_CPPFLAGS = \
        -I$(top_srcdir)/gl                      \
        -I$(top_builddir)/gl                    \