<< Back to previous view

[PCC-321] spurious space in output (preprocessor) Created: 18/Apr/11  Updated: 18/Apr/11

Status: Closed
Project: pcc
Component/s: C preprocessor
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Iain Hibbert Assignee: Anders Magnusson
Resolution: Fixed Votes: 0
Environment: NetBSD/i386


 Description   
the following code

#define A aaa
#define B \o/

>A<
>B<

when passed to the preprocessor, produces the following output

>aaa<
> \o/<

note the spurious space introduced when the definition starts with a non-text
character. Looking at the source for this its probably related to EBLOCK but I'm not
sure if this behaviour is intentional as I don't see where it came from, the space
doesn't seem to be stored in the macro buffer

 Comments   
Comment by Anders Magnusson [ 18/Apr/11 06:28 PM ]
This is actually intentional and was added in cpp.c:1.117: macro replacement is not allowed to create new tokens. See:
#define A -1
-A

should not result in --1, therefore a space is inserted between.
Generated at Sat Sep 20 22:03:54 CEST 2014 using JIRA Enterprise Edition, Version: 3.13.1-#333.