CPP outputs wrong number of newlines sometimes

Neil Booth NeilB@earthling.net
Tue Sep 26 10:21:00 GMT 2000


Jamie Lokier wrote:-

> If it's UTF-8 output, then rescanning is ok for newlines.

I was hoping to just copy the comment to output verbatim (as now), but
that might be hoping for too much and we have to convert each
character anyway.

> At the moment with -C, // comment tokens include the newline at end.  If
> you don't clear pfile->need_newline in output_token, you get output like
> this with redundant newlines and line directives:
> 
>   // first
> 
> # 2
>   // second

Yes, that's a bug.

> > Don't you just love GNU extensions? <g>
> 
> I don't think this is an extension.  Don't all unix preprocessors have
> to do the same thing here?

Well, multi-line strings are.  Dunno about -C for unix preprocessors, but
I assumed that was gcc only.  Otherwise, tokens cannot straddle lines so
life is easy.

> Hmm.  Which form, anyway?  So many to choose from.

:)  If you're going to do it, I'd start now.  You'll be lucky to have it
finished within 1 month.

Neil.


More information about the Gcc-patches mailing list