summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Hooker <sarvatt@ubuntu.com>2011-12-08 16:21:47 -0500
committerRobert Hooker <sarvatt@ubuntu.com>2011-12-08 16:21:47 -0500
commit101233a902bb08166bdd05094532f88945863c51 (patch)
treee0c3254d3469db8265b8cba3a72fb6940ae3aacd
parente90db80240019fd4c2faf027aeaafe58a13124e4 (diff)
downloadxutils-dev-101233a902bb08166bdd05094532f88945863c51.tar.gz
util-macros 1.16.0
-rw-r--r--debian/changelog6
-rw-r--r--util-macros/ChangeLog133
-rwxr-xr-xutil-macros/configure20
-rw-r--r--util-macros/configure.ac2
-rw-r--r--util-macros/xorg-macros.m4.in265
5 files changed, 376 insertions, 50 deletions
diff --git a/debian/changelog b/debian/changelog
index 0d9d94b..b68358c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+xutils-dev (1:7.6+7) UNRELEASED; urgency=low
+
+ * util-macros 1.16.0
+
+ -- Robert Hooker <sarvatt@ubuntu.com> Thu, 08 Dec 2011 16:19:45 -0500
+
xutils-dev (1:7.6+6) unstable; urgency=low
[ Julien Cristau ]
diff --git a/util-macros/ChangeLog b/util-macros/ChangeLog
index 2290e90..339ec60 100644
--- a/util-macros/ChangeLog
+++ b/util-macros/ChangeLog
@@ -1,3 +1,136 @@
+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 be072af..ac3d547 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.15.0.
+# Generated by GNU Autoconf 2.68 for util-macros 1.16.0.
#
# Report bugs to <https://bugs.freedesktop.org/enter_bug.cgi?product=xorg>.
#
@@ -560,8 +560,8 @@ MAKEFLAGS=
# 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.0'
+PACKAGE_STRING='util-macros 1.16.0'
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.15.0 to adapt to many kinds of systems.
+\`configure' configures util-macros 1.16.0 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.15.0:";;
+ short | recursive ) echo "Configuration of util-macros 1.16.0:";;
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.15.0
+util-macros configure 1.16.0
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.15.0, which was
+It was created by util-macros $as_me 1.16.0, 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.15.0'
+ VERSION='1.16.0'
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.15.0, which was
+This file was extended by util-macros $as_me 1.16.0, 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.15.0
+util-macros config.status 1.16.0
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 cfec46a..9f8aa0f 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.0],
[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 0527dfe..3fd5348 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,164 @@ 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])
+
+# -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])
+XORG_TESTSET_CFLAG([BASE_CFLAGS], [-Winline])
+
+# 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.
+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])
+]) # 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 +1604,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 +1642,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