m4-patches
[Top][All Lists]
Advanced

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

fix stage17 regression


From: Eric Blake
Subject: fix stage17 regression
Date: Fri, 7 Mar 2008 00:22:05 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

The actual code fix adds a single conditional of when not to expand an argv 
wrapper onto the argument collection stack.  The bulk of this patch is making 
sure we never regress on this tricky corner case again.

From: Eric Blake <address@hidden>
Date: Thu, 6 Mar 2008 17:17:37 -0700
Subject: [PATCH] Fix nested builtin(`shift',$@) regression from 2008-02-22.

* src/macro.c (make_argv_ref_token): Don't output expansion text
when making wrapper for builtin or indir.
* doc/m4.texinfo (Builtin): Test it.
* NEWS: Document the fix.
Reported by Andreas Schwab.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog      |    9 +++++++++
 NEWS           |    3 ++-
 doc/m4.texinfo |   17 +++++++++++++++++
 src/macro.c    |    5 +++--
 4 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e82fcb7..aa9745a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-03-06  Eric Blake  <address@hidden>
+
+       Fix nested builtin(`shift',$@) regression from 2008-02-22.
+       * src/macro.c (make_argv_ref_token): Don't output expansion text
+       when making wrapper for builtin or indir.
+       * doc/m4.texinfo (Builtin): Test it.
+       * NEWS: Document the fix.
+       Reported by Andreas Schwab.
+
 2008-03-04  Eric Blake  <address@hidden>
 
        Make GNUmakefile work with in-place builds.
diff --git a/NEWS b/NEWS
index 42922d1..7a88383 100644
--- a/NEWS
+++ b/NEWS
@@ -5,7 +5,8 @@ Foundation, Inc.
 * Noteworthy changes in Version 1.4.11 (????-??-??) [stable]
   Released by ????, based on git version 1.4.10b.x-*
 
-** No user visible changes, yet.
+** Fix regression introduced in 1.4.10b where using `builtin' or `indir'
+   to perform nested `shift' calls triggered an assertion failure.
 
 * Noteworthy changes in Version 1.4.10b (2008-02-25) [beta]
   Released by Eric Blake, based on git version 1.4.10a
diff --git a/doc/m4.texinfo b/doc/m4.texinfo
index 92a8eff..7b249bd 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -2542,6 +2542,23 @@ builtin(`builtin',)
 builtin(`include', `foo')dnl
 @result{}bar
 @end example
+
address@hidden And this example triggers a regression present in 1.4.10b.
+
address@hidden
+define(`s', `builtin(`shift', $@@)')dnl
+define(`loop', `ifelse(`$2', `', `-', `$1$2: $0(`$1', s(s($@@)))')')dnl
+loop(`1')
address@hidden
+loop(`1', `2')
address@hidden: -
+loop(`1', `2', `3')
address@hidden: 13: -
+loop(`1', `2', `3', `4')
address@hidden: 13: 14: -
+loop(`1', `2', `3', `4', `5')
address@hidden: 13: 14: 15: -
address@hidden example
 @end ignore
 
 @node Conditionals
diff --git a/src/macro.c b/src/macro.c
index 0846f8d..4558e9c 100644
--- a/src/macro.c
+++ b/src/macro.c
@@ -1303,8 +1303,9 @@ make_argv_ref_token (token_data *token, struct obstack 
*obs, int level,
       unsigned int i;
       for (i = 0; i < argv->arraylen; i++)
        {
-         if (TOKEN_DATA_TYPE (argv->array[i]) == TOKEN_COMP
-             && argv->array[i]->u.u_c.wrapper)
+         if ((TOKEN_DATA_TYPE (argv->array[i]) == TOKEN_COMP
+              && argv->array[i]->u.u_c.wrapper)
+             || level >= 0)
            break;
          if (index == 1)
            {
-- 
1.5.4







reply via email to

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