summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2008-03-06 17:17:37 -0700
committerEric Blake <ebb9@byu.net>2008-03-06 17:17:37 -0700
commitff87075d2c0465d5426c8004680b033f13ad893e (patch)
treea1f7882ba8e1cd7119b2225fe3625536a4e27410
parente043e9e76d6953676ed870a6f47be9723363b7cb (diff)
downloadm4-ff87075d2c0465d5426c8004680b033f13ad893e.tar.gz
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 <ebb9@byu.net>
-rw-r--r--ChangeLog9
-rw-r--r--NEWS3
-rw-r--r--doc/m4.texinfo17
-rw-r--r--src/macro.c5
4 files changed, 31 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index e82fcb7e..aa9745ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-03-06 Eric Blake <ebb9@byu.net>
+
+ 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 <ebb9@byu.net>
Make GNUmakefile work with in-place builds.
diff --git a/NEWS b/NEWS
index 42922d1d..7a883830 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 92a8effe..7b249bdf 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -2542,6 +2542,23 @@ builtin(`builtin',)
builtin(`include', `foo')dnl
@result{}bar
@end example
+
+@comment And this example triggers a regression present in 1.4.10b.
+
+@example
+define(`s', `builtin(`shift', $@@)')dnl
+define(`loop', `ifelse(`$2', `', `-', `$1$2: $0(`$1', s(s($@@)))')')dnl
+loop(`1')
+@result{}-
+loop(`1', `2')
+@result{}12: -
+loop(`1', `2', `3')
+@result{}12: 13: -
+loop(`1', `2', `3', `4')
+@result{}12: 13: 14: -
+loop(`1', `2', `3', `4', `5')
+@result{}12: 13: 14: 15: -
+@end example
@end ignore
@node Conditionals
diff --git a/src/macro.c b/src/macro.c
index 0846f8dd..4558e9c3 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)
{