m4-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] Line synchronisation output in comments


From: Eric Blake
Subject: Re: [PATCH] Line synchronisation output in comments
Date: Fri, 25 May 2007 06:58:41 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Sergey Poznyakoff on 5/24/2007 6:41 AM:
> Hi Eric,
> 
>> Would you mind signing copyright papers, as this patch is not trivial?
> 
> No problem, I have already filled and emailed the assigment form.  The
> snail-mail part of the process takes 3-4 weeks, usually.
> 
>> Also, can you add mention of this to NEWS and documentation (including
>> a test case) to m4.texi?
> 
> OK, I'll do that.

I'll make this a bit easier - I'm committing this patch, which adds the
ability to even test -s in the testsuite in the first place.

2007-05-25  Eric Blake  <address@hidden>

        Test -s in testsuite.
        * doc/m4.texinfo (Preprocessor features): Add a test.
        * checks/get-them: Support extra options in testsuite.
        * checks/check-them (examples): Use extra options.
        * THANKS: Update.
        Reported by Sergey Poznyakoff.

However, the issue is not just multiline comments, but also multiline
strings, so I think creating a new TOKEN_COMMENT is not strictly
necessary, since the fix for one should be applied to the other.
Futhermore, what does your patch do when a macro expands into a multiline
comment?  This is current behavior:

$ m4 -s
define(twoline,/*
*/)
=> #line 2 "stdin"
=>
changecom(/*,*/)
=>
twoline
=> /*
=> #line 4
=> */
hello
=> hello
`a
b'
=> #line 7
=> a
=> #line 7
=> b

Note the double #line 7, neither of which were necessary (since the string
came from the combination of line 6 and 7); and with your patch, if #line
4 were suppressed because it was in the middle of a comment, then hello
needs a leading #line 5, but I'm not sure your patch did that.

Instead, it seems to me like shipout_text is always called on single
tokens, so rather than outputting line directives in the middle of a
token, it should only output a line directive at the front of a token, as
needed.  I'm still hacking away on different approaches to the matter, but
I may end up committing something prior to your papers arriving at the FSF
office, because I want to get 1.5.10 out the door soon.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGVt1/84KuGfSFAYARAuRNAKCBtkjFsmUrq0pk/K809QgJRiCv2QCfbU6O
2YKFvuLLtANK9c/T1ToKEFo=
=S6c6
-----END PGP SIGNATURE-----
Index: checks/check-them
===================================================================
RCS file: /sources/m4/m4/checks/Attic/check-them,v
retrieving revision 1.1.1.1.2.14
diff -u -p -r1.1.1.1.2.14 check-them
--- checks/check-them   6 Jan 2007 19:56:11 -0000       1.1.1.1.2.14
+++ checks/check-them   25 May 2007 12:57:16 -0000
@@ -57,8 +57,9 @@ do
     continue
   }
   echo "Checking $file"
+  options=`sed -ne '3s/^dnl @ extra options: //p;3q' "$file"`
   sed -e '/^dnl @/d' -e '/^\^D$/q' "$file" \
-    | LC_MESSAGES=C m4 -d -I "$examples" - >$out 2>$err
+    | LC_MESSAGES=C m4 -d -I "$examples" $options - >$out 2>$err
   stat=$?
 
   xstat=`sed -ne '2s/^dnl @ expected status: //p;2q' "$file"`
Index: checks/get-them
===================================================================
RCS file: /sources/m4/m4/checks/Attic/get-them,v
retrieving revision 1.1.1.1.2.9
diff -u -p -r1.1.1.1.2.9 get-them
--- checks/get-them     28 Jan 2007 01:54:41 -0000      1.1.1.1.2.9
+++ checks/get-them     25 May 2007 12:57:16 -0000
@@ -15,6 +15,7 @@ BEGIN {
   count = 0;
   file = "NONE";
   status = 0;
+  options = "";
 }
 
 /address@hidden / {
@@ -37,6 +38,7 @@ BEGIN {
 /address@hidden ignore$/ {
   getline;
   status = 0;
+  options = "";
   next;
 }
 
@@ -44,6 +46,11 @@ BEGIN {
   status = $3;
 }
 
+/address@hidden options: / {
+  options = $0;
+  gsub ("@comment options:", "", options);
+}
+
 /address@hidden/, /address@hidden example$/ {
   if (seq < 0)
     next;
@@ -55,12 +62,14 @@ BEGIN {
     file = sprintf("%03d.%s", count, node);
     printf("dnl @ %s:%d: Origin of test\n"\
           "dnl @ expected status: %d\n"\
+          "dnl @ extra options: %s\n"\
           "dnl @ Copyright (C) 2006, 2007 Free Software Foundation\n"\
           "dnl @ This file is free software; the Free Software Foundation\n"\
           "dnl @ gives unlimited permission to copy and/or distribute it\n"\
           "dnl @ with or without modifications, as long as this notice\n"\
-          "dnl @ is preserved.\n", FILENAME, NR, status) > file;
+          "dnl @ is preserved.\n", FILENAME, NR, status, options) > file;
     status = 0;
+    options = "";
     next;
   }
   if ($0 ~ /address@hidden example$/) {
Index: doc/m4.texinfo
===================================================================
RCS file: /sources/m4/m4/doc/m4.texinfo,v
retrieving revision 1.1.1.1.2.123
diff -u -p -r1.1.1.1.2.123 m4.texinfo
--- doc/m4.texinfo      25 Apr 2007 14:04:13 -0000      1.1.1.1.2.123
+++ doc/m4.texinfo      25 May 2007 12:57:16 -0000
@@ -666,6 +666,24 @@ themselves.  When a synchronization disc
 an output line, the associated synchronization directive is delayed
 until the beginning of the next generated line.
 
address@hidden options: -s
address@hidden
+define(`twoline', `1
+2')
address@hidden 2 "stdin"
address@hidden
+dnl no line
+hello
address@hidden 4
address@hidden
+twoline
address@hidden
address@hidden 5
address@hidden
+goodbye
address@hidden
address@hidden example
+
 @item -U @var{NAME}
 @itemx address@hidden
 This deletes any predefined meaning @var{NAME} might have.  Obviously,

reply via email to

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