This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: unexpected parse error in #define
Neil Booth wrote:
> > The odds are overwhelming that the actual problem is that there's a
> > space at the end of line 2 of test.c. In all released versions of
> > GCC, \-newline doesn't trigger continuation if there's whitespace
> > between the \ and the end of the line.
> >
> > We recently discussed changing this but I don't remember if it was
> > implemented or not.
>
> Yes it is. Currently backslash-horizontal space(s)-newline is removed
> from the input, no matter what the context. Here newline can be '\r'
> '\n' '\r\n' or '\n\r'.
>
> Jamie, when your paperwork finishes could you please use
> skip_escped_newlines () in your skip_line_comment patch so we stay
> consistent here?
The patch you have does already. The output from this test:
// foo \ <- spaces after backslash
bar
is this:
# 1 ""
<stdin>:1:1: warning: backslash and newline separated by space
<stdin>:1:1: warning: multi-line comment
If "bar" is replaced by "// bar", you get the first warning but not the
second which is correct. If there are no spaces after the backslash,
but there is a carriage return, you don't get the first warning; this is
also correct.
enjoy,
-- Jamie