[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Changes to m4/doc/m4.texinfo,v [branch-1_4]
From: |
Eric Blake |
Subject: |
Changes to m4/doc/m4.texinfo,v [branch-1_4] |
Date: |
Sun, 28 Jan 2007 01:54:59 +0000 |
CVSROOT: /sources/m4
Module name: m4
Branch: branch-1_4
Changes by: Eric Blake <ericb> 07/01/28 01:54:44
Index: doc/m4.texinfo
===================================================================
RCS file: /sources/m4/m4/doc/m4.texinfo,v
retrieving revision 1.1.1.1.2.108
retrieving revision 1.1.1.1.2.109
diff -u -b -r1.1.1.1.2.108 -r1.1.1.1.2.109
--- doc/m4.texinfo 15 Jan 2007 13:51:33 -0000 1.1.1.1.2.108
+++ doc/m4.texinfo 28 Jan 2007 01:54:43 -0000 1.1.1.1.2.109
@@ -577,6 +577,13 @@
Suppress warnings, such as missing or superfluous arguments in macro
calls, or treating the empty string as zero.
address@hidden --warn-syntax
+Issue warnings when syntax is encountered that will change semantics in
address@hidden M4 2.0. For now, the only semantics that will change have
+to do with how more than 9 arguments in a macro definition are handled
+(@pxref{Arguments}). This warning is disabled by default because it
+triggers spurious failures in @acronym{GNU} Autoconf 2.61.
+
@item -W @var{REGEXP}
@itemx address@hidden
Use @var{REGEXP} as an alternative syntax for macro names. This
@@ -1354,8 +1361,8 @@
not have to be a simple word.
It can be any text string, even the empty string. A macro with a
non-standard name cannot be invoked in the normal way, as the name is
-not recognized. It can only be referenced by the builtins @code{Indir}
-(@pxref{Indir}) and @code{Defn} (@pxref{Defn}).
+not recognized. It can only be referenced by the builtins @code{indir}
+(@pxref{Indir}) and @code{defn} (@pxref{Defn}).
@cindex arrays
Arrays and associative arrays can be simulated by using this trick.
@@ -1375,7 +1382,7 @@
@result{}array element no. 17
@end example
-Change the @code{%d} to @code{%s} and it is an associative array.
+Change the @samp{%d} to @samp{%s} and it is an associative array.
@node Arguments
@section Arguments to macros
@@ -1412,13 +1419,6 @@
(You should try and improve this example so that clients of @code{exch}
do not have to double quote; or @pxref{Improved exch, , Answers}).
address@hidden @acronym{GNU} extensions
address@hidden @code{m4} allows the number following the @samp{$} to
-consist of one
-or more digits, allowing macros to have any number of arguments. This
-is not so in UNIX implementations of @code{m4}, which only recognize
-one digit.
-
As a special case, the zeroth argument, @code{$0}, is always the name
of the macro being expanded.
@@ -1443,6 +1443,51 @@
The @samp{foo} in the expansion text is @emph{not} expanded, since it is
a quoted string, and not a name.
address@hidden @acronym{GNU} extensions
address@hidden nine arguments, more than
address@hidden more than nine arguments
address@hidden arguments, more than nine
address@hidden positional parameters, more than nine
address@hidden @code{m4} allows the number following the @samp{$} to
+consist of one or more digits, allowing macros to have any number of
+arguments. The extension of accepting multiple digits is incompatible
+with @acronym{POSIX}, and is different than traditional implementations
+of @code{m4}, which only recognize one digit. Therefore, future
+versions of @acronym{GNU} M4 will phase out this feature.
address@hidden, for an example of how to portably access the eleventh
+argument.
+
address@hidden also states that @samp{$} followed immediately by
address@hidden@{} in a macro definition is implementation-defined. This version
+of M4 passes the literal characters @address@hidden through unchanged, but M4
+2.0 will implement an optional feature similar to @command{sh}, where
address@hidden@address@hidden expands to the eleventh argument, to replace the
current
+recognition of @samp{$11}. Meanwhile, if you want to guarantee that you
+will get a literal @address@hidden in output when expanding a macro, even
+when you upgrade to M4 2.0, you can use nested quoting to your
+advantage:
+
address@hidden
+define(`foo', `single quoted $`'@address@hidden output')
address@hidden
+define(`bar', ``double quoted $'address@hidden@} output'')
address@hidden
+foo(`a', `b')
address@hidden quoted address@hidden@} output
+bar(`a', `b')
address@hidden quoted address@hidden@} output
address@hidden example
+
+To help you detect places in your M4 input files that might change in
+behavior due to the changed behavior of M4 2.0, you can use the
address@hidden command-line option (@pxref{Operation modes, ,
+Invoking m4}). This will add a warning any time a macro definition
+includes @samp{$} followed by multiple digits, or by @address@hidden and a
+digit. The warning is not enabled by default, because it triggers a
+number of warnings in Autoconf 2.61 (and Autoconf uses @option{-E} to
+treat warnings as errors), and because it will still be possible to
+restore traditional behavior in M4 2.0.
+
@node Pseudo Arguments
@section Special arguments to macros
@@ -2588,7 +2633,7 @@
@result{}blah
@end example
-Tracing even works on builtins. However, @command{defn} (@pxref{Defn})
+Tracing even works on builtins. However, @code{defn} (@pxref{Defn})
does not transfer tracing status.
@example
@@ -4721,10 +4766,10 @@
commands from within @code{m4}.
Note that the definition of a valid shell command is system dependent.
-On UNIX systems, this is the typical @code{/bin/sh}. But on other
+On UNIX systems, this is the typical @command{/bin/sh}. But on other
systems, such as native Windows, the shell has a different syntax of
commands that it understands. Some examples in this chapter assume
address@hidden/bin/sh}, and also demonstrate how to quit early with a known
address@hidden/bin/sh}, and also demonstrate how to quit early with a known
exit value if this is not the case.
@menu
@@ -4934,7 +4979,7 @@
@result{}0
@end example
address@hidden results in 127 if there was a problem executing the
address@hidden results in 127 if there was a problem executing the
command, for example, if the system-imposed argument length is exceeded,
or if there were not enough resources to fork. It is not possible to
distinguish between failed execution and successful execution that had
@@ -5262,8 +5307,8 @@
user's input file, or else each input file uses @code{include}.
Reading the common base of a big application, over and over again, may
-be time consuming. @acronym{GNU} @code{m4} offers some machinery to speed up
-the start of an application using lengthy common bases.
+be time consuming. @acronym{GNU} @code{m4} offers some machinery to
+speed up the start of an application using lengthy common bases.
@menu
* Using frozen files:: Using frozen files
@@ -5311,7 +5356,7 @@
option, only reads and executes file @file{base.m4}, defining
various application macros and computing other initializations.
Once the input file @file{base.m4} has been completely processed, @acronym{GNU}
address@hidden produces on @file{base.m4f} a @dfn{frozen} file, that is, a
address@hidden produces in @file{base.m4f} a @dfn{frozen} file, that is, a
file which contains a kind of snapshot of the @code{m4} internal state.
Later calls, containing the @option{-R} option, are able to reload
@@ -5466,7 +5511,7 @@
@itemize @bullet
@item
-In the @address@hidden notation for macro arguments, @var{n} can contain
+In the @address@hidden notation for macro arguments, @var{n} can contain
several digits, while the System V @code{m4} only accepts one digit.
This allows macros in @acronym{GNU} @code{m4} to take any number of
arguments, and not only nine (@pxref{Arguments}).
@@ -5623,10 +5668,11 @@
@end example
@item
address@hidden requires that all builtins that require arguments, but
-are called without arguments, behave as though empty strings had been
-passed. For example, @code{a`'define`'b} would expand to @code{ab}.
-But @acronym{GNU} @code{m4} ignores certain builtins if they have missing
address@hidden states that builtins that require arguments, but are
+called without arguments, have undefined behavior. Traditional
+implementations simply behave as though empty strings had been passed.
+For example, @code{a`'define`'b} would expand to @code{ab}. But
address@hidden @code{m4} ignores certain builtins if they have missing
arguments, giving @code{adefineb} for the above example.
@item