autoconf-patches
[Top][All Lists]
Advanced

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

Re: Fix chdir-long.m4 caching


From: Eric Blake
Subject: Re: Fix chdir-long.m4 caching
Date: Thu, 27 Sep 2007 22:33:45 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070728 Thunderbird/2.0.0.6 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 9/27/2007 10:33 PM:
>> 2006-09-26  Eric Blake  <address@hidden>
>>      and Ralf Wildenhues  <address@hidden>
> 
>>      * lib/autoconf/general.m4 (AC_CACHE_VAL): Warn if cache-id is not
>>      cached.
>>      * tests/base.at (AC_CACHE_CHECK): Adjust test to expect this,
>>      also test that macro names and correct literals are not checked.
> 
> Applied as follows:

Oops, forgot the attachment.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG/IQp84KuGfSFAYARApnEAJoDFQOR5zw8fVI64JpnJIp/iUwr7ACePHXj
ocWYZLt6vrIyFs0TR0Gf++o=
=S2QL
-----END PGP SIGNATURE-----
>From 220fef66a88d8b22ff401efd8212e0c6167f3f2d Mon Sep 17 00:00:00 2001
From: Ralf Wildenhues <address@hidden>
Date: Thu, 27 Sep 2007 22:14:06 -0600
Subject: [PATCH] Catch even more common AC_CACHE_VAL mistakes.

* lib/autoconf/general.m4 (AC_CACHE_VAL): Warn if cache variable
lacks '_cv_', or if AC_SUBST appears in body.
* tests/base.at (AC_CACHE_CHECK): Test this change.
---
 ChangeLog               |    8 ++++++++
 lib/autoconf/general.m4 |    8 +++++++-
 tests/base.at           |   16 +++++++++++++++-
 3 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ea29d1b..63278cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-09-27  Eric Blake  <address@hidden>
+       and Ralf Wildenhues  <address@hidden>
+
+       Catch even more common AC_CACHE_VAL mistakes.
+       * lib/autoconf/general.m4 (AC_CACHE_VAL): Warn if cache variable
+       lacks '_cv_', or if AC_SUBST appears in body.
+       * tests/base.at (AC_CACHE_CHECK): Test this change.
+
 2007-09-27  Stepan Kasal  <address@hidden>
        and Eric Blake  <address@hidden>
 
diff --git a/lib/autoconf/general.m4 b/lib/autoconf/general.m4
index 81f3a95..a0f473a 100644
--- a/lib/autoconf/general.m4
+++ b/lib/autoconf/general.m4
@@ -1950,9 +1950,15 @@ rm -f confcache[]dnl
 # The name of shell var CACHE-ID must contain `_cv_' in order to get saved.
 # Should be dnl'ed.  Try to catch common mistakes.
 m4_defun([AC_CACHE_VAL],
-[m4_bmatch([$2], [AC_DEFINE],
+[AS_LITERAL_IF([$1], [m4_bmatch(m4_quote($1), [_cv_], [],
+                               [AC_DIAGNOSE([syntax],
+[$0($1, ...): suspicious cache-id, must contain _cv_ to be cached])])])dnl
+m4_bmatch([$2], [AC_DEFINE],
           [AC_DIAGNOSE([syntax],
 [$0($1, ...): suspicious presence of an AC_DEFINE in the second argument, ]dnl
+[where no actions should be taken])],
+          [AC_SUBST], [AC_DIAGNOSE([syntax],
+[$0($1, ...): suspicious presence of an AC_SUBST in the second argument, ]dnl
 [where no actions should be taken])])dnl
 AS_VAR_SET_IF([$1],
              [_AS_ECHO_N([(cached) ])],
diff --git a/tests/base.at b/tests/base.at
index 0acabe7..f7e9ecf 100644
--- a/tests/base.at
+++ b/tests/base.at
@@ -2,7 +2,8 @@
 
 AT_BANNER([Autoconf base layer.])
 
-# Copyright (C) 2000, 2001, 2003, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2003, 2005, 2006, 2007 Free Software
+# Foundation, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -202,16 +203,29 @@ AT_CLEANUP
 ## ---------------- ##
 
 # Make sure AC_CACHE_CHECK is silent with -q.
+# Also make sure we warn about cache id's not named with `_cv_'.
 
 AT_SETUP([AC_CACHE_CHECK])
 
 AT_DATA([configure.ac],
 [[AC_INIT
+# m4_define([ac_nothing], [ac_cv_absolutely_nothing])
 AC_CACHE_CHECK([for nothing],
               [ac_nothing],
               [ac_nothing=found])
 ]])
 
+AT_CHECK_AUTOCONF([], [], [], [stderr])
+AT_CHECK([grep 'must contain _cv_ to be cached' stderr], [], [ignore])
+
+# Do not warn about defines:
+sed 's/^# //' configure.ac > t
+mv -f t configure.ac
+AT_CHECK_AUTOCONF
+AT_CHECK_CONFIGURE([-q])
+
+sed '/m4_define/d; s/ac_nothing/ac_cv_nothing/' configure.ac > t
+mv -f t configure.ac
 AT_CHECK_AUTOCONF
 AT_CHECK_CONFIGURE([-q])
 
-- 
1.5.3.2


reply via email to

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