summaryrefslogtreecommitdiff
path: root/m4/spice-compile-warnings.m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4/spice-compile-warnings.m4')
-rw-r--r--m4/spice-compile-warnings.m490
1 files changed, 49 insertions, 41 deletions
diff --git a/m4/spice-compile-warnings.m4 b/m4/spice-compile-warnings.m4
index 31f2a9c3..abe4a912 100644
--- a/m4/spice-compile-warnings.m4
+++ b/m4/spice-compile-warnings.m4
@@ -10,12 +10,7 @@ AC_DEFUN([SPICE_COMPILE_WARNINGS],[
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])
+ [set_werror=no])
# List of warnings that are not relevant / wanted
@@ -23,6 +18,9 @@ AC_DEFUN([SPICE_COMPILE_WARNINGS],[
dontwarn="$dontwarn -Wc++-compat"
dontwarn="$dontwarn -Wabi"
dontwarn="$dontwarn -Wdeprecated"
+ # For older gcc versions, -Wenum-compare is "C++ and Objective-C++ only"
+ # For newer gcc versions, -Wenum-compare is "enabled by -Wall"
+ dontwarn="$dontwarn -Wenum-compare"
# Don't care about ancient C standard compat
dontwarn="$dontwarn -Wtraditional"
# Don't care about ancient C standard compat
@@ -48,9 +46,6 @@ AC_DEFUN([SPICE_COMPILE_WARNINGS],[
dontwarn="$dontwarn -Wformat-nonliteral"
dontwarn="$dontwarn -Wfloat-equal"
dontwarn="$dontwarn -Wdeclaration-after-statement"
- dontwarn="$dontwarn -Wcast-qual"
- dontwarn="$dontwarn -Wconversion"
- dontwarn="$dontwarn -Wsign-conversion"
dontwarn="$dontwarn -Wpacked"
dontwarn="$dontwarn -Wunused-macros"
dontwarn="$dontwarn -Woverlength-strings"
@@ -58,23 +53,37 @@ AC_DEFUN([SPICE_COMPILE_WARNINGS],[
dontwarn="$dontwarn -Winline"
dontwarn="$dontwarn -Wbad-function-cast"
dontwarn="$dontwarn -Wshadow"
+ dontwarn="$dontwarn -Wformat-signedness"
+ dontwarn="$dontwarn -Wnull-dereference"
+
+ # This causes an error to be detected in glib headers
+ dontwarn="$dontwarn -Wshift-overflow=2"
- # We want to enable thse, but need to sort out the
+ # We want to enable these, but need to sort out the
# decl mess with gtk/generated_*.c
- dontwarn="$dontwarn -Wmissing-prototypes"
dontwarn="$dontwarn -Wmissing-declarations"
# Stuff that C++ won't allow. Turn them back on later
- dontwarn="$dontwarn -Waggregate-return"
- dontwarn="$dontwarn -Wstrict-prototypes"
- dontwarn="$dontwarn -Wold-style-definition"
+ dontwarn="$dontwarn -Wdesignated-init"
+ dontwarn="$dontwarn -Wdiscarded-array-qualifiers"
+ dontwarn="$dontwarn -Wdiscarded-qualifiers"
+ dontwarn="$dontwarn -Wimplicit"
+ dontwarn="$dontwarn -Wimplicit-function-declaration"
+ dontwarn="$dontwarn -Wimplicit-int"
+ dontwarn="$dontwarn -Wincompatible-pointer-types"
+ dontwarn="$dontwarn -Wint-conversion"
+ dontwarn="$dontwarn -Wjump-misses-init"
+ dontwarn="$dontwarn -Wmissing-parameter-type"
+ dontwarn="$dontwarn -Wmissing-prototypes"
dontwarn="$dontwarn -Wnested-externs"
- dontwarn="$dontwarn -Wformat-zero-length"
+ dontwarn="$dontwarn -Wold-style-declaration"
+ dontwarn="$dontwarn -Wold-style-definition"
+ dontwarn="$dontwarn -Woverride-init"
+ dontwarn="$dontwarn -Wpointer-sign"
dontwarn="$dontwarn -Wpointer-to-int-cast"
- dontwarn="$dontwarn -Wjump-misses-init"
-
- # Issues in x11/platform_utils.cpp prevent us turning this on
- dontwarn="$dontwarn -Wmissing-format-attribute"
+ dontwarn="$dontwarn -Wstrict-prototypes"
+ dontwarn="$dontwarn -Wsuggest-final-methods"
+ dontwarn="$dontwarn -Wsuggest-final-types"
# Get all possible GCC warnings
gl_MANYWARN_ALL_GCC([maybewarn])
@@ -96,15 +105,6 @@ AC_DEFUN([SPICE_COMPILE_WARNINGS],[
# We can't enable this due to horrible spice_usb_device_get_description
# signature
gl_WARN_ADD([-Wno-format-nonliteral])
- # CEGui headers cause violation of this
- gl_WARN_ADD([-Wno-ignored-qualifiers])
-
-
-
-
- # GNULIB turns on -Wformat=2 which implies -Wformat-nonliteral,
- # so we need to manually re-exclude it.
- gl_WARN_ADD([-Wno-format-nonliteral])
# This should be < 1024 really. pixman_utils is the blackspot
# preventing lower usage
@@ -148,21 +148,29 @@ AC_DEFUN([SPICE_COMPILE_WARNINGS],[
then
gl_WARN_ADD([-Werror])
fi
- WARN_CXXFLAGS=$WARN_CFLAGS
- AC_SUBST([WARN_CXXFLAGS])
- # These are C-only warnings
- if test "x$enable_tunnel" != "xyes"; then
- # Slirp causes pain :-(
- gl_WARN_ADD([-Waggregate-return])
- fi
- gl_WARN_ADD([-Wstrict-prototypes])
- gl_WARN_ADD([-Wold-style-definition])
- gl_WARN_ADD([-Wnested-externs])
- gl_WARN_ADD([-Wformat-zero-length])
- gl_WARN_ADD([-Wpointer-to-int-cast])
- gl_WARN_ADD([-Wjump-misses-init])
+ save_CFLAGS="$WARN_CFLAGS"
+
+ # -Wno-suggest-final-methods and -Wno-suggest-final-types to avoid warnings for optimization
+ gl_WARN_ADD([-Wno-suggest-final-methods])
+ gl_WARN_ADD([-Wno-suggest-final-types])
+
+ # -Wno-array-bounds to avoid checks for array with 0 size
+ gl_WARN_ADD([-Wno-array-bounds])
+ gl_WARN_ADD([-Wno-stringop-overflow])
+
+ # -Wno-narrowing to allow cast from -1 to unsigned (used in some initialization)
+ gl_WARN_ADD([-Wno-narrowing])
+
+ gl_WARN_ADD([-Wno-missing-field-initializers])
+
+ # -Wshadow detects shadowing of arguments, globals and C++ attributes
+ gl_WARN_ADD([-Wshadow])
+
+ WARN_CXXFLAGS="$WARN_CFLAGS"
+ AC_SUBST([WARN_CXXFLAGS])
+ WARN_CFLAGS="$save_CFLAGS"
WARN_LDFLAGS=$WARN_CFLAGS
AC_SUBST([WARN_CFLAGS])
AC_SUBST([WARN_LDFLAGS])