summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2008-03-06 20:56:44 -0700
committerEric Blake <ebb9@byu.net>2008-03-06 20:56:44 -0700
commit2510870d46c28568affaa04f31462cd77fcf36f8 (patch)
tree81dbf85637035f6f7e50541da530559909c3a083
parent9eb0ac9c38938db0de84f77b2d062c55cb7817e3 (diff)
downloadm4-2510870d46c28568affaa04f31462cd77fcf36f8.tar.gz
Fix nested builtin(`shift',$@) regression from 2008-02-23.
* m4/macro.c (make_argv_ref): Don't output expansion text when making wrapper for builtin or indir. * tests/builtins.at (builtin): New test. * 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--m4/macro.c5
-rw-r--r--tests/builtins.at27
4 files changed, 41 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 724e268a..18e28557 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-23.
+ * m4/macro.c (make_argv_ref): Don't output expansion text when
+ making wrapper for builtin or indir.
+ * tests/builtins.at (builtin): New test.
+ * NEWS: Document the fix.
+ Reported by Andreas Schwab.
+
2008-03-04 Eric Blake <ebb9@byu.net>
The gnulib module free was deprecated.
diff --git a/NEWS b/NEWS
index a0cbeb93..74fb22e3 100644
--- a/NEWS
+++ b/NEWS
@@ -210,7 +210,8 @@ promoted to 2.0.
* 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/m4/macro.c b/m4/macro.c
index 743d3266..ad233899 100644
--- a/m4/macro.c
+++ b/m4/macro.c
@@ -1094,8 +1094,9 @@ make_argv_ref (m4 *context, m4_symbol_value *value, m4_obstack *obs,
size_t i;
for (i = 0; i < argv->arraylen; i++)
{
- if (argv->array[i]->type == M4_SYMBOL_COMP
- && argv->array[i]->u.u_c.wrapper)
+ if ((argv->array[i]->type == M4_SYMBOL_COMP
+ && argv->array[i]->u.u_c.wrapper)
+ || level < SIZE_MAX)
break;
if (index == 1)
{
diff --git a/tests/builtins.at b/tests/builtins.at
index 68d151cd..08c881be 100644
--- a/tests/builtins.at
+++ b/tests/builtins.at
@@ -88,6 +88,33 @@ AT_CHECK_M4([in], [0], [expout])
AT_CLEANUP
+## ------- ##
+## builtin ##
+## ------- ##
+
+AT_SETUP([builtin])
+
+dnl This was a regression in 1.4.10b.
+AT_DATA([in.m4],
+[[define(`s', `builtin(`shift', $@)')dnl
+define(`loop', `ifelse(`$2', `', `-', `$1$2: $0(`$1', s(s($@)))')')dnl
+loop(`1')
+loop(`1', `2')
+loop(`1', `2', `3')
+loop(`1', `2', `3', `4')
+loop(`1', `2', `3', `4', `5')
+]])
+AT_CHECK_M4([in.m4], [0],
+[[-
+12: -
+12: 13: -
+12: 13: 14: -
+12: 13: 14: 15: -
+]])
+
+AT_CLEANUP
+
+
## ----------- ##
## changequote ##
## ----------- ##