[Top][All Lists]
[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 14:46:04 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Eric Blake <ebb9 <at> byu.net> writes:
>
> 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.
For comparison, here is how Solaris m4 behaves:
=> #line 1 "-"
changecom(/*,*/)
=>
hello
=> hello
/* multi
=> /* multi
line */
=> line */
`multi
=> multi
line'
=> line
define(foo,``multi
line'')
=>
=> #line 9
foo
=> multi
=> line
=> #line 10
define(bar, `/*multi
line*/')
=>
=> #line 12
dnl
dnl
hi
=> hi
=> #line 15
bar
=> /*multi
=> line*/
=> #line 16
Their algorithm is a bit off (it prints the line directive _before_ collecting
an input line, so anything that follows omitted lines is off; for example,
#line 12 should have been #line 14, and then #line 15 was unnecessary). But
that output never broke up a multi-line token.
On the other hand:
=> #line 1 "-"
define(foo,a
b)
=>
=> #line 3
one foo two
=> one a
=> #line 3
=> b two
define(bar,``a
b'')
=>
=> #line 6
one bar two
=> one a
=> #line 6
=> b two
hi
=> hi
The second #line 3 is expected; the output of foo is three tokens (a, newline,
b). But the second #line 6 broke up a multiline token (the single
string 'a\nb'). Which means Solaris m4 has the same bug, that it can insert
line directives inside a multiline comment and mess up a preprocessor's notion
of the current line for the subsequent line.
--
Eric Blake
- [PATCH] Line synchronisation output in comments, Sergey Poznyakoff, 2007/05/24
- Re: [PATCH] Line synchronisation output in comments, Eric Blake, 2007/05/24
- Re: [PATCH] Line synchronisation output in comments, Sergey Poznyakoff, 2007/05/24
- Re: [PATCH] Line synchronisation output in comments, Eric Blake, 2007/05/25
- Re: [PATCH] Line synchronisation output in comments,
Eric Blake <=
- Re: [PATCH] Line synchronisation output in comments, Sergey Poznyakoff, 2007/05/25
- Re: [PATCH] Line synchronisation output in comments, Eric Blake, 2007/05/25
- Re: [PATCH] Line synchronisation output in comments, Eric Blake, 2007/05/28
- Re: [PATCH] Line synchronisation output in comments, Gary V. Vaughan, 2007/05/30
- Re: [PATCH] Line synchronisation output in comments, Sergey Poznyakoff, 2007/05/29