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.)
This commit is contained in:
Sebastian Hahn 2011-03-20 04:24:33 +01:00 committed by Nick Mathewson
parent 7889c43ef8
commit d46517ee55

View File

@ -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