Commit d9492da5 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Simplify and modernize our compiler warnings

-Wall -Werror is always on, at least until all of Jenkins turns red.

All developer warnings have been collected under --enable-developer-warnings
and several auxillary developer options have been absorbed or
otherwise eliminated.
parent e8cd406b
......@@ -9,12 +9,7 @@ make -k distclean > /dev/null 2>&1 || true
# Prefer CLANG if we have it, and have not given preferences
if [ -f /usr/bin/clang -a "x${CC}" = "x" ] ; then
CC=clang
CFLAGS="${CFLAGS} -Qunused-arguments"
# XXX: clang complains about -g in linker invocations
# XXX: so fall back to gcc for now...
# CC=gcc
export CC CFLAGS
export CC
fi
rm -f configure
......@@ -27,10 +22,7 @@ export CONFIG_SHELL=/bin/sh
--enable-developer-warnings \
--enable-debugging-symbols \
--enable-dependency-tracking \
--enable-extra-developer-warnings \
--enable-stack-protector \
--enable-tests \
--enable-werror \
--prefix=/opt/varnish \
--mandir=/opt/varnish/man \
"$@"
......@@ -446,60 +446,41 @@ AC_SUBST(varnishconfdir)
# Check for linker script support
gl_LD_VERSION_SCRIPT
#######################################################################
# Now that we're done using the compiler to look for functions and
# libraries, set CFLAGS to what we want them to be for our own code
# This is a test to see how much havoc Jenkins exposes
CFLAGS="${CFLAGS} -Wall -Werror"
OCFLAGS="${OCFLAGS} -Wall -Werror"
# This corresponds to FreeBSD's WARNS level 6
DEVELOPER_CFLAGS="-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wcast-align -Wunused-parameter -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wformat"
DEVELOPER_CFLAGS="-fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wno-pointer-sign -Wno-empty-body -Wextra -Wno-missing-field-initializers -Wno-sign-compare"
# These are not compliable yet
DEVELOPER_GCC_CFLAGS="-Wold-style-definition -Wredundant-decls "
#DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} ${DEVELOPER_GCC_CFLAGS}"
# Additional flags for GCC 4
EXTRA_DEVELOPER_CFLAGS="-Wextra -Wno-missing-field-initializers -Wno-sign-compare"
# These are compilable
DEVELOPER_CLANG_CFLAGS="-Wmissing-variable-declarations -Wno-string-plus-int"
#DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} ${DEVELOPER_CLANG_CFLAGS}"
# --enable-developer-warnings
AC_ARG_ENABLE(developer-warnings,
AS_HELP_STRING([--enable-developer-warnings],[enable strict warnings (default is NO)]),
CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}";
OCFLAGS="${OCFLAGS} ${DEVELOPER_CFLAGS} -Werror")
[],
[enable_developer_warnings=no])
if test "x$enable_developer_warnings" != "xno"; then
CFLAGS="${CFLAGS} ${DEVELOPER_CFLAGS}"
OCFLAGS="${OCFLAGS} ${DEVELOPER_CFLAGS}"
fi
# --enable-debugging-symbols
AC_ARG_ENABLE(debugging-symbols,
AS_HELP_STRING([--enable-debugging-symbols],[enable debugging symbols (default is NO)]),
CFLAGS="${CFLAGS} -O0 -g -fno-inline")
# --enable-extra-developer-warnings
AC_ARG_ENABLE(extra-developer-warnings,
AS_HELP_STRING([--enable-extra-developer-warnings],[enable even stricter warnings (default is NO)]),
[],
[enable_extra_developer_warnings=no])
if test "x$enable_stack_protector" != "xno"; then
save_CFLAGS="$CFLAGS"
CFLAGS="${CFLAGS} ${EXTRA_DEVELOPER_CFLAGS}"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([],[],[])],
[],
[AC_MSG_WARN([All of ${EXTRA_DEVELOPER_CFLAGS} not supported, disabling])
CFLAGS="$save_CFLAGS"])
fi
# --enable-stack-protector
AC_ARG_ENABLE(stack-protector,
AS_HELP_STRING([--enable-stack-protector],[enable stack protector (default is NO)]),
[],
[enable_stack_protector=no])
if test "x$enable_stack_protector" != "xno"; then
save_CFLAGS="$CFLAGS"
CFLAGS="${CFLAGS} -fstack-protector-all"
save_AM_LT_LDFLAGS="$AM_LT_LDFLAGS"
AM_LT_LDFLAGS="${AM_LT_LDFLAGS} -Wc,-fstack-protector"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([],[],[])],
[],
[AC_MSG_WARN([-fstack-protector not supported, disabling])
CFLAGS="$save_CFLAGS"]
AM_LT_LDFLAGS="$save_AM_LT_LDFLAGS")
fi
AC_SUBST(AM_LT_LDFLAGS)
# --enable-tests
......@@ -507,11 +488,6 @@ AC_ARG_ENABLE(tests,
AS_HELP_STRING([--enable-tests],[build test programs (default is NO)]))
AM_CONDITIONAL([ENABLE_TESTS], [test x$enable_tests = xyes])
# --enable-werror
AC_ARG_ENABLE(werror,
AS_HELP_STRING([--enable-werror],[use -Werror (default is NO)]),
CFLAGS="${CFLAGS} -Werror")
# Command line for compiling VCL code. I wish there were a simple way
# to figure this out dynamically without introducing a run-time
# dependency on libtool.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment