pcpp tends to keep whitespace tokens around when they are found in the source file. Normally, this is benign because they wind up getting passed to the output. In fact, sometimes (like whitespace between two identifiers) you want to see some space between them in an output file.
However, when there's a ## operator, it's supposed to ignore any adjacent whitespace and stitch together the next tokens before and after it.
pcpp doesn't do that.
Take the example from C99 6.10.3.3.
The ## operator produces a single token with a " " value (two space characters).
Incidentally, when this is later stringized by the mkstr() macro, it is replaced with a single space, correctly following C99 6.10.3.2. That is why you see "x # # y" rather than "x # # y".
pcpp
tends to keep whitespace tokens around when they are found in the source file. Normally, this is benign because they wind up getting passed to the output. In fact, sometimes (like whitespace between two identifiers) you want to see some space between them in an output file. However, when there's a##
operator, it's supposed to ignore any adjacent whitespace and stitch together the next tokens before and after it.pcpp
doesn't do that. Take the example from C99 6.10.3.3.Running
pcpp
on this example producesThe
##
operator produces a single token with a " " value (two space characters). Incidentally, when this is later stringized by the mkstr() macro, it is replaced with a single space, correctly following C99 6.10.3.2. That is why you see"x # # y"
rather than"x # # y"
.