diff options
author | Jeremy Huddleston <jeremyhu@apple.com> | 2011-12-18 15:57:43 -0800 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2011-12-29 21:09:57 -0800 |
commit | 088c848e74ac47bbd84eac70ef18a3d2abe96936 (patch) | |
tree | 3443fbe8e9ca917f4014d068ee496861e75aeea5 /xorg-macros.m4.in | |
parent | 55f387315c4429704d2d5212fb1e3b130638e097 (diff) |
Provide a configure option to turn off the selective -Werror=... CFLAGS
Provide end users with a workaround if they find code doesn't build with
the -Werror=... flags provided by BASE_CFLAGS. This can be useful if
newer util-macros are used with older source code that had problems, or
in the rare case when warnings are expanded to hit more cases (although
this case should not happen too much in practice).
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
Diffstat (limited to 'xorg-macros.m4.in')
-rw-r--r-- | xorg-macros.m4.in | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in index d9ed137..8197eb6 100644 --- a/xorg-macros.m4.in +++ b/xorg-macros.m4.in @@ -1520,6 +1520,12 @@ m4_foreach([flag], m4_cdr($@), [ AC_DEFUN([XORG_COMPILER_FLAGS], [ AC_REQUIRE([XORG_COMPILER_BRAND]) +AC_ARG_ENABLE(selective-werror, + AS_HELP_STRING([--disable-selective-werror], + [Turn off selective compiler errors. (default: enabled)]), + [SELECTIVE_WERROR=$enableval], + [SELECTIVE_WERROR=yes]) + # -v is too short to test reliably with XORG_TESTSET_CFLAG if test "x$SUNCC" = "xyes"; then BASE_CFLAGS="-v" @@ -1557,6 +1563,8 @@ XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wredundant-decls]) # Turn some warnings into errors, so we don't accidently get successful builds # when there are problems that should be fixed. + +if test "x$SELECTIVE_WERROR" = "xyes" ; then XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED]) XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=nonnull]) XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=init-self]) @@ -1570,6 +1578,22 @@ XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=write-strings]) XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=address]) XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION]) XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=pointer-to-int-cast]) # Also -errwarn=E_BAD_PTR_INT_COMBINATION +else +AC_MSG_WARN([You have chosen not to turn some select compiler warnings into errors. This should not be necessary. Please report why you needed to do so in a bug report at $PACKAGE_BUGREPORT]) +XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wimplicit]) +XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnonnull]) +XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Winit-self]) +XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmain]) +XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-braces]) +XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wsequence-point]) +XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wreturn-type]) +XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wtrigraphs]) +XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Warray-bounds]) +XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wwrite-strings]) +XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Waddress]) +XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wint-to-pointer-cast]) +XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-to-int-cast]) +fi AC_SUBST([BASE_CFLAGS]) ]) # XORG_COMPILER_FLAGS |