[cfe-dev] Clang macro expansion differs from GCC

Chris Lattner clattner at apple.com
Mon Apr 12 17:12:41 PDT 2010

On Apr 11, 2010, at 11:43 AM, David Peixotto wrote:

> Hi Chris,
> I took a look at modifying the preprocessor output and it was pretty
> straightforward. I have attached a patch that makes the preprocessed output
> less conservative in adding spaces between periods. It will now add a space to
> avoid turning ".. ." into "...", but does not always add a space between two
> consecutive dots.
> The change was done by keeping track of the last two tokens that were output
> and testing against those two tokens to avoid creating "...". Previously only
> the last output token was tracked and tested against, which caused any two
> consecutive . tokens to have a space between them.
> The patch passes all the tests in the tests subdirectory. I modified one test
> to reflect the output changing from ". . ." to ".. .". This output happens to
> match the expected output in the test comment. I also added a test for the
> original case that was causing me problems.
> Please let me know if there are more tests I should run or anything else that
> needs to happen for the patch to be accepted. Thanks!

This patch looks great, except that it happens to conflict on mainline.  :(  Please send and updated patch and I'll be happy to apply it for you.  One minor thing is to watch & placement in "const Token& PrevPrevTok, "

Thanks for working on this!


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

More information about the cfe-dev mailing list