autoconf-patches
[Top][All Lists]
Advanced

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

[PATCH] AS_LITERAL_IF: Treat raw = as literal again.


From: Eric Blake
Subject: [PATCH] AS_LITERAL_IF: Treat raw = as literal again.
Date: Fri, 8 Oct 2010 11:54:45 -0600

* lib/m4sugar/m4sh.m4 (_AS_LITERAL_IF): Treat = like +.
* tests/m4sh.at (AS@&address@hidden and AS@&address@hidden)
(AS@&address@hidden): Expand tests.
* NEWS: Document the fix.
Reported via Ben Pfaff; originally http://bugs.debian.org/593838

Signed-off-by: Eric Blake <address@hidden>
---

It turns out that the original Debian bug report is two for the price
of one.  In autoconf-archive, AX_CFLAGS_GCC_OPTION was using an
AS_VAR_PUSHDEF'd variable incorrectly, according to the documentation.
And in Autoconf, there was indeed a regression where = was no longer
treated as a literal character to be transliterated into _ at m4 time.
This fixes the autoconf side of the equation, and adds tests to avoid
future regressions.

 ChangeLog           |    9 +++++++++
 NEWS                |    3 +++
 lib/m4sugar/m4sh.m4 |    4 ++--
 tests/m4sh.at       |   36 ++++++++++++++++++++++++++----------
 4 files changed, 40 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 576f615..609846a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-10-08  Eric Blake  <address@hidden>
+
+       AS_LITERAL_IF: Treat raw = as literal again.
+       * lib/m4sugar/m4sh.m4 (_AS_LITERAL_IF): Treat = like +.
+       * tests/m4sh.at (AS@&address@hidden and AS@&address@hidden)
+       (AS@&address@hidden): Expand tests.
+       * NEWS: Document the fix.
+       Reported via Ben Pfaff; originally http://bugs.debian.org/593838
+
 2010-09-24  Joshua G. Hale  <address@hidden>  (tiny change)

        docs: fix typo in AC_CONFIG_FILES example code.
diff --git a/NEWS b/NEWS
index a3a50d6..6b62542 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ GNU Autoconf NEWS - User visible changes.

 * Noteworthy changes in release ?.? (????-??-??) [?]

+** AS_LITERAL_IF again treats '=' as a literal.  Regression introduced in
+   2.66.
+

 * Noteworthy changes in release 2.68 (2010-09-22) [stable]
   Released by Eric Blake, based on git versions 2.67.*.
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index 13ad849..3c9350a 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -1584,8 +1584,8 @@ m4_define([AS_LITERAL_IF],

 m4_define([_AS_LITERAL_IF],
 [m4_if(m4_index([$1], address@hidden|@]), [-1], [$0_(m4_translit([$1],
-  [-:%/@{}[]#(),.$2]]]m4_dquote(m4_dquote(m4_defn([m4_cr_symbols2])))[[,
-  [+++++$$`````]))], [$0_NO])])
+  [-:=%/@{}[]#(),.$2]]]m4_dquote(m4_dquote(m4_defn([m4_cr_symbols2])))[[,
+  [++++++$$`````]))], [$0_NO])])

 m4_define([_AS_LITERAL_IF_],
 [m4_if(m4_translit([$1], [+]), [], [$0YES],
diff --git a/tests/m4sh.at b/tests/m4sh.at
index 08680c3..c01027f 100644
--- a/tests/m4sh.at
+++ b/tests/m4sh.at
@@ -1278,6 +1278,10 @@ echo AS_LITERAL_HEREDOC_IF([(a)], [ok], [ERR]) 20
 echo AS_LITERAL_IF(address@hidden|@a], [ERR], [ok]) 21
 echo AS_LITERAL_WORD_IF(address@hidden|@a], [ERR], [ok]) 22
 echo AS_LITERAL_HEREDOC_IF(address@hidden|@a], [ERR], [ok]) 23
+echo AS_LITERAL_IF([${a+b}], [ERR1], [ok], [ERR2]) 24
+echo AS_LITERAL_IF([${a=b}], [ERR1], [ok], [ERR2]) 25
+echo AS_LITERAL_IF([a+b], [ok], [ERR1], [ERR2]) 26
+echo AS_LITERAL_IF([a=b], [ok], [ERR1], [ERR2]) 27
 ]])

 AT_CHECK_M4SH
@@ -1305,6 +1309,10 @@ ok 20
 ok 21
 ok 22
 ok 23
+ok 24
+ok 25
+ok 26
+ok 27
 ]])

 AT_CLEANUP
@@ -1342,12 +1350,13 @@ echo AS_TR_CPP(`echo abc`) AS_TR_CPP(`echo aBc`) 
AS_TR_CPP(`echo ABC`)
 echo AS_TR_CPP([`echo abc`]) AS_TR_CPP([`echo aBc`]) AS_TR_CPP([`echo ABC`])
 echo AS_TR_CPP([[`echo abc`]]) AS_TR_CPP([[`echo aBc`]]) AS_TR_CPP([[`echo 
ABC`]])
 echo ===
-echo AS_TR_SH([a.b/c+*-])
-echo AS_TR_CPP([a.b/c+*-])
-var=a.b/c+*-
+# start here
+echo AS_TR_SH([a.b/c+*-=])
+echo AS_TR_CPP([a.b/c+*-=])
+var=a.b/c+*-=
 echo AS_TR_SH([$var])
 echo AS_TR_CPP([$var])
-m4_define([macro], [a.b/c+*-])
+m4_define([macro], [a.b/c+*-=])
 echo AS_TR_SH([macro])
 echo AS_TR_CPP([macro])
 ]])
@@ -1375,12 +1384,19 @@ HI ABC HI
 HI ABC HI
 ABC ABC ABC
 ===
-a_b_cpp_
-A_B_C_P_
-a_b_cpp_
-A_B_C_P_
-a_b_cpp_
-A_B_C_P_
+a_b_cpp__
+A_B_C_P__
+a_b_cpp__
+A_B_C_P__
+a_b_cpp__
+A_B_C_P__
+]])
+
+dnl Check that of the last 6 macros, only 2 needed command substitution.
+dnl This test abuses our knowledge of m4sh internals a bit; oh well.
+AT_CHECK([sed -n '/start here/,$ {
+/`.*`/p
+}' script | wc -l], [], [[2
 ]])

 AT_CLEANUP
-- 
1.7.2.3




reply via email to

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