CVSROOT:        /sources/m4
Module name:    m4
Changes by:     Eric Blake <ericb>      06/10/24 03:46:41

Index: doc/m4.texinfo
===================================================================
RCS file: /sources/m4/m4/doc/m4.texinfo,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -b -r1.71 -r1.72
--- doc/m4.texinfo      21 Oct 2006 22:15:52 -0000      1.71
+++ doc/m4.texinfo      24 Oct 2006 03:46:41 -0000      1.72
@@ -1318,9 +1318,32 @@
 collected before the macro is called.  If too few arguments are
 supplied, the missing arguments are taken to be the empty string.
 However, some builtins are documented to behave differently for a
-missing optional argument than for an explicit empty string.  If
-there are too many arguments, the excess arguments are ignored.
-Unquoted leading whitespace is stripped off all arguments.
+missing optional argument than for an explicit empty string.  If there
+are too many arguments, the excess arguments are ignored.  Unquoted
+leading whitespace is stripped off all arguments, but whitespace
+generated by a macro expansion or occuring after a macro that expanded
+to an empty string remains intact.  Whitespace includes space, tab,
+newline, carriage return, vertical tab, and formfeed.
+
[EMAIL PROTECTED]
+define(`macro', `$1')
[EMAIL PROTECTED]
+macro( unquoted leading space lost)
[EMAIL PROTECTED] leading space lost
+macro(` quoted leading space kept')
[EMAIL PROTECTED] quoted leading space kept
+macro(
+ divert `unquoted space kept after expansion')
[EMAIL PROTECTED] unquoted space kept after expansion
+macro(macro(`
+')`whitespace from expansion kept')
[EMAIL PROTECTED]
[EMAIL PROTECTED] from expansion kept
+macro(`unquoted trailing whitespace kept'
+)
[EMAIL PROTECTED] trailing whitespace kept
[EMAIL PROTECTED]
[EMAIL PROTECTED] example
 
 Normally @code{m4} will issue warnings if a builtin macro is called
 with an inappropriate number of arguments, but it can be suppressed with
@@ -1364,7 +1387,7 @@
 @noindent
 is a macro call with four arguments, which are @samp{a }, @samp{b},
 @samp{c} and @samp{d}.  To understand why the first argument contains
-whitespace, remember that leading unquoted whitespace is never part
+whitespace, remember that unquoted leading whitespace is never part
 of an argument, but trailing whitespace always is.
 
 It is possible for a macro's definition to change during argument
@@ -1397,7 +1420,7 @@
 @cindex quoted macro arguments
 @cindex macros, quoted arguments to
 @cindex arguments, quoted macro
-Each argument has leading unquoted whitespace removed.  Within each
+Each argument has unquoted leading whitespace removed.  Within each
 argument, all unquoted parentheses must match.  For example, if
 @var{foo} is a macro,
 
@@ -6030,6 +6053,14 @@
 @code{popdef(@var{macro})pushdef(@var{macro})}.
 
 @item
[EMAIL PROTECTED] states that only unquoted leading newlines and blanks
+(that is, space and tab) are ignored when collecting macro arguments.
+However, this appears to be a bug in @acronym{POSIX}, since most
+traditional implementations also ignore all whitespace (formfeed,
+carriage return, and vertical tab).  @acronym{GNU} @code{m4} follows
+tradition and ignores all leading unquoted whitespace.
+
[EMAIL PROTECTED]
 @findex __gnu__
 GNU @code{m4} without @samp{-G} option will define the macro
 @[EMAIL PROTECTED] to expand to the empty string.


Reply via email to