Re: branch-1_4 off-by-one in line reporting

Eric Blake <[email protected]>
Newsgroups gmane.comp.gnu.m4.patches
Message-ID <[email protected]>
Eric Blake <ebb9 <at> byu.net> writes:

> 
> Eric Blake <ebb9 <at> byu.net> writes:
> 
> > 
> > Oops - for every line except line 1, if an unterminated quote or comment 
> began 
> > immediately after \n, the error message is off by one.
> 
> And that introduced a regression:
> 
> $ printf 'dnl ignored' > foo
> $ m4
> include(foo) still ignored
> __file__
> foo

Still not quite right.  There is a difference between a macro that supplies the 
include and a newline, vs. calling include directly with the newline coming 
from the input file.

2006-10-12  Eric Blake  <[email protected]>

	* doc/m4.texinfo (Location): Fix typo in previous commit.
	(Changeword): Catch one more case.
	* src/input.c (skip_line): Fix case when outer file used macro to
	supply the \n.

Index: doc/m4.texinfo
===================================================================
RCS file: /sources/m4/m4/doc/m4.texinfo,v
retrieving revision 1.1.1.1.2.82
diff -u -r1.1.1.1.2.82 m4.texinfo
--- doc/m4.texinfo	11 Oct 2006 23:34:21 -0000	1.1.1.1.2.82
+++ doc/m4.texinfo	12 Oct 2006 14:03:55 -0000
@@ -2897,14 +2897,20 @@
 ')m4exit(`77')')dnl
 define(`bar
 ', defn(`dnl'))dnl
+define(`baz', `dnl
+include(`foo') ignored
+dnl')dnl
 changeword(`\([_a-zA-Z][_a-zA-Z0-9]*\|bar
 \)')
 @result{}
 __file__:__line__
-@result{}stdin:7
-include(`foo') still ignored
+@result{}stdin:10
+include(`foo') ignored
 __file__:__line__
-@result{}stdin:9
+@result{}stdin:12
+baz ignored
+__file__:__line__
+@result{}stdin:14
 define(`bar
 ', defn(`__file__'))
 @result{}
@@ -2916,7 +2922,7 @@
 include(`foo')
 @result{}1
 __file__:__line__
-@result{}stdin:16
+@result{}stdin:21
 @end example
 @end ignore
 
@@ -4477,7 +4483,7 @@
 though wrapped text came from line 0 of the file ``''.
 
 @example
-define(`echo', `$@')
+define(`echo', `$@@')
 @result{}
 define(`foo', `echo(__line__
 __line__)')
Index: src/input.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/input.c,v
retrieving revision 1.1.1.1.2.25
diff -u -r1.1.1.1.2.25 input.c
--- src/input.c	11 Oct 2006 23:34:22 -0000	1.1.1.1.2.25
+++ src/input.c	12 Oct 2006 14:03:55 -0000
@@ -620,7 +620,7 @@
       i->type = INPUT_STRING_WRAP;
       i->u.u_s.string = "";
       i->u.u_s.name = current_file;
-      i->u.u_s.lineno = current_line + 1;  /* Account for parsed `\n'.  */
+      i->u.u_s.lineno = current_line + start_of_input_line;
       isp = i;
     }
 }
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.