summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2011-11-10 23:45:57 -0800
committerJeremy Huddleston <jeremyhu@apple.com>2011-11-11 00:00:13 -0800
commit2d4a7a4cf645c9cb586cf2f77f8d3f61d6c71883 (patch)
treeb945fae6c9ba04c77b57e7f9b1bd43e6aa62f701
parent9d8a1e5809b4dd397efe2e62bbf2c8a6c4deb795 (diff)
downloadxorg-util-macros-2d4a7a4cf645c9cb586cf2f77f8d3f61d6c71883.tar.gz
XORG_TESTSET_CFLAG: Add support fot -Werror=unused-command-line-argument
This warning was was added to clang in r144365 Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--xorg-macros.m4.in26
1 files changed, 22 insertions, 4 deletions
diff --git a/xorg-macros.m4.in b/xorg-macros.m4.in
index 5b56d96..ed908e2 100644
--- a/xorg-macros.m4.in
+++ b/xorg-macros.m4.in
@@ -1445,7 +1445,8 @@ AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
#
# Note that this does not guarantee that the compiler supports the flag as some
# compilers will simply ignore arguments that they do not understand, but we do
-# attempt to weed out false positives by using -Werror=unknown-warning-option
+# attempt to weed out false positives by using -Werror=unknown-warning-option and
+# -Werror=unused-command-line-argument
#
AC_DEFUN([XORG_TESTSET_CFLAG], [
AC_REQUIRE([AC_PROG_CC_C99])
@@ -1464,15 +1465,32 @@ if test "x$xorg_testset_unknown_warning_option" = "x" ; then
CFLAGS="$xorg_testset_save_CFLAGS"
fi
+if test "x$xorg_testset_unused_command_line_argument" = "x" ; then
+ if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
+ CFLAGS="$CFLAGS -Werror=unknown-warning-option"
+ fi
+ CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
+ AC_MSG_CHECKING([if $CC supports -Werror=unused-command-line-argument])
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
+ [xorg_testset_unused_command_line_argument=yes],
+ [xorg_testset_unused_command_line_argument=no])
+ AC_MSG_RESULT([$xorg_testset_unused_command_line_argument])
+ CFLAGS="$xorg_testset_save_CFLAGS"
+fi
+
found="no"
m4_foreach([flag], m4_cdr($@), [
if test $found = "no" ; then
if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then
- CFLAGS="$CFLAGS -Werror=unknown-warning-option ]flag["
- else
- CFLAGS="$CFLAGS ]flag["
+ CFLAGS="$CFLAGS -Werror=unknown-warning-option"
+ fi
+
+ if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then
+ CFLAGS="$CFLAGS -Werror=unused-command-line-argument"
fi
+ CFLAGS="$CFLAGS ]flag["
+
AC_MSG_CHECKING([if $CC supports ]flag[])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])],
[supported=yes], [supported=no])