Issue Details (XML | Word | Printable)

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

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

backslash should end token (in preprocessor)

Created: 16/Mar/11 01:16 PM   Updated: 17/Mar/11 05:12 PM
Component/s: C preprocessor
Affects Version/s: None
Fix Version/s: None

Environment: NetBSD/i386

 Description  « Hide
A backslash in the input stream should end a token, consider the following code

#define foo FOO

foo \X foo
foo \Xfoo
foo\X foo

first, there appears to be a problem with processing the X in that it is replaced with a newline, this is fixed by the following

--- token.c 12 Mar 2011 17:06:45 -0000 1.50
+++ token.c 16 Mar 2011 12:10:25 -0000
@@ -363,7 +363,7 @@
  if (ch == '\\') {
  ch = NXTCH();
  if (ch != '\n') {
- unch('\n');
+ unch(ch);
  ch = '\\';
  } else {

but even with this the output is not completely correct, the following is now produced:

FOO \Xfoo
foo\X FOO

but the last two cases should also substitute the first foo and I'm not sure where this bug might be..

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 17/Mar/11 05:12 PM
Fixed. I fixed three errors; one that you found, one that \ was handled as an identifier and one that miscounted line numbers after \\n.