minor cleanups

Eric Blake <[email protected]>
Newsgroups gmane.comp.gnu.m4.patches
Message-ID <[email protected]>
Three patches for branch-1.4.  One borrowed shamelessly from coreutils [1].  
The next I noticed the first from one of Tom Christensen's logs in response to 
testing 1.4.11 snapshots (doesn't affect branch-1.6).  Finally, doc cleanups 
noticed from comparing the manual with branch-1.6.

[1] http://lists.gnu.org/archive/html/bug-coreutils/2008-08/msg00060.html

From 4e263cf79a9785c62831de04cb951b47698daae5 Mon Sep 17 00:00:00 2001
From: Eric Blake <[email protected]>
Date: Fri, 15 Aug 2008 16:40:52 -0600
Subject: [PATCH] Improve 'git diff' of manual source.

* .gitattributes (*.texi*): Add diff attribute.
* bootstrap: Tell git how to use it.
Inspired by Jim Meyering's similar patch for coreutils.

Signed-off-by: Eric Blake <[email protected]>
---
 .gitattributes |    3 +++
 ChangeLog      |    7 +++++++
 bootstrap      |    8 +++++++-
 3 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/.gitattributes b/.gitattributes
index e8495d5..68d2d12 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1 +1,4 @@
+# See ./bootstrap for some helpful ~/.gitconfig or .git/config settings
+# needed for using these attributes effectively.
 ChangeLog merge=merge-changelog
+*.texi* diff=texinfo
diff --git a/ChangeLog b/ChangeLog
index 431d637..7ca8027 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2008-08-15  Eric Blake  <[email protected]>
+
+	Improve 'git diff' of manual source.
+	* .gitattributes (*.texi*): Add diff attribute.
+	* bootstrap: Tell git how to use it.
+	Inspired by Jim Meyering's similar patch for coreutils.
+
 2008-08-11  Eric Blake  <[email protected]>
 
 	Avoid triggering OS/2 bug in testsuite.
diff --git a/bootstrap b/bootstrap
index 064e23f..4816972 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# bootstrap (GNU M4) version 2008-03-25
+# bootstrap (GNU M4) version 2008-08-15
 # Written by Gary V. Vaughan  <[email protected]>
 
 # Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation,
@@ -242,6 +242,12 @@ if test -d .git && (git --version) >/dev/null 
2>/dev/null ; then
   else
     func_echo "consider installing git-merge-changelog from gnulib"
   fi
+  if git config diff.texinfo.funcname >/dev/null ; then
+    :
+  else
+    func_echo "initializing git texinfo diff driver"
+    git config diff.texinfo.funcname '^@node[ \t][ \t]*\\([^,][^,]*\\)'
+  fi
 fi
 
 ## ---------------------------- ##
-- 
1.5.6.4


From 949dc46078ba05c58a73b16bb2cca7b4a014c796 Mon Sep 17 00:00:00 2001
From: Eric Blake <[email protected]>
Date: Fri, 15 Aug 2008 15:35:32 -0600
Subject: [PATCH] Avoid compiler warning.

* src/builtin.c (m4_ifelse): Avoid unused variable.
* THANKS: Update.
Reported by Tom G. Christensen.

Signed-off-by: Eric Blake <[email protected]>
---
 ChangeLog     |    5 +++++
 THANKS        |    1 +
 src/builtin.c |    7 +++----
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7ca8027..cc92fcf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2008-08-15  Eric Blake  <[email protected]>
 
+	Avoid compiler warning.
+	* src/builtin.c (m4_ifelse): Avoid unused variable.
+	* THANKS: Update.
+	Reported by Tom G. Christensen.
+
 	Improve 'git diff' of manual source.
 	* .gitattributes (*.texi*): Add diff attribute.
 	* bootstrap: Tell git how to use it.
diff --git a/THANKS b/THANKS
index 6a048b9..45cad18 100644
--- a/THANKS
+++ b/THANKS
diff --git a/src/builtin.c b/src/builtin.c
index c38ed5f..450b725 100644
--- a/src/builtin.c
+++ b/src/builtin.c
@@ -646,18 +646,17 @@ static void
 m4_ifelse (struct obstack *obs, int argc, token_data **argv)
 {
   const char *result;
-  token_data *argv0;
+  token_data *me = argv[0];
 
   if (argc == 2)
     return;
 
-  if (bad_argc (argv[0], argc, 4, -1))
+  if (bad_argc (me, argc, 4, -1))
     return;
   else
     /* Diagnose excess arguments if 5, 8, 11, etc., actual arguments.  */
-    bad_argc (argv[0], (argc + 2) % 3, -1, 1);
+    bad_argc (me, (argc + 2) % 3, -1, 1);
 
-  argv0 = argv[0];
   argv++;
   argc--;
 
-- 
1.5.6.4


From e100e4e2146fe6baa1d10c7fa2321987fa2bf9c5 Mon Sep 17 00:00:00 2001
From: Eric Blake <[email protected]>
Date: Fri, 15 Aug 2008 16:24:01 -0600
Subject: [PATCH] Documentation updates.

* doc/m4.texinfo (History): Mention 1.4.12.
(Builtin): Enhance regression tests.
(Debug Levels): Mention effect of -l.  Enhance regression tests.
(Incompatibilities): Fix typo, and mention trace output.
(Improved capitalize): Simplify example.

Signed-off-by: Eric Blake <[email protected]>
---
 ChangeLog      |    7 +++++
 doc/m4.texinfo |   68 ++++++++++++++++++++++++++++++++++++++++++-------------
 2 files changed, 59 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index cc92fcf..758e610 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2008-08-15  Eric Blake  <[email protected]>
 
+	Documentation updates.
+	* doc/m4.texinfo (History): Mention 1.4.12.
+	(Builtin): Enhance regression tests.
+	(Debug Levels): Mention effect of -l.  Enhance regression tests.
+	(Incompatibilities): Fix typo, and mention trace output.
+	(Improved capitalize): Simplify example.
+
 	Avoid compiler warning.
 	* src/builtin.c (m4_ifelse): Avoid unused variable.
 	* THANKS: Update.
diff --git a/doc/m4.texinfo b/doc/m4.texinfo
index 1166ff8..d232c36 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -392,9 +392,9 @@ History
 2005, Gary V. Vaughan collected together the many patches to
 @acronym{GNU} @code{m4} 1.4 that were floating around the net and
 released 1.4.3 and 1.4.4.  And in 2006, Eric Blake joined the team and
-prepared patches for the release of 1.4.5, 1.4.6, 1.4.7, and 1.4.8.  The
-1.4.x series remains open for bug fixes, including releases 1.4.9,
-1.4.10, and 1.4.11 in 2007.
+prepared patches for the release of 1.4.5, 1.4.6, 1.4.7, and 1.4.8.
+More bug fixes were incorporated in 2007, with releases 1.4.9 and
+1.4.10, closing the series with 1.4.11 and 1.4.12 in 2008.
 
 Meanwhile, development has continued on new features for @code{m4}, such
 as dynamic module loading and additional builtins.  When complete,
@@ -2530,6 +2530,14 @@ Builtin
 builtin(`builtin',)
 @error{}m4:stdin:4: undefined builtin `'
 @result{}
+builtin(`builtin', ``'
+')
+@error{}m4:stdin:5: undefined builtin ``'
+@error{}'
+@result{}
+indir(`index')
+@error{}m4:stdin:7: Warning: too few arguments to builtin `index'
+@result{}
 @end example
 
 @ignore
@@ -3598,7 +3606,8 @@ Trace
 @end example
 
 @xref{Debug Levels}, for information on controlling the details of the
-display.
+display.  The format of the trace output is not specified by
+@acronym{POSIX}, and varies between implementations of @code{m4}.
 
 @ignore
 @comment not worth including in the manual, but this tests a trace code
@@ -3639,7 +3648,8 @@ Debug Levels
 In trace output, show the actual arguments that were collected before
 invoking the macro.  This applies to all macro calls if the @samp{t}
 flag is used, otherwise only the macros covered by calls of
-@code{traceon}.
+@code{traceon}.  Arguments are subject to length truncation specified by
+the command line option @option{--arglength} (or @option{-l}).
 
 @item c
 In trace output, show several trace lines for each macro call.  A line
@@ -3650,7 +3660,9 @@ Debug Levels
 @item e
 In trace output, show the expansion of each macro call, if it is not
 void.  This applies to all macro calls if the @samp{t} flag is used,
-otherwise only the macros covered by calls of @code{traceon}.
+otherwise only the macros covered by calls of @code{traceon}.  The
+expansion is subject to length truncation specified by the command line
+option @option{--arglength} (or @option{-l}).
 
 @item f
 In debug and trace output, include the name of the current input file in
@@ -4124,6 +4136,13 @@ Changequote
 @error{}m4:stdin:2: ERROR: end of file in string
 @end example
 
+@comment status: 1
+@example
+ifelse(`dangling quote
+^D
+@error{}m4:stdin:1: ERROR: end of file in string
+@end example
+
 @node Changecom
 @section Changing the comment delimiters
 
@@ -6753,6 +6772,22 @@ Using frozen files
 
 @c Make sure freezing is successful.
 
+@example
+ifdef(`__unix__', ,
+      `errprint(` skipping: syscmd does not have unix semantics
+')m4exit(`77')')dnl
+changequote(`[', `]')dnl
+syscmd([echo 'changequote([,])pushdef([divnum],[hi])dnl' \
+       | ]__program__[ -F in.m4f \
+     && echo 'divnum popdef([divnum])divnum' \
+       | ]__program__[ -R in.m4f \
+     && rm in.m4f])status sysval
+@result{}hi 0
+@result{}status 0
+@end example
+
+@c Detect inability to freeze.
+
 @comment options: -F /none/such
 @comment status: 1
 @example
@@ -7015,7 +7050,7 @@ Incompatibilities
 @acronym{POSIX} requires @code{m4wrap} (@pxref{M4wrap}) to act in FIFO
 (first-in, first-out) order, but @acronym{GNU} @code{m4} currently uses
 LIFO order.  Furthermore, @acronym{POSIX} states that only the first
-argument to @code{m4wrap} is saved for later evaluation, bug
+argument to @code{m4wrap} is saved for later evaluation, but
 @acronym{GNU} @code{m4} saves and processes all arguments, with output
 separated by spaces.
 
@@ -7100,6 +7135,13 @@ Incompatibilities
 the command line or @code{traceon(`foo')} in the input, is an attribute
 that is preserved even if the macro is currently undefined.
 
+Additionally, while @acronym{POSIX} requires trace output, it makes no
+demands on the formatting of that output.  Parsing trace output is not
+guaranteed to be reliable, even between different releases of
+@acronym{GNU} M4; however, the intent is that any future changes in
+trace output will only occur under the direction of additional
+@code{debugmode} flags (@pxref{Debug Levels}).
+
 @item
 @acronym{POSIX} requires @code{eval} (@pxref{Eval}) to treat all
 operators with the same precedence as C@.  However, earlier versions of
@@ -7279,7 +7321,7 @@ Improved forloop
 
 @comment examples
 @example
-$ @kbd{m4 -I examples}
+$ @kbd{m4 -d -I examples}
 undivert(`forloop2.m4')dnl
 @result{}divert(`-1')
 @result{}# forloop(var, from, to, stmt) - improved version:
@@ -7960,14 +8002,8 @@ Improved capitalize
 define(`Active', `Act2, Ive')dnl
 define(`ACTIVE', `ACT3, IVE')dnl
 define(`A', `OOPS')dnl
-capitalize(active)
-@result{}Act1,Ive
-capitalize(`active')
-@result{}Act2, Ive
-capitalize(``active'')
-@result{}Active
-capitalize(```actIVE''')
-@result{}`Active'
+capitalize(active; `active'; ``active''; ```actIVE''')
+@result{}Act1,Ive; Act2, Ive; Active; `Active'
 undivert(`capitalize2.m4')dnl
 @result{}divert(`-1')
 @result{}# upcase(text)
-- 
1.5.6.4
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.