]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
m4sugar: fix regression in AC_MSG_ERROR expansion
authorEric Blake <eblake@redhat.com>
Thu, 16 Sep 2010 14:43:27 +0000 (08:43 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 16 Sep 2010 15:07:31 +0000 (09:07 -0600)
AS_ERROR Regression introduced in commit cffdc3947, but the
underlying problem stems from the introduction of m4_defun_init
in commit d0c5f482.

* lib/m4sugar/m4sugar.m4 (m4_defun_init): Avoid macro
concatenation on subsequent expansions
* tests/m4sh.at (AS_WARN and AS_ERROR): New test.
* tests/m4sugar.at (m4@&t@_require: one-shot initialization):
Enhance test.
* NEWS: Document the fix.
* THANKS: Update.
Reported by Adrian Bunk and and Nishio Futoshi.

Signed-off-by: Eric Blake <eblake@redhat.com>
ChangeLog
NEWS
THANKS
lib/m4sugar/m4sugar.m4
tests/m4sh.at
tests/m4sugar.at

index be3c8a046701c905655b634d2ccad8d898a32268..061c6ae073a7ec037484516e0f8978477e4fb026 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-09-16  Eric Blake  <eblake@redhat.com>
+
+       m4sugar: fix regression in AC_MSG_ERROR expansion
+       * lib/m4sugar/m4sugar.m4 (m4_defun_init): Avoid macro
+       concatenation on subsequent expansions
+       * tests/m4sh.at (AS_WARN and AS_ERROR): New test.
+       * tests/m4sugar.at (m4@&t@_require: one-shot initialization):
+       Enhance test.
+       * NEWS: Document the fix.
+       * THANKS: Update.
+       Reported by Adrian Bunk and and Nishio Futoshi.
+
 2010-09-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tests: simplify grepping of 'automake --version'.
diff --git a/NEWS b/NEWS
index 43e36213a3a08d41cf0892972df87c8b86265d00..78851b96693c0de3e9979c6bedbd4105e2e895e5 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ GNU Autoconf NEWS - User visible changes.
 
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
+** AC_MSG_ERROR (and AS_ERROR) can once again be followed immediately by
+   `dnl'.  Regression introduced in 2.66.
+
 ** AT_BANNER() with empty argument will cause visual separation from previous
    test category.
 
diff --git a/THANKS b/THANKS
index 06448bd8249f89ab8d115ded5e04e2924df809eb..cb1589b2f22e33d1958ddc9c14faf66af0700648 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -11,6 +11,7 @@ Aaron Crane                 aaronc@pobox.com
 Aaron M. Ucko               amu@alum.mit.edu
 Aaron W. LaFramboise        aaronenvelope277@aaronwl.com
 Adam J. Richter             adam@yggdrasil.com
+Adrian Bunk                 bunk-gnu@fs.tum.de
 Aharon Robbins              arnold@gnu.org
 Akim Demaille               akim@freefriends.org
 Akinori Musha               knu@iDaemons.org
index 95b7bcf7810956864fef753db43817c90d428c6e..d440127199332c19ec28de207a4978a0d22024f4 100644 (file)
@@ -1973,7 +1973,7 @@ m4_define([m4_defun],
 # m4_defun'd, we can add a parameter, similar to the third parameter
 # to m4_defun.
 m4_define([m4_defun_init],
-[m4_define([$1], [$3])m4_defun([$1],
+[m4_define([$1], [$3[]])m4_defun([$1],
    [$2[]_m4_popdef(]m4_dquote($[0])[)m4_indir(]m4_dquote($[0])dnl
 [m4_if(]m4_dquote($[#])[, [0], [], ]m4_dquote([,$]@)[))], [m4_pushdef])])
 
index e73c971f8751ac67d1a379c648b3e5d8a721bd1e..08680c30e779fbefeca89a2e3afb4e2aa5659ce1 100644 (file)
@@ -18,6 +18,71 @@ AT_BANNER([M4sh.])
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+## ------------------- ##
+## AS_WARN, AS_ERROR.  ##
+## ------------------- ##
+
+AT_SETUP([AS@&t@_WARN and AS@&t@_ERROR])
+AT_KEYWORDS([m4sh])
+
+dnl without logging
+AT_DATA_M4SH([script.as],
+[[AS_INIT
+AS_WARN([*watch out*])dnl
+
+if test x"$die" != x; then
+  AS_ERROR([you're dead])dnl
+
+  AS_ERROR([really])dnl
+
+fi
+echo got here
+]])
+
+AT_CHECK_M4SH
+AT_CHECK([$CONFIG_SHELL ./script], [],
+[[got here
+]], [[script: WARNING: *watch out*
+]])
+AT_CHECK([die=: $CONFIG_SHELL ./script], [1],
+[], [[script: WARNING: *watch out*
+script: error: you're dead
+]])
+
+dnl with logging
+rm script
+AT_DATA_M4SH([script.as],
+[[AS_INIT
+m4_define([gone], [AS_ERROR([really])])
+m4_define([AS_MESSAGE_LOG_FD], [5])
+exec AS_MESSAGE_LOG_FD>log.txt
+AS_WARN([*watch out*])dnl
+
+if test x"$die" != x; then
+  AS_ERROR([you're dead])dnl
+
+  AS_ERROR([really])dnl
+
+fi
+echo got here
+exec AS_MESSAGE_LOG_FD>&-
+]])
+
+AT_CHECK_M4SH
+AT_CHECK([$CONFIG_SHELL ./script], [],
+[[got here
+]], [[script: WARNING: *watch out*
+]])
+AT_CHECK([[grep 'script:[0-9]*: WARNING: \*watch out\*' log.txt]], [], [ignore])
+AT_CHECK([die=: $CONFIG_SHELL ./script], [1],
+[], [[script: WARNING: *watch out*
+script: error: you're dead
+]])
+AT_CHECK([[grep 'script:[0-9]*: WARNING: \*watch out\*' log.txt]], [], [ignore])
+AT_CHECK([[grep 'script:[0-9]*: error: you'\''re dead' log.txt]], [], [ignore])
+
+AT_CLEANUP
+
 ## ---------------- ##
 ## LINENO support.  ##
 ## ---------------- ##
@@ -95,7 +160,6 @@ AT_CHECK([sh ./test/test-2],                       0, [expout])
 AT_CLEANUP
 
 
-
 ## ---------------------- ##
 ## LINENO stack support.  ##
 ## ---------------------- ##
index 50a7b000c7580366d593c92515b467c7457b4eee..900bc3bdd547d874c6dd1a5456e8320b71ffecf5 100644 (file)
@@ -460,13 +460,15 @@ AT_KEYWORDS([m4@&t@_defun_init m4@&t@_copy m4@&t@_defun_once])
 
 dnl check out m4_defun_init, m4_copy, and odd macro names
 AT_CHECK_M4SUGAR_TEXT([[
+m4_define([t], [text])dnl
 m4_defun_init([a], [[init a
-]], [[common a]])dnl
+]], [[common a] t])dnl
 m4_defun([b], [[b]m4_require([a])])dnl
 m4_defun([c], [[c]m4_require([a])])dnl
 b
 c
-a
+a()dnl
+
 m4_defun_init([-], [hello, ], [m4_if([$#], [0], [world], [[$1]])])dnl
 m4_copy([-], [.])dnl
 m4_indir([.])
@@ -474,10 +476,10 @@ m4_indir([.], [goodbye])
 m4_indir([-], [again])
 ]], [[
 init a
-common a
+common a text
 b
 c
-common a
+common a text
 hello, world
 goodbye
 hello, again