Enable all warnings permanently & default to -Werror for GIT builds

Given that we auto-detect whether each -Wxxxx flag is supported by
GCC, and we are warning-free and use automake silent rules, there
is no compelling reason to allow compile warnings to be disabled.

Replace the --enable-compile-warnings flag with a simpler
--enable-werror flag, which defaults to 'yes' if building
from GIT, or 'no' if building from tar.gz

This helps ensure that everyone writing patches for libvirt will
take care to fix their warning problems before submitting for
review

* autobuild.sh: Force -Werror
* configure.ac: Update for LIBVIRT_COMPILE_WARNINGS macro change
* m4/virt-compile-warnings.m4: Permanently enable all warnings,
  auto-enable Werror for GIT builds
This commit is contained in:
Daniel P. Berrange 2012-03-27 16:47:11 +01:00
parent 3a2fc2770b
commit 851117bd7a
3 changed files with 118 additions and 124 deletions

View File

@ -20,7 +20,7 @@ cd build
../autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT" \
--enable-test-coverage \
--disable-nls \
--enable-compile-warnings=error
--enable-werror
# If the MAKEFLAGS envvar does not yet include a -j option,
# add -jN where N depends on the number of processors.
@ -74,7 +74,7 @@ if [ -x /usr/bin/i686-pc-mingw32-gcc ]; then
--build=$(uname -m)-pc-linux \
--host=i686-pc-mingw32 \
--prefix="$AUTOBUILD_INSTALL_ROOT/i686-pc-mingw32/sys-root/mingw" \
--enable-compile-warnings=error \
--enable-werror \
--without-libvirtd \
--without-python

View File

@ -106,7 +106,7 @@ VERSION_SCRIPT_FLAGS=-Wl,--version-script=
VERSION_SCRIPT_FLAGS="-Wl,-M -Wl,"
AC_MSG_RESULT([$VERSION_SCRIPT_FLAGS])
LIBVIRT_COMPILE_WARNINGS([maximum])
LIBVIRT_COMPILE_WARNINGS
AC_MSG_CHECKING([for CPUID instruction])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
@ -2820,7 +2820,7 @@ AC_MSG_NOTICE([])
AC_MSG_NOTICE([Miscellaneous])
AC_MSG_NOTICE([])
AC_MSG_NOTICE([ Debug: $enable_debug])
AC_MSG_NOTICE([ Warnings: $enable_compile_warnings])
AC_MSG_NOTICE([ Use -Werror: $set_werror])
AC_MSG_NOTICE([Warning Flags: $WARN_CFLAGS])
AC_MSG_NOTICE([ Readline: $lv_use_readline])
AC_MSG_NOTICE([ Python: $with_python])

View File

@ -7,16 +7,15 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
dnl More compiler warnings
dnl ******************************
AC_ARG_ENABLE(compile-warnings,
[AC_HELP_STRING([--enable-compile-warnings=@<:@no/yes/error@:>@],
[Turn on compiler warnings])],,
[enable_compile_warnings="m4_default([$1],[yes])"])
case "$enable_compile_warnings" in
no)
try_compiler_flags=""
;;
yes|minimum|maximum|error)
AC_ARG_ENABLE([werror],
AS_HELP_STRING([--enable-werror], [Use -Werror (if supported)]),
[set_werror="$enableval"],
[if test -d $srcdir/.git; then
is_git_version=true
set_werror=yes
else
set_werror=no
fi])
# List of warnings that are not relevant / wanted
@ -131,15 +130,10 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
gl_WARN_ADD([-Wno-suggest-attribute=pure])
gl_WARN_ADD([-Wno-suggest-attribute=const])
if test "$enable_compile_warnings" = "error"
if test "$set_werror" = "yes"
then
gl_WARN_ADD([-Werror])
fi
;;
*)
AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings)
;;
esac
WARN_LDFLAGS=$WARN_CFLAGS
AC_SUBST([WARN_CFLAGS])