cpp:s handling of \-CR-LF continuation lines

Zack Weinberg zack@wolery.cumb.org
Tue Jan 11 09:36:00 GMT 2000


On Tue, Jan 11, 2000 at 06:20:32PM +0100, Niels Möller wrote:
> I have a set of source files that are shared between w*ndows and unix
> environments. The files are mostly edited under w*ndows.
> 
> Some of the files contains macro definitions like
> 
>   #define FOO(x) \
>   foo(x)
> 
> that are split over several lines, for readability. The problem is that
> if the file was edited under W*ndows or DOS, the file typically
> contains the character sequence \ CR LF. But gcc only recognizes the
> \-construction if the backslash is followed *immediately* by a
> linefeed character.
> 
> Symptoms are "stray \ in program" errors followed by other parse
> errors.

This is a well known problem.  No one's doing any real work on cccp,
but cpplib has already been patched to handle DOS-style line breaks -
you missed the 'else if' clause below the one you modified.

If you are prepared to build your own copy of the compiler, I suggest
configuring with --enable-cpplib.  You may then encounter genuine bugs
which you should report.

zw


More information about the Gcc-bugs mailing list