Closed OmegaDoom closed 5 years ago
microsoft preprocessor behaves like pcpp - vs-2017 e-preprocess-to-stdout Unfortunately i need gcc behavior. I preprocess a file where this issue is present and i cannot change the source.
An interesting corner case. I'll look into it, but it won't be until May.
Thank you! An interesting article - msvc-preprocessor-progress-towards-conformance
Wave also behaves like pcpp. The standard doesn't say anything about this, because according to it, the tokens output by the preprocessor are fed to the compiler with no text conversion in the middle. Standalone preprocessors that generate text output are not contemplated in the standard.
Arguably, however, a standalone preprocessor should ensure that parsing its output using a C compiler's tokenizer produces the same sequence of tokens that the compiler would take if they were integrated, and one obvious method is inserting whitespace between some tokens, as GCC does. IIRC this has ugly implications and corner cases that GCC does not cover.
Fixed in trunk, though I can see loads more corner cases that might now break in future :)
Hello.
For example we have following:
gcc -E output:
pcpp output: