diff options
author | Eric Blake <ebb9@byu.net> | 2008-07-30 11:23:21 -0600 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2008-07-30 11:23:21 -0600 |
commit | 0db7c1504d4bec63381e1bd6385d8a8ded8f309b (patch) | |
tree | 7263ba7c63d24959bee536ace13273e53bb81dec | |
parent | 10c8443af9ee9497b9bb896cfd0475208aefe9fc (diff) | |
download | m4-0db7c1504d4bec63381e1bd6385d8a8ded8f309b.tar.gz |
Fix regression in trace output, introduced 2008-05-08.
* m4/input.c (m4__push_symbol): When cloning chains, break pointer
back to original chain; latent bug from 2008-02-02 that did not
cause misbehavior until trace output read unfinished chain.
* tests/builtins.at (debug): Add test for this.
Signed-off-by: Eric Blake <ebb9@byu.net>
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | m4/input.c | 1 | ||||
-rw-r--r-- | tests/builtins.at | 13 |
3 files changed, 22 insertions, 0 deletions
@@ -1,3 +1,11 @@ +2008-07-30 Eric Blake <ebb9@byu.net> + + Fix regression in trace output, introduced 2008-05-08. + * m4/input.c (m4__push_symbol): When cloning chains, break pointer + back to original chain; latent bug from 2008-02-02 that did not + cause misbehavior until trace output read unfinished chain. + * tests/builtins.at (debug): Add test for this. + 2008-07-28 Eric Blake <ebb9@byu.net> Optimize iteration examples. @@ -592,6 +592,7 @@ m4__push_symbol (m4 *context, m4_symbol_value *value, size_t level, bool inuse) destructively modifies the chain it is parsing. */ chain = (m4__symbol_chain *) obstack_copy (current_input, src_chain, sizeof *chain); + chain->next = NULL; if (chain->type == M4__CHAIN_STR && chain->u.u_s.level == SIZE_MAX) { if (chain->u.u_s.len <= INPUT_INLINE_THRESHOLD || !inuse) diff --git a/tests/builtins.at b/tests/builtins.at index 198a25db..fe7b0ca9 100644 --- a/tests/builtins.at +++ b/tests/builtins.at @@ -174,6 +174,19 @@ m4trace: -1- countdown(`0') -> `0 ifelse(eval(0 > 0), 1, `countdown(decr(0))', ` AT_CHECK_M4([debug.m4], 0, expout, experr) +dnl Test a regression introduced 2008-05-08, fixed 2008-07-30. +AT_DATA([debug.m4], [[debugmode(`e')traceon(`ifelse')dnl +define(`e', `ifelse(`$1', `$2', `ifelse(`$1', `$2', `e(shift($@))')', `$2')') +e(`1', `1', `a') +]]) + +AT_CHECK_M4([debug.m4], [0], [[ +a +]], [[m4trace: -1- ifelse -> ifelse(`1', `1', `e(shift(`1',`1',`a'))') +m4trace: -1- ifelse -> e(shift(`1',`1',`a')) +m4trace: -1- ifelse -> a +]]) + AT_CLEANUP |