summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2012-02-18 09:42:50 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2012-02-18 09:42:50 +0000
commite4fa6e6e89386b98c3759220afd2433b93ab4bfa (patch)
treea11a19b089fbb78fcdda2210d9b880324921569d
parentfe856853543e9ea959a4e90c2053fd8f7be7cb58 (diff)
Update util-macros to 1.16.1
-rw-r--r--util/macros/ChangeLog166
-rw-r--r--util/macros/configure20
-rw-r--r--util/macros/configure.ac2
-rw-r--r--util/macros/xorg-macros.m4.in288
4 files changed, 426 insertions, 50 deletions
diff --git a/util/macros/ChangeLog b/util/macros/ChangeLog
index 2290e905e..4ecb84b9a 100644
--- a/util/macros/ChangeLog
+++ b/util/macros/ChangeLog
@@ -1,3 +1,169 @@
+commit 214132d470ef98b5d3cdc71662cb586025746bb5
+Author: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Fri Jan 20 23:46:56 2012 -0800
+
+ Version bump: 1.16.1
+
+ Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit 088c848e74ac47bbd84eac70ef18a3d2abe96936
+Author: Jeremy Huddleston <jeremyhu@apple.com>
+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 <jeremyhu@apple.com>
+
+commit 55f387315c4429704d2d5212fb1e3b130638e097
+Author: Jeremy Huddleston <jeremyhu@apple.com>
+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 <jeremyhu@apple.com>
+
+commit a8f51b6864c65ab226f2febd7322354fb00b9444
+Author: Gaetan Nadon <memsize@videotron.ca>
+Date: Wed Dec 7 15:15:54 2011 -0500
+
+ Version bump: 1.16.0
+
+ Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 87340dcccf97c3e1f0ab918bb6740abf47d65558
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Thu Dec 1 13:12:59 2011 -0800
+
+ XORG_TESTSET_CFLAG: Try to both compile & link with the flags
+
+ Catches build problems caused by compilers that ignore unknown flags
+ at compile time and pass them to the linker at link time, when the
+ linker considers unknown flags to be fatal errors.
+
+ Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+
+commit 2d4a7a4cf645c9cb586cf2f77f8d3f61d6c71883
+Author: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Thu Nov 10 23:45:57 2011 -0800
+
+ 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>
+
+commit 9d8a1e5809b4dd397efe2e62bbf2c8a6c4deb795
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Thu Nov 3 18:14:15 2011 -0700
+
+ Add XORG_MEMORY_CHECK_FLAGS and require it in XORG_ENABLE_UNIT_TESTS
+
+ Based on the checks already in libXt/configure.ac and proposed for
+ xserver/configure.ac - makes a common implementation before we make
+ more copies.
+
+ Callers should be able to just add
+ TESTS_ENVIRONMENT = $(XORG_MALLOC_DEBUG_ENV)
+
+ If built with an older xorg-macros, then the tests will simply be
+ less stringent, matching what happens on platforms without any
+ simple malloc debugging facilities available.
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+ Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit 9b4a8bae3528950bdb87df095c212d646e15dbdb
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Thu Nov 3 17:41:24 2011 -0700
+
+ Define __wrap_exit in test program source for XORG_LD_WRAP
+
+ Otherwise the test fails on Solaris releases that actually have support
+ for ld -wrap because the linker instead returns an error that __wrap_exit
+ is an undefined symbol.
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+ Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit 0295ee03ab45c55771581664d6c903c6d2f87e53
+Author: Alan Coopersmith <alan.coopersmith@oracle.com>
+Date: Thu Nov 3 15:54:25 2011 -0700
+
+ Add an optional argument to XORG_LD_WRAP
+
+ Allows specifying if ld -wrap support is 'required' or 'optional' for
+ unit tests, so that builds like the xserver which only need ld -wrap
+ for some tests can allow users to enable the others when ld -wrap is
+ not available.
+
+ Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
+ Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit b8a13e531db208a7c4c9a43b74b196104e7c66ed
+Author: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Tue Nov 1 12:59:55 2011 -0700
+
+ Add additional flags to XORG_COMPILER_FLAGS
+
+ Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit 08877399839f5a30a5edd2167fb4275d3dd9d473
+Author: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Tue Nov 1 12:44:48 2011 -0700
+
+ Update XORG_CWARNFLAGS to use XORG_COMPILER_FLAGS
+
+ Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit b406f730d64dfb8b699631ffb3ee5f3a1f0db8c4
+Author: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Tue Nov 1 12:19:24 2011 -0700
+
+ Add XORG_COMPILER_FLAGS to replace XORG_CWARNFLAGS
+
+ See: https://bugs.freedesktop.org/show_bug.cgi?id=31238
+
+ Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit b175fe0e07fce86cf029695e9e93b573ada54b0c
+Author: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Tue Nov 1 11:53:44 2011 -0700
+
+ Use XORG_TESTSET_CFLAG in XORG_STRICT_OPTION
+
+ Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+
+commit 9f427611f4bb6db60cb8cbdda6296a3bf66a5a6c
+Author: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Tue Nov 1 11:39:14 2011 -0700
+
+ Add XORG_TESTSET_CFLAG which can be used to test what flags the compiler supports
+
+ Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+ Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
+
+commit 4a6ecc7b8e338483fb5ea6bfc9b2fb26f890807b
+Author: Jeremy Huddleston <jeremyhu@apple.com>
+Date: Tue Nov 1 11:49:41 2011 -0700
+
+ Fix the test for -Werror=attributes
+
+ The current test was always failing to compile because 'return 0;' was
+ global rather than in the body of a function.
+
+ Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
+ Reviewed-by: Gaetan Nadon <memsize@videotron.ca>
+
commit 08dd5d30c137abe43d5b1673edc39eb569881d66
Author: Gaetan Nadon <memsize@videotron.ca>
Date: Thu Jun 23 08:03:13 2011 -0400
diff --git a/util/macros/configure b/util/macros/configure
index 0abcd8492..4ce7c0540 100644
--- 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.62 for util-macros 1.15.0.
+# Generated by GNU Autoconf 2.62 for util-macros 1.16.1.
#
# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>.
#
@@ -596,8 +596,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='util-macros'
PACKAGE_TARNAME='util-macros'
-PACKAGE_VERSION='1.15.0'
-PACKAGE_STRING='util-macros 1.15.0'
+PACKAGE_VERSION='1.16.1'
+PACKAGE_STRING='util-macros 1.16.1'
PACKAGE_BUGREPORT='https://bugs.freedesktop.org/enter_bug.cgi?product=xorg'
ac_unique_file="Makefile.am"
@@ -1225,7 +1225,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.15.0 to adapt to many kinds of systems.
+\`configure' configures util-macros 1.16.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1291,7 +1291,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of util-macros 1.15.0:";;
+ short | recursive ) echo "Configuration of util-macros 1.16.1:";;
esac
cat <<\_ACEOF
@@ -1365,7 +1365,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-util-macros configure 1.15.0
+util-macros configure 1.16.1
generated by GNU Autoconf 2.62
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1379,7 +1379,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.15.0, which was
+It was created by util-macros $as_me 1.16.1, which was
generated by GNU Autoconf 2.62. Invocation command line was
$ $0 $@
@@ -2029,7 +2029,7 @@ fi
# Define the identity of the package.
PACKAGE='util-macros'
- VERSION='1.15.0'
+ VERSION='1.16.1'
cat >>confdefs.h <<_ACEOF
@@ -2812,7 +2812,7 @@ exec 6>&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.15.0, which was
+This file was extended by util-macros $as_me 1.16.1, which was
generated by GNU Autoconf 2.62. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -2855,7 +2855,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_version="\\
-util-macros config.status 1.15.0
+util-macros config.status 1.16.1
configured by $0, generated by GNU Autoconf 2.62,
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
diff --git a/util/macros/configure.ac b/util/macros/configure.ac
index cfec46aa4..3e81c60b8 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.15.0],
+ [1.16.1],
[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 0527dfe23..8197eb6be 100644
--- a/util/macros/xorg-macros.m4.in
+++ b/util/macros/xorg-macros.m4.in
@@ -1045,6 +1045,7 @@ AC_MSG_RESULT([$build_specs])
AC_DEFUN([XORG_ENABLE_UNIT_TESTS],[
AC_BEFORE([$0], [XORG_WITH_GLIB])
AC_BEFORE([$0], [XORG_LD_WRAP])
+AC_REQUIRE([XORG_MEMORY_CHECK_FLAGS])
m4_define([_defopt], m4_default([$1], [auto]))
AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--enable-unit-tests],
[Enable building unit test cases (default: ]_defopt[)]),
@@ -1116,8 +1117,8 @@ fi
AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
]) # XORG_WITH_GLIB
-# XORG_LD_WRAP
-# ------------
+# XORG_LD_WRAP([required|optional])
+# ---------------------------------
# Minimum version: 1.13.0
#
# Check if linker supports -wrap, passed via compiler flags
@@ -1125,10 +1126,18 @@ AM_CONDITIONAL([HAVE_GLIB], [test "$have_glib" = yes])
# When used with ENABLE_UNIT_TESTS, it is assumed -wrap is used for unit testing.
# Otherwise the value of $enable_unit_tests is blank.
#
+# Argument added in 1.16.0 - default is "required", to match existing behavior
+# of returning an error if enable_unit_tests is yes, and ld -wrap is not
+# available, an argument of "optional" allows use when some unit tests require
+# ld -wrap and others do not.
+#
AC_DEFUN([XORG_LD_WRAP],[
-XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no])
+XORG_CHECK_LINKER_FLAGS([-Wl,-wrap,exit],[have_ld_wrap=yes],[have_ld_wrap=no],
+ [AC_LANG_PROGRAM([#include <stdlib.h>
+ void __wrap_exit(int status) { return; }],
+ [exit(0);])])
# Not having ld wrap when unit testing has been explicitly requested is an error
-if test "x$enable_unit_tests" = x"yes"; then
+if test "x$enable_unit_tests" = x"yes" -a "x$1" != "xoptional"; then
if test "x$have_ld_wrap" = x"no"; then
AC_MSG_ERROR([--enable-unit-tests=yes specified but ld -wrap support is not available])
fi
@@ -1141,7 +1150,7 @@ AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
# -----------------------
# SYNOPSIS
#
-# XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE])
+# XORG_CHECK_LINKER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE], [PROGRAM-SOURCE])
#
# DESCRIPTION
#
@@ -1151,6 +1160,8 @@ AM_CONDITIONAL([HAVE_LD_WRAP], [test "$have_ld_wrap" = yes])
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
# success/failure.
#
+# PROGRAM-SOURCE is the program source to link with, if needed
+#
# NOTE: Based on AX_CHECK_COMPILER_FLAGS.
#
# LICENSE
@@ -1191,7 +1202,7 @@ AS_LITERAL_IF([$1],
[AC_CACHE_VAL(AS_TR_SH(xorg_cv_linker_flags_[$1]), [
ax_save_FLAGS=$LDFLAGS
LDFLAGS="$1"
- AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+ AC_LINK_IFELSE([m4_default([$4],[AC_LANG_PROGRAM()])],
AS_TR_SH(xorg_cv_linker_flags_[$1])=yes,
AS_TR_SH(xorg_cv_linker_flags_[$1])=no)
LDFLAGS=$ax_save_FLAGS])],
@@ -1210,6 +1221,52 @@ else
fi
]) # XORG_CHECK_LINKER_FLAGS
+# XORG_MEMORY_CHECK_FLAGS
+# -----------------------
+# Minimum version: 1.16.0
+#
+# This macro attempts to find appropriate memory checking functionality
+# for various platforms which unit testing code may use to catch various
+# forms of memory allocation and access errors in testing.
+#
+# Interface to module:
+# XORG_MALLOC_DEBUG_ENV - environment variables to set to enable debugging
+# Usually added to TESTS_ENVIRONMENT in Makefile.am
+#
+# If the user sets the value of XORG_MALLOC_DEBUG_ENV, it is used verbatim.
+#
+AC_DEFUN([XORG_MEMORY_CHECK_FLAGS],[
+
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_ARG_VAR([XORG_MALLOC_DEBUG_ENV],
+ [Environment variables to enable memory checking in tests])
+
+# Check for different types of support on different platforms
+case $host_os in
+ solaris*)
+ AC_CHECK_LIB([umem], [umem_alloc],
+ [malloc_debug_env='LD_PRELOAD=libumem.so UMEM_DEBUG=default'])
+ ;;
+ *-gnu*) # GNU libc - Value is used as a single byte bit pattern,
+ # both directly and inverted, so should not be 0 or 255.
+ malloc_debug_env='MALLOC_PERTURB_=15'
+ ;;
+ darwin*)
+ malloc_debug_env='MallocPreScribble=1 MallocScribble=1 DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib'
+ ;;
+ *bsd*)
+ malloc_debug_env='MallocPreScribble=1 MallocScribble=1'
+ ;;
+esac
+
+# User supplied flags override default flags
+if test "x$XORG_MALLOC_DEBUG_ENV" != "x"; then
+ malloc_debug_env="$XORG_MALLOC_DEBUG_ENV"
+fi
+
+AC_SUBST([XORG_MALLOC_DEBUG_ENV],[$malloc_debug_env])
+]) # XORG_WITH_LINT
+
# XORG_CHECK_MALLOC_ZERO
# ----------------------
# Minimum version: 1.0.0
@@ -1378,28 +1435,187 @@ AC_CHECK_DECL([__INTEL_COMPILER], [INTELCC="yes"], [INTELCC="no"])
AC_CHECK_DECL([__SUNPRO_C], [SUNCC="yes"], [SUNCC="no"])
]) # XORG_COMPILER_BRAND
+# XORG_TESTSET_CFLAG(<variable>, <flag>, [<alternative flag>, ...])
+# ---------------
+# Minimum version: 1.16.0
+#
+# Test if the compiler works when passed the given flag as a command line argument.
+# If it succeeds, the flag is appeneded to the given variable. If not, it tries the
+# next flag in the list until there are no more options.
+#
+# 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 and
+# -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"
+
+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"
+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"
+ 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_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
+ [supported=yes], [supported=no])
+ AC_MSG_RESULT([$supported])
+ CFLAGS="$xorg_testset_save_CFLAGS"
+
+ if test "$supported" = "yes" ; then
+ $1="$$1 ]flag["
+ found="yes"
+ fi
+ fi
+])
+]) # XORG_TESTSET_CFLAG
+
+# XORG_COMPILER_FLAGS
+# ---------------
+# 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.
+#
+# The set of flags supported by BASE_CFLAGS 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])
+
+# -v is too short to test reliably with XORG_TESTSET_CFLAG
+if test "x$SUNCC" = "xyes"; then
+ BASE_CFLAGS="-v"
+else
+ BASE_CFLAGS=""
+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])
+
+# 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])
+
+# 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])
+
+# 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])
+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
+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
+
# XORG_CWARNFLAGS
# ---------------
# Minimum version: 1.2.0
+# Deprecated since: 1.16.0 (Use XORG_COMPILER_FLAGS instead)
#
# Defines CWARNFLAGS to enable C compiler warnings.
#
+# This function is deprecated because it defines -fno-strict-aliasing
+# which alters the code generated by the compiler. If -fno-strict-aliasing
+# is needed, then it should be added explicitly in the module when
+# it is updated to use BASE_CFLAGS.
+#
AC_DEFUN([XORG_CWARNFLAGS], [
-AC_REQUIRE([AC_PROG_CC_C99])
+AC_REQUIRE([XORG_COMPILER_FLAGS])
AC_REQUIRE([XORG_COMPILER_BRAND])
+CWARNFLAGS="$BASE_CFLAGS"
if test "x$GCC" = xyes ; then
- CWARNFLAGS="-Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
--Wmissing-declarations -Wnested-externs -fno-strict-aliasing \
--Wbad-function-cast -Wformat=2"
- case `$CC -dumpversion` in
- 3.4.* | 4.*)
- CWARNFLAGS="$CWARNFLAGS -Wold-style-definition -Wdeclaration-after-statement"
- ;;
- esac
-else
- if test "x$SUNCC" = "xyes"; then
- CWARNFLAGS="-v"
- fi
+ CWARNFLAGS="$CWARNFLAGS -fno-strict-aliasing"
fi
AC_SUBST(CWARNFLAGS)
]) # XORG_CWARNFLAGS
@@ -1411,40 +1627,33 @@ 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
-# $CWARNFLAGS.
+# $BASE_CFLAGS 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.
AC_DEFUN([XORG_STRICT_OPTION], [
-# If the module's configure.ac calls AC_PROG_CC later on, CC gets set to C89
-AC_REQUIRE([AC_PROG_CC_C99])
-AC_REQUIRE([XORG_COMPILER_BRAND])
AC_REQUIRE([XORG_CWARNFLAGS])
+AC_REQUIRE([XORG_COMPILER_FLAGS])
AC_ARG_ENABLE(strict-compilation,
AS_HELP_STRING([--enable-strict-compilation],
[Enable all warnings from compiler and make them errors (default: disabled)]),
[STRICT_COMPILE=$enableval], [STRICT_COMPILE=no])
-if test "x$GCC" = xyes ; then
- STRICT_CFLAGS="-pedantic -Werror"
- # Add -Werror=attributes if supported (gcc 4.2 & later)
- AC_MSG_CHECKING([if $CC supports -Werror=attributes])
- save_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $STRICT_CFLAGS -Werror=attributes"
- AC_COMPILE_IFELSE([AC_LANG_SOURCE([return 0;])],
- [STRICT_CFLAGS="$STRICT_CFLAGS -Werror=attributes"
- AC_MSG_RESULT([yes])],
- [AC_MSG_RESULT([no])])
- CFLAGS="$save_CFLAGS"
-elif test "x$SUNCC" = "xyes"; then
- STRICT_CFLAGS="-errwarn"
-elif test "x$INTELCC" = "xyes"; then
- STRICT_CFLAGS="-Werror"
-fi
+
+STRICT_CFLAGS=""
+XORG_TESTSET_CFLAG([STRICT_CFLAGS], [-pedantic])
+XORG_TESTSET_CFLAG([STRICT_CFLAGS], [-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])
+
if test "x$STRICT_COMPILE" = "xyes"; then
+ BASE_CFLAGS="$BASE_CFLAGS $STRICT_CFLAGS"
CWARNFLAGS="$CWARNFLAGS $STRICT_CFLAGS"
fi
AC_SUBST([STRICT_CFLAGS])
+AC_SUBST([BASE_CFLAGS])
AC_SUBST([CWARNFLAGS])
]) # XORG_STRICT_OPTION
@@ -1456,6 +1665,7 @@ AC_SUBST([CWARNFLAGS])
#
AC_DEFUN([XORG_DEFAULT_OPTIONS], [
AC_REQUIRE([AC_PROG_INSTALL])
+XORG_COMPILER_FLAGS
XORG_CWARNFLAGS
XORG_STRICT_OPTION
XORG_RELEASE_VERSION