Re: Comments on changesyntax et al.

Eric Blake <[email protected]>
Newsgroups gmane.comp.gnu.m4.patches,gmane.comp.gnu.m4.general
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 2/10/2007 4:22 PM:
> 
> Paul convinced me that for purposes
> of a transition period, only ${<digit> should be recognized as
> the start of an extended argument.  On the other hand, that was
> before we came up with the idea for multi-character extended
> argument delimiters, so maybe I should just reserve ALL ${
> sequences in the default warning of M4 1.4.9's --warn-macro-sequence.

I decided with the flexibility of the regex in --warn-macro-sequence in
1.4.9, and the promised flexibility of changeextarg (yet to be
implemented) in 2.0, that we might as well make the default regex warn
about all uses of ${.  Like so:

2007-02-24  Eric Blake  <[email protected]>

	Reserve all uses of raw ${} in macro definitions, not just
	${<digit>}.
	* 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.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             [email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF4EW784KuGfSFAYARAqM5AKDIbrOMe/7vpINb2VIgZhgoOxbtcQCgkolL
Zvl7z8Y4RLi3Qnx7iQHQZ10=
=S8Iy
-----END PGP SIGNATURE-----

_______________________________________________
M4-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/m4-patches
m4.patch235 (text/plain, 4.2 KB)
Index: NEWS
===================================================================
RCS file: /sources/m4/m4/NEWS,v
retrieving revision 1.1.1.1.2.93
diff -u -p -r1.1.1.1.2.93 NEWS
--- NEWS	8 Feb 2007 14:52:29 -0000	1.1.1.1.2.93
+++ NEWS	24 Feb 2007 14:01:22 -0000
@@ -23,9 +23,9 @@ Version 1.4.9 - ?? ??? 2007, by ????  (C
 * 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
Index: doc/m4.texinfo
===================================================================
RCS file: /sources/m4/m4/doc/m4.texinfo,v
retrieving revision 1.1.1.1.2.114
diff -u -p -r1.1.1.1.2.114 m4.texinfo
--- doc/m4.texinfo	8 Feb 2007 14:52:29 -0000	1.1.1.1.2.114
+++ doc/m4.texinfo	24 Feb 2007 14:01:24 -0000
@@ -590,13 +590,13 @@ match in any macro definition (either by
 @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
Index: src/builtin.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/builtin.c,v
retrieving revision 1.1.1.1.2.57
diff -u -p -r1.1.1.1.2.57 builtin.c
--- src/builtin.c	8 Feb 2007 14:52:29 -0000	1.1.1.1.2.57
+++ src/builtin.c	24 Feb 2007 14:01:24 -0000
@@ -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;
Index: src/m4.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/m4.c,v
retrieving revision 1.1.1.1.2.44
diff -u -p -r1.1.1.1.2.44 m4.c
--- src/m4.c	8 Feb 2007 14:52:29 -0000	1.1.1.1.2.44
+++ src/m4.c	24 Feb 2007 14:01:24 -0000
@@ -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 ("\
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.