autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Extend AT_CHECK_MACRO to test macros with -O2 -Wall -Werror


From: Didier Barvaux
Subject: Extend AT_CHECK_MACRO to test macros with -O2 -Wall -Werror
Date: Sat, 10 May 2008 14:36:25 +0200

Hi all,

I encountered a problem with the AC_C_CONST macro when using -O2 -Wall
-Werror as CFLAGS. The AC_C_CONST macro broke with similar CFLAGS some
time ago [1]. Thus I created a patch that extends the AT_CHECK_MACRO
macro used in the testsuite.

[1] http://lists.gnu.org/archive/html/bug-autoconf/2006-07/msg00011.html

With the patch, the AT_CHECK_MACRO macro checks that the tested macro
(such as the AC_C_CONST macro) is also run with the CFLAGS variable set
to "-O2 -Wall -Werror". The macro must give the same result with or
without the CFLAGS, otherwise the test fails. This should avoid a
similar bug to appear :)

diff --git a/tests/local.at b/tests/local.at
index a772a97..aa1f543 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -427,6 +427,9 @@ AT_CHECK_ENV
 # We run `configure' twice, both times with a cache, and compare
 # the environment after each run to detect inconsistencies.
 #
+# We run `configure' one more time with CFLAGS to check that unused or
+# uninitialized variables do not change the macro result.
+#
 # New macros are not expected to depend upon obsolete macros.
 m4_define([AT_CHECK_MACRO],
 [AT_SETUP([$1])
@@ -447,6 +450,20 @@ done
 AT_CMP([config-h.r1], [config-h.r2])
 AT_CONFIG_CMP([state-env.r1], [state-env.r2])
 
+AT_CONFIGURE_AC([CFLAGS="-O2 -Wall -Werror -fno-builtin"
+m4_default([$2], [$1])])
+
+AT_CHECK_AUTOCONF([m4_default([$4], [-W obsolete])])
+AT_CHECK_AUTOHEADER
+
+AT_CHECK_CONFIGURE([])
+cp -f state-env.after state-env.r3
+cp -f config.h config-h.r3
+AT_CHECK_ENV
+
+AT_CMP([config-h.r1], [config-h.r3])
+AT_CONFIG_CMP([state-env.r1], [state-env.r3])
+
 $3
 
 AT_CLEANUP[]dnl


Any comments are welcome.

Didier Barvaux

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]