m4-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: argv_ref patch 21: push builtin tokens through $@ and m4wrap


From: Eric Blake
Subject: Re: argv_ref patch 21: push builtin tokens through $@ and m4wrap
Date: Fri, 25 Apr 2008 02:32:15 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Eric Blake <ebb9 <at> byu.net> writes:

> The first provides about 1.5% speedup in
> execution, by adding a sentinel at the end of the input stack to reduce
> the number of branches encountered when deciding, for each input token,
> whether end of input had been reached yet.

And caused a regression in branch-1.6 (fortunately, not in any released 
version).  What's sad is that the master branch testsuite caught this 
regression, and I patched it there, but forgot to backport it to the branch 
until now.

Pre-patch:
$ echo dnl | m4 -di
m4debug: input read from stdin
m4debug: input reverted to , line 0

Pre-regression, and post-patch:
$ echo dnl | build/src/m4 -di
m4debug: input read from stdin
m4debug: input exhausted

While fixing it, I also noticed that some examples in the 1.4.11 manual, when 
executed from the command line, do not give the same results as what the manual 
claims they  will.


>From f87a1e3fe98dd9bf9c746f24a0e8d18958c693e3 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Thu, 24 Apr 2008 16:27:16 -0600
Subject: [PATCH] Fix debugmode regression from 2008-04-14.

* src/input.c (pop_input): Fix -di output on end of input.
* doc/m4.texinfo (Debug Levels): Test this behavior.
(Changeword, Location): Correct examples.
* checks/check-them (examples): Update to account for recommended
location for running tests.
* doc/m4.texinfo (Debug Levels): Test this behavior.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog         |    8 ++++++++
 checks/check-them |    6 +++---
 doc/m4.texinfo    |   21 +++++++++++++++++++--
 src/input.c       |    2 +-
 4 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d40af2c..1454e02 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2008-04-24  Eric Blake  <address@hidden>
 
+       Fix debugmode regression from 2008-04-14.
+       * src/input.c (pop_input): Fix -di output on end of input.
+       * doc/m4.texinfo (Debug Levels): Test this behavior.
+       (Changeword, Location): Correct examples.
+       * checks/check-them (examples): Update to account for recommended
+       location for running tests.
+       * doc/m4.texinfo (Debug Levels): Test this behavior.
+
        Fix debugmode regression from 2008-02-18.
        * src/m4.h (DEBUG_TRACE_VERBOSE): Make -dV verbose again.
        * NEWS: Document this fix.
diff --git a/checks/check-them b/checks/check-them
index 0a697f5..7fba1d6 100755
--- a/checks/check-them
+++ b/checks/check-them
@@ -92,7 +92,7 @@ do
 
   xoutfile=`sed -n 's/^dnl @ expected output: //p' "$file"`
   if test -z "$xoutfile" ; then
-    sed -e '/^dnl @result{}/!d' -e 's///' -e "s|\.\./examples|$examples|" \
+    sed -e '/^dnl @result{}/!d' -e 's///' -e "s|examples/|$examples/|" \
       "$file" > $xout
   else
     cp "$examples/$xoutfile" $xout
@@ -101,10 +101,10 @@ do
   xerrfile=`sed -n 's/^dnl @ expected error: //p' "$file"`
   if test -z "$xerrfile" ; then
     sed '/^dnl @error{}/!d
-         s///; '"s|^m4:|$m4name:|; s|\.\./examples|$examples|" \
+        s///; '"s|^m4:|$m4name:|; s|examples/|$examples/|" \
       "$file" > $xerr
   else
-    sed "s|^m4:|$m4name:|; s|\.\./examples|$examples|" \
+    sed "s|^m4:|$m4name:|; s|examples/|$examples/|" \
       "$examples/$xerrfile" > $xerr
   fi
 
diff --git a/doc/m4.texinfo b/doc/m4.texinfo
index 05b349f..0da6b00 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -3808,6 +3808,23 @@ indir(`echo', defn(`changequote'))
 @result{}
 @end example
 
+This example shows the effects of the debug flags that are not related
+to macro tracing.
+
address@hidden examples
address@hidden options: -dip
address@hidden
+$ @kbd{m4 -dip -I examples}
address@hidden: input read from stdin
+include(`foo')dnl
address@hidden: path search for `foo' found `examples/foo'
address@hidden: input read from examples/foo
address@hidden
address@hidden: input reverted to stdin, line 1
+^D
address@hidden: input exhausted
address@hidden example
+
 @node Debug Output
 @section Saving debugging output
 
@@ -4475,7 +4492,7 @@ define(`bar
 ', defn(`__file__'))
 @result{}
 include(`foo')
address@hidden/examples/foo
address@hidden/foo
 define(`bar
 ', defn(`__line__'))
 @result{}
@@ -6616,7 +6633,7 @@ foo
 @result{}foo called at stdin:2
 include(`incl.m4')
 @result{}Include file start
address@hidden called at ../examples/incl.m4:2
address@hidden called at examples/incl.m4:2
 @result{}Include file end
 @result{}
 @end example
diff --git a/src/input.c b/src/input.c
index e7c819c..aacab61 100644
--- a/src/input.c
+++ b/src/input.c
@@ -657,7 +657,7 @@ pop_input (bool cleanup)
        return false;
       if (debug_level & DEBUG_TRACE_INPUT)
        {
-         if (tmp)
+         if (tmp != &input_eof)
            DEBUG_MESSAGE2 ("input reverted to %s, line %d",
                            tmp->file, tmp->line);
          else
-- 
1.5.5.1








reply via email to

[Prev in Thread] Current Thread [Next in Thread]