From e1c1a4dc1d6a523c0ef6513f3ba3d287c53a071d Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Sat, 24 Feb 2007 14:02:23 +0000 Subject: [PATCH] Reserve all uses of raw ${} in macro definitions, not just ${}. * src/builtin.c (set_macro_sequence): Change default macro sequence. * doc/m4.texinfo (Operation modes): Update to match. * src/m4.c (usage): Likewise. * NEWS: Likewise. --- ChangeLog | 10 ++++++++++ NEWS | 6 +++--- doc/m4.texinfo | 16 ++++++++-------- src/builtin.c | 2 +- src/m4.c | 2 +- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c4ce664..970e6ad4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-02-24 Eric Blake + + Reserve all uses of raw ${} in macro definitions, not just + ${}. + * src/builtin.c (set_macro_sequence): Change default macro + sequence. + * doc/m4.texinfo (Operation modes): Update to match. + * src/m4.c (usage): Likewise. + * NEWS: Likewise. + 2007-02-23 Eric Blake * src/m4.h (includes): Update to latest gnulib. diff --git a/NEWS b/NEWS index ef99ea17..85f59a88 100644 --- a/NEWS +++ b/NEWS @@ -23,9 +23,9 @@ Version 1.4.9 - ?? ??? 2007, by ???? (CVS version 1.4.8a) * A new `--warn-macro-sequence' command-line option allows detection of sequences in `define' and `pushdef' definitions that match an optional regular expression. The default regular expression is - `\$\({[0-9][^}]*}\|[0-9][0-9]+\)', corresponding to the sequences that - might not behave correctly when upgrading to the eventual M4 2.0. By - default, M4 2.0 will follow the POSIX requirement that a macro definition + `\$\({[^}]*}\|[0-9][0-9]+\)', corresponding to the sequences that might + not behave correctly when upgrading to the eventual M4 2.0. By default, + M4 2.0 will follow the POSIX requirement that a macro definition containing `$11' must expand to the first argument concatenated with 1, rather than the eleventh argument; and will take advantage of the POSIX wording that allows implementations to treat `${11}' as the eleventh diff --git a/doc/m4.texinfo b/doc/m4.texinfo index e5262019..4983adcf 100644 --- a/doc/m4.texinfo +++ b/doc/m4.texinfo @@ -590,13 +590,13 @@ match in any macro definition (either by @code{define} or @code{pushdef}). Empty matches are ignored; therefore, supplying the empty string as @var{REGEXP} disables any warning. If the optional @var{REGEXP} is not supplied, then the default regular expression is -@samp{\$\(@{[0-9][^@}]*@}\|[0-9][0-9]+\)} (a literal @samp{$} followed -by multiple digits or by an open brace and a digit), since these -sequences will change semantics in the default operation of -@acronym{GNU} M4 2.0 (due to a change in how more than 9 arguments in a -macro definition will be handled, @pxref{Arguments}). Providing an -alternate regular expression can provide a useful reverse lookup feature -of finding where a macro is defined to have a given definition. +@samp{\$\(@{[^@}]*@}\|[0-9][0-9]+\)} (a literal @samp{$} followed by +multiple digits or by an open brace), since these sequences will +change semantics in the default operation of @acronym{GNU} M4 2.0 (due +to a change in how more than 9 arguments in a macro definition will be +handled, @pxref{Arguments}). Providing an alternate regular +expression can provide a useful reverse lookup feature of finding +where a macro is defined to have a given definition. @item -W @var{REGEXP} @itemx --word-regexp=@var{REGEXP} @@ -6388,7 +6388,7 @@ the first time. @bye @c Local Variables: -@c coding: ISO-8859-1 +@c coding: iso-8859-1 @c fill-column: 72 @c ispell-local-dictionary: "american" @c indent-tabs-mode: nil diff --git a/src/builtin.c b/src/builtin.c index 2bfb7b8a..e2c2124f 100644 --- a/src/builtin.c +++ b/src/builtin.c @@ -253,7 +253,7 @@ set_macro_sequence (const char *regexp) const char *msg; if (! regexp) - regexp = "\\$\\({[0-9][^}]*}\\|[0-9][0-9]+\\)"; + regexp = "\\$\\({[^}]*}\\|[0-9][0-9]+\\)"; else if (regexp[0] == '\0') { macro_sequence_inuse = false; diff --git a/src/m4.c b/src/m4.c index a4b80e1c..6d5bd1eb 100644 --- a/src/m4.c +++ b/src/m4.c @@ -162,7 +162,7 @@ Operation modes:\n\ -Q, --quiet, --silent suppress some warnings for builtins\n\ --warn-macro-sequence[=REGEXP]\n\ warn if macro definition matches REGEXP,\n\ - default \\$\\({[0-9][^}]*}\\|[0-9]+\\)\n\ + default \\$\\({[^}]*}\\|[0-9][0-9]+\\)\n\ ", stdout); #ifdef ENABLE_CHANGEWORD fputs ("\ -- 2.11.4.GIT