From d46517ee55fa1f6f2f091ec796500dcfcd0b3090 Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Sun, 20 Mar 2011 04:24:33 +0100 Subject: [PATCH] Make gcc warnings on by default, and --enable-gcc-warnings only add -Werror This commit is based on a patch for Tor (git commit ca60a6ce3f4786626ac455ec1b798b2e8304635c by Peter Palfrader), Copyright (c) 2007-2011, The Tor Project, Inc. (Originally, it added --enable-gcc-warnings-advisory as in Tor; Nick changed that.) --- configure.in | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/configure.in b/configure.in index fc2429e7..539af4c2 100644 --- a/configure.in +++ b/configure.in @@ -54,7 +54,9 @@ if test "$GCC" = "yes" ; then fi AC_ARG_ENABLE(gcc-warnings, - AS_HELP_STRING(--enable-gcc-warnings, enable verbose warnings with GCC)) + AS_HELP_STRING(--disable-gcc-warnings, disable verbose warnings with GCC)) + + AC_ARG_ENABLE(thread-support, AS_HELP_STRING(--disable-thread-support, disable support for threading), [], [enable_thread_support=yes]) @@ -623,7 +625,7 @@ AM_CONDITIONAL(OPENSSL, [test "$enable_openssl" != "no" && test "$have_openssl" # Add some more warnings which we use in development but not in the # released versions. (Some relevant gcc versions can't handle these.) -if test x$enable_gcc_warnings = xyes && test "$GCC" = "yes"; then +if test x$enable_gcc_warnings != xno && test "$GCC" = "yes"; then AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [ #if !defined(__GNUC__) || (__GNUC__ < 4) @@ -650,7 +652,11 @@ if test x$enable_gcc_warnings = xyes && test "$GCC" = "yes"; then #error #endif])], have_clang29orlower=yes, have_clang29orlower=no) - CFLAGS="$CFLAGS -W -Wfloat-equal -Wundef -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wbad-function-cast -Wswitch-enum -Werror" + CFLAGS="$CFLAGS -W -Wfloat-equal -Wundef -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wbad-function-cast -Wswitch-enum" + if test x$enable_gcc_warnings = xyes; then + CFLAGS="$CFLAGS -Werror" + fi + CFLAGS="$CFLAGS -Wno-unused-parameter -Wstrict-aliasing" if test x$have_gcc4 = xyes ; then