[cfe-dev] Clang macro expansion differs from GCC

David Peixotto dmp at rice.edu
Thu Apr 8 10:41:39 PDT 2010


Hi Chris,

Thanks for the quick response.

On Apr 8, 2010, at 11:48 AM, Chris Lattner wrote:
> On Apr 8, 2010, at 8:34 AM, David Peixotto wrote:
> 
>> I have found a discrepancy in behavior between the clang preprocessor and gcc. 
>> 
> 
> Hi David,
> 
> I'm not particularly interested in fixing this: people abusing the C preprocessor to preprocess things that aren't C don't get much sympathy from me.  However, if you are able to produce a patch that works, doesn't break anything else, and doesn't affect performance, I'd be happy to apply it.

I can fully understand your position on this point. I thought I'd report it since the behavior was different than GCC and did prevent clang from being used as a drop-in replacement.

> 
>> 
>> I'd be happy to take a look at fixing this myself if someone could point me in the right direction.
> 
> 
> lib/Frontend/PrintPreprocessedOutput.cpp is the code that outputs a .i file, the "AvoidConcat" stuff is what you want.  It is what decides to add spaces to prevent three . tokens from looking like a ... for example.

Great, thanks for the pointer. I'll take a look and if I can come up with something reasonable, I will send a patch.

-Dave


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100408/516f045a/attachment.html>


More information about the cfe-dev mailing list