[cfe-commits] Review: Patch for handling C99 veridic macros when using precompiled headers

Douglas Gregor dgregor at apple.com
Fri Jun 29 11:29:53 PDT 2012


On Jun 25, 2012, at 3:22 PM, Filipe Cabecinhas <filcab at filcab.net> wrote:

> Hi all, 
> 
> C99 variadic macros aren't working when we use precompiled headers (either that or I made several mistakes when trying to use them).
> 
> Attached is a patch with a test-case that is not working on current clang.
> 
> I'm doing special __VA_ARGS__ handling in Preprocessor::HandleIdentifier(Token &Identifier).
> 
> What's happening:
> __VA_ARGS__ is being serialized in the precompiled header and is being read when Preprocessor::HandleIdentifier calls updateOutOfDateIdentifier(II) with the recently read __VA_ARGS__ II.
> The Preprocessor had set Ident__VA_ARGS__->isPoisoned to false because we're defining a C99 variadic macro, but when ASTReader updates the __VA_ARGS__ token, it sets it to what it was when writing the pch file: true.
> 
> It seemed that handling it here was better than to handle it when writing or reading the pch file.

This seems reasonable. I simplified the condition so that it checks the address of the IdentifierInfos (since they are uniqued by the identifier table), and committed as r159446. Thanks!

	- Doug



More information about the cfe-commits mailing list