From 9105f4dd8de384ac8f58011993f0214b242d7773 Mon Sep 17 00:00:00 2001 From: Robert Hooker Date: Mon, 5 Mar 2012 10:56:14 -0500 Subject: util-macros 1.16.2 Also bump util-macros version mentioned in debian/versions --- util-macros/ChangeLog | 110 +++++++++++++++++++ util-macros/configure | 20 ++-- util-macros/configure.ac | 2 +- util-macros/xorg-macros.m4.in | 244 +++++++++++++++++++++++++++--------------- 4 files changed, 281 insertions(+), 95 deletions(-) (limited to 'util-macros') diff --git a/util-macros/ChangeLog b/util-macros/ChangeLog index 339ec60..1bad117 100644 --- a/util-macros/ChangeLog +++ b/util-macros/ChangeLog @@ -1,3 +1,113 @@ +commit db238c632bb7136e3e44345820d514106e317420 +Author: Gaetan Nadon +Date: Mon Mar 5 09:39:17 2012 -0500 + + Version bump: 1.16.2 + + Signed-off-by: Gaetan Nadon + +commit 44aa8e75c8e54c5bc09d0cbff2f7207abe80c980 +Author: Chase Douglas +Date: Wed Feb 29 12:18:51 2012 -0800 + + Define BASE_CXXFLAGS when C++ is the chosen language + + You can use this functionality by setting the language to C++ before + calling XORG_DEFAULT_OPTIONS. This can accomplished with AC_LANG(C++). + + Signed-off-by: Chase Douglas + Reviewed-by: Gaetan Nadon + +commit 543ce698747dc998ca0ed987ef1ab0c35fb501b1 +Author: Chase Douglas +Date: Wed Feb 29 09:51:02 2012 -0800 + + Make XORG_TESTSET_CFLAG work for multiple languages + + Signed-off-by: Chase Douglas + Reviewed-by: Gaetan Nadon + +commit 52ef6f666a4fb46b693c81dc7a44612e6b78239d +Author: Jon TURNEY +Date: Tue Feb 14 21:59:38 2012 +0000 + + Use AS_ECHO rather than AS_ECHO_N in XORG_TESTSET_CFLAG + + The AS_ECHO_N macro was only introduced in autoconf 2.62. + Backticks remove trailing newlines, so we don't need to use echo -n + + Signed-off-by: Jon TURNEY + Reviewed-by: Gaetan Nadon + +commit a1809fde56e45639556a44fd3c3ef9213204c5a9 +Author: Jon TURNEY +Date: Mon Jan 2 19:42:10 2012 +0000 + + Cache the results of checking compiler flag support in XORG_TESTSET_CFLAG + + Since checking all those warning flags takes an amount of time I find irritating, + here is an attempt at caching the results of checking compiler warning flag support + + A couple of aspects which need definitely need review or testing: + + * I've tried to get things right when not the first flag in the list of alternates is + supported, but this really needs testing with a compiler other than gcc + + * The cache variable naming policy is a bit opaque me, so the names used may need corecting + + * I've tried to be careful, but who knows what portability sins I have committed :-) + + This change reduces the time to run the ./configure script produced from a configure.ac + containing just + + AC_INIT([test], 1.0) + XORG_COMPILER_FLAGS + XORG_CWARNFLAGS + XORG_STRICT_OPTION + AC_OUTPUT() + + from ~60s to ~20s on my cygwin machine, and from ~15s to ~9s on a linux VM running on the + same hardware + + v2: AS_TR_SH transforms characters which are invalid in shell variable names, so we don't + have to use sed to transform spaces ourself + + Signed-off-by: Jon TURNEY + Reviewed-by: Gaetan Nadon + +commit 214132d470ef98b5d3cdc71662cb586025746bb5 +Author: Jeremy Huddleston +Date: Fri Jan 20 23:46:56 2012 -0800 + + Version bump: 1.16.1 + + Signed-off-by: Jeremy Huddleston + +commit 088c848e74ac47bbd84eac70ef18a3d2abe96936 +Author: Jeremy Huddleston +Date: Sun Dec 18 15:57:43 2011 -0800 + + 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 + +commit 55f387315c4429704d2d5212fb1e3b130638e097 +Author: Jeremy Huddleston +Date: Sat Dec 10 11:55:29 2011 -0800 + + Remove -Winline from BASE_CFLAGS + + This might be useful for performance tuning builds against specific + compilers, but it is a bit too noisy to be used in general. + + Signed-off-by: Jeremy Huddleston + commit a8f51b6864c65ab226f2febd7322354fb00b9444 Author: Gaetan Nadon Date: Wed Dec 7 15:15:54 2011 -0500 diff --git a/util-macros/configure b/util-macros/configure index ac3d547..f9d69bd 100755 --- a/util-macros/configure +++ b/util-macros/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for util-macros 1.16.0. +# Generated by GNU Autoconf 2.68 for util-macros 1.16.2. # # Report bugs to . # @@ -560,8 +560,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='util-macros' PACKAGE_TARNAME='util-macros' -PACKAGE_VERSION='1.16.0' -PACKAGE_STRING='util-macros 1.16.0' +PACKAGE_VERSION='1.16.2' +PACKAGE_STRING='util-macros 1.16.2' PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg' PACKAGE_URL='' @@ -1183,7 +1183,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures util-macros 1.16.0 to adapt to many kinds of systems. +\`configure' configures util-macros 1.16.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1249,7 +1249,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of util-macros 1.16.0:";; + short | recursive ) echo "Configuration of util-macros 1.16.2:";; esac cat <<\_ACEOF @@ -1323,7 +1323,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -util-macros configure 1.16.0 +util-macros configure 1.16.2 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1340,7 +1340,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by util-macros $as_me 1.16.0, which was +It was created by util-macros $as_me 1.16.2, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2156,7 +2156,7 @@ fi # Define the identity of the package. PACKAGE='util-macros' - VERSION='1.16.0' + VERSION='1.16.2' cat >>confdefs.h <<_ACEOF @@ -2837,7 +2837,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by util-macros $as_me 1.16.0, which was +This file was extended by util-macros $as_me 1.16.2, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -2890,7 +2890,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -util-macros config.status 1.16.0 +util-macros config.status 1.16.2 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/util-macros/configure.ac b/util-macros/configure.ac index 9f8aa0f..7e33435 100644 --- a/util-macros/configure.ac +++ b/util-macros/configure.ac @@ -23,7 +23,7 @@ dnl Process this file with autoconf to create configure. AC_PREREQ([2.60]) AC_INIT([util-macros], - [1.16.0], + [1.16.2], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [util-macros]) AC_CONFIG_SRCDIR([Makefile.am]) diff --git a/util-macros/xorg-macros.m4.in b/util-macros/xorg-macros.m4.in index 3fd5348..4966df3 100644 --- a/util-macros/xorg-macros.m4.in +++ b/util-macros/xorg-macros.m4.in @@ -1424,12 +1424,20 @@ AM_CONDITIONAL(MAKE_LINT_LIB, [test x$make_lint_lib != xno]) # # Checks for various brands of compilers and sets flags as appropriate: # GNU gcc - relies on AC_PROG_CC (via AC_PROG_CC_C99) to set GCC to "yes" +# GNU g++ - relies on AC_PROG_CXX to set GXX to "yes" # clang compiler - sets CLANGCC to "yes" # Intel compiler - sets INTELCC to "yes" # Sun/Oracle Solaris Studio cc - sets SUNCC to "yes" # AC_DEFUN([XORG_COMPILER_BRAND], [ -AC_REQUIRE([AC_PROG_CC_C99]) +AC_LANG_CASE( + [C], [ + AC_REQUIRE([AC_PROG_CC_C99]) + ], + [C++], [ + AC_REQUIRE([AC_PROG_CXX]) + ] +) AC_CHECK_DECL([__clang__], [CLANGCC="yes"], [CLANGCC="no"]) AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"]) AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) @@ -1449,54 +1457,73 @@ AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"]) # -Werror=unused-command-line-argument # AC_DEFUN([XORG_TESTSET_CFLAG], [ -AC_REQUIRE([AC_PROG_CC_C99]) m4_if([$#], 0, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])]) m4_if([$#], 1, [m4_fatal([XORG_TESTSET_CFLAG was given with an unsupported number of arguments])]) -xorg_testset_save_CFLAGS="$CFLAGS" +AC_LANG_COMPILER_REQUIRE + +AC_LANG_CASE( + [C], [ + AC_REQUIRE([AC_PROG_CC_C99]) + define([PREFIX], [C]) + ], + [C++], [ + define([PREFIX], [CXX]) + ] +) + +[xorg_testset_save_]PREFIX[FLAGS]="$PREFIX[FLAGS]" if test "x$xorg_testset_unknown_warning_option" = "x" ; then - CFLAGS="$CFLAGS -Werror=unknown-warning-option" - AC_MSG_CHECKING([if $CC supports -Werror=unknown-warning-option]) - AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], - [xorg_testset_unknown_warning_option=yes], - [xorg_testset_unknown_warning_option=no]) - AC_MSG_RESULT([$xorg_testset_unknown_warning_option]) - CFLAGS="$xorg_testset_save_CFLAGS" + PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" + AC_CACHE_CHECK([if compiler supports -Werror=unknown-warning-option], + xorg_cv_compiler_flag_unknown_warning_option, + AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], + [xorg_cv_compiler_flag_unknown_warning_option=yes], + [xorg_cv_compiler_flag_unknown_warning_option=no])) + xorg_testset_unknown_warning_option=$xorg_cv_compiler_flag_unknown_warning_option + PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]" 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" + PREFIX[FLAGS]="$PREFIX[FLAGS] -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" + PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" + AC_CACHE_CHECK([if compiler supports -Werror=unused-command-line-argument], + xorg_cv_compiler_flag_unused_command_line_argument, + AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], + [xorg_cv_compiler_flag_unused_command_line_argument=yes], + [xorg_cv_compiler_flag_unused_command_line_argument=no])) + xorg_testset_unused_command_line_argument=$xorg_cv_compiler_flag_unused_command_line_argument + PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]" 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" + PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" fi if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then - CFLAGS="$CFLAGS -Werror=unused-command-line-argument" + PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" fi - CFLAGS="$CFLAGS ]flag[" + PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag[" +dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname AC_MSG_CHECKING([if $CC supports ]flag[]) - AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])], - [supported=yes], [supported=no]) - AC_MSG_RESULT([$supported]) - CFLAGS="$xorg_testset_save_CFLAGS" + cacheid=`AS_ECHO([xorg_cv_cc_flag_]flag[])` + AC_CACHE_VAL(AS_TR_SH($cacheid), + [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])], + [eval AS_TR_SH($cacheid)=yes], + [eval AS_TR_SH($cacheid)=no])]) + PREFIX[FLAGS]="$[xorg_testset_save_]PREFIX[FLAGS]" + + eval supported=$AS_TR_SH($cacheid) + AC_MSG_RESULT([$supported]) if test "$supported" = "yes" ; then $1="$$1 ]flag[" found="yes" @@ -1509,70 +1536,106 @@ m4_foreach([flag], m4_cdr($@), [ # --------------- # Minimum version: 1.16.0 # -# Defines BASE_CFLAGS to contain a set of command line arguments supported -# by the selected compiler which do NOT alter the generated code. These -# arguments will cause the compiler to print various warnings during -# compilation AND turn a conservative set of warnings into errors. +# Defines BASE_CFLAGS or BASE_CXXFLAGS to contain a set of command line +# arguments supported by the selected compiler which do NOT alter the generated +# code. These arguments will cause the compiler to print various warnings +# during compilation AND turn a conservative set of warnings into errors. # -# The set of flags supported by BASE_CFLAGS will grow in future -# versions of util-macros as options are added to new compilers. +# The set of flags supported by BASE_CFLAGS and BASE_CXXFLAGS will grow in +# future versions of util-macros as options are added to new compilers. # 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]) + +AC_LANG_CASE( + [C], [ + define([PREFIX], [C]) + ], + [C++], [ + define([PREFIX], [CXX]) + ] +) # -v is too short to test reliably with XORG_TESTSET_CFLAG if test "x$SUNCC" = "xyes"; then - BASE_CFLAGS="-v" + [BASE_]PREFIX[FLAGS]="-v" else - BASE_CFLAGS="" + [BASE_]PREFIX[FLAGS]="" fi # This chunk of warnings were those that existed in the legacy CWARNFLAGS -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wall]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wpointer-arith]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wstrict-prototypes]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-prototypes]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-declarations]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wnested-externs]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wbad-function-cast]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wformat=2], [-Wformat]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wold-style-definition]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wdeclaration-after-statement]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wall]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-arith]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-declarations]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wformat=2], [-Wformat]) + +AC_LANG_CASE( + [C], [ + XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wstrict-prototypes]) + XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes]) + XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs]) + XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast]) + XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition]) + XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement]) + ] +) # This chunk adds additional warnings that could catch undesired effects. -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wunused]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wuninitialized]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wshadow]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-qual]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-noreturn]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wmissing-format-attribute]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wredundant-decls]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Winline]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls]) # These are currently disabled because they are noisy. They will be enabled # in the future once the codebase is sufficiently modernized to silence # them. For now, I don't want them to drown out the other warnings. -# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wlogical-op]) -# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wparentheses]) -# XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Wcast-align]) +# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op]) +# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses]) +# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align]) # Turn some warnings into errors, so we don't accidently get successful builds # when there are problems that should be fixed. -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]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=main]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=missing-braces]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=sequence-point]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=trigraphs]) -XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Werror=array-bounds]) -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 - -AC_SUBST([BASE_CFLAGS]) + +if test "x$SELECTIVE_WERROR" = "xyes" ; then +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=implicit], [-errwarn=E_NO_EXPLICIT_TYPE_GIVEN -errwarn=E_NO_IMPLICIT_DECL_ALLOWED]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=nonnull]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=init-self]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=main]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=missing-braces]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=sequence-point]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=return-type], [-errwarn=E_FUNC_HAS_NO_RETURN_STMT]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=trigraphs]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=array-bounds]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=write-strings]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=address]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Werror=int-to-pointer-cast], [-errwarn=E_BAD_PTR_INT_COMBINATION]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-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_]PREFIX[FLAGS]], [-Wimplicit]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnonnull]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Winit-self]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmain]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-braces]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wsequence-point]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wreturn-type]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wtrigraphs]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Warray-bounds]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wwrite-strings]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Waddress]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wint-to-pointer-cast]) +XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wpointer-to-int-cast]) +fi + +AC_SUBST([BASE_]PREFIX[FLAGS]) ]) # XORG_COMPILER_FLAGS # XORG_CWARNFLAGS @@ -1590,11 +1653,15 @@ AC_SUBST([BASE_CFLAGS]) AC_DEFUN([XORG_CWARNFLAGS], [ AC_REQUIRE([XORG_COMPILER_FLAGS]) AC_REQUIRE([XORG_COMPILER_BRAND]) -CWARNFLAGS="$BASE_CFLAGS" -if test "x$GCC" = xyes ; then - CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing" -fi -AC_SUBST(CWARNFLAGS) +AC_LANG_CASE( + [C], [ + CWARNFLAGS="$BASE_CFLAGS" + if test "x$GCC" = xyes ; then + CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing" + fi + AC_SUBST(CWARNFLAGS) + ] +) ]) # XORG_CWARNFLAGS # XORG_STRICT_OPTION @@ -1604,7 +1671,7 @@ AC_SUBST(CWARNFLAGS) # Add configure option to enable strict compilation flags, such as treating # warnings as fatal errors. # If --enable-strict-compilation is passed to configure, adds strict flags to -# $BASE_CFLAGS and the deprecated $CWARNFLAGS. +# $BASE_CFLAGS or $BASE_CXXFLAGS and the deprecated $CWARNFLAGS. # # Starting in 1.14.0 also exports $STRICT_CFLAGS for use in other tests or # when strict compilation is unconditionally desired. @@ -1617,21 +1684,30 @@ AC_ARG_ENABLE(strict-compilation, [Enable all warnings from compiler and make them errors (default: disabled)]), [STRICT_COMPILE=$enableval], [STRICT_COMPILE=no]) -STRICT_CFLAGS="" -XORG_TESTSET_CFLAG([STRICT_CFLAGS], [-pedantic]) -XORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror], [-errwarn]) +AC_LANG_CASE( + [C], [ + define([PREFIX], [C]) + ], + [C++], [ + define([PREFIX], [CXX]) + ] +) + +[STRICT_]PREFIX[FLAGS]="" +XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-pedantic]) +XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror], [-errwarn]) # Earlier versions of gcc (eg: 4.2) support -Werror=attributes, but do not # activate it with -Werror, so we add it here explicitly. -XORG_TESTSET_CFLAG([STRICT_CFLAGS], [-Werror=attributes]) +XORG_TESTSET_CFLAG([[STRICT_]PREFIX[FLAGS]], [-Werror=attributes]) if test "x$STRICT_COMPILE" = "xyes"; then - BASE_CFLAGS="$BASE_CFLAGS $STRICT_CFLAGS" - CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS" + [BASE_]PREFIX[FLAGS]="$[BASE_]PREFIX[FLAGS] $[STRICT_]PREFIX[FLAGS]" + AC_LANG_CASE([C], [CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"]) fi -AC_SUBST([STRICT_CFLAGS]) -AC_SUBST([BASE_CFLAGS]) -AC_SUBST([CWARNFLAGS]) +AC_SUBST([STRICT_]PREFIX[FLAGS]) +AC_SUBST([BASE_]PREFIX[FLAGS]) +AC_LANG_CASE([C], AC_SUBST([CWARNFLAGS])) ]) # XORG_STRICT_OPTION # XORG_DEFAULT_OPTIONS -- cgit v1.2.3