From 2d4a7a4cf645c9cb586cf2f77f8d3f61d6c71883 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Thu, 10 Nov 2011 23:45:57 -0800 Subject: 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 --- xorg-macros.m4.in | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'xorg-macros.m4.in') 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]) -- cgit v1.2.3