Issue Details (XML | Word | Printable)

Key: PCC-149
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Iain Hibbert
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
pcc

cpp fails to remove backslash new-line sequence during preprocessing

Created: 06/Jun/10 09:54 PM   Updated: 07/Jun/10 09:10 AM
Component/s: C preprocessor
Affects Version/s: None
Fix Version/s: None

Environment: NetBSD/i386


 Description  « Hide
cpp fails to remove the backslash new-line sequence from its input, consider the following code

void foo\
bar (void)
{
}

which is valid (if a little ridiculous) C but pcc produces a syntax error.

The more common case where somebody just used backslash new-line in a normal whitespace position seems to be handled by ccom, but because the preprocessor does not delete it (I think it should, according to C99 5.1.1.2 # 2?) then it causes problems if the output is used elsewhere (eg by lint)

probably this should be handled in fastscan()? I'm not sure..



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 06/Jun/10 10:11 PM
I've fixed it for this specific case, but a more generic solution is needed. Later.

Iain Hibbert added a comment - 07/Jun/10 08:49 AM
Apologies, my example was insufficient, the actual code that failed was the more common case and there was a space before the backslash

void foo \
    (void)
{
}

and this backslash still appears in the output, confusing lint

Anders Magnusson added a comment - 07/Jun/10 09:10 AM
Ok, fixed.