http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48383
Summary: Line continuations handled incorrectly in 4.5 and above Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: preprocessor AssignedTo: unassig...@gcc.gnu.org ReportedBy: d...@cowlark.com Given the following test file: foo \ bar ...then if I preprocess it with gcc 4.4 (using gcc -E), I get this: foo bar ...but if I preprocess it with gcc 4.5 or 4.6, I get this: foo bar This would appear to me to violate 5.1.1.2.1.2 of the C99 draft, which states: > Each instance of a backslash character (\) immediately followed by a new-line > character is deleted, splicing physical source lines to form logical source > lines. Given that the following test file: foo\ bar ...always preprocesses to this: foobar ...then I suspect that what we've got here is an optimisation to keep line number information correct on the 'bar' token; the reasoning would presumably be that since C (and C++) treats newlines like all other whitespace, it makes no difference whether the 'bar' token is on the same line or a new line. Unfortunately, I believe the spec doesn't allow this behaviour. (This is actually biting us because we're using cpp to preprocess files before passing them to a perl script, and are relying on cpp to glue line continuations together. As of gcc 4.5, this is no longer happening.)