diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-12 02:46:14 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-12 02:46:14 +0000 |
commit | 181879c293df6a88e8ef054c67c3b32beb5fc92c (patch) | |
tree | cd5823c206a42527ec3cf8e1d0a88abf1cd4ea83 /clang/lib/Lex/Preprocessor.cpp | |
parent | 962711ee71599d9f05aac3fb6678408777509e7d (diff) | |
download | bcm5719-llvm-181879c293df6a88e8ef054c67c3b32beb5fc92c.tar.gz bcm5719-llvm-181879c293df6a88e8ef054c67c3b32beb5fc92c.zip |
Don't warn about disabled macro expansion if we see the name of a function-like macro which isn't immediately followed by '('. FreeBSD's stdio.h #defines foo(x) to (foo)(x), apparently.
llvm-svn: 169960
Diffstat (limited to 'clang/lib/Lex/Preprocessor.cpp')
-rw-r--r-- | clang/lib/Lex/Preprocessor.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index 4f0b189c8b0..df2c98dd8ea 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -592,9 +592,7 @@ void Preprocessor::HandleIdentifier(Token &Identifier) { // If this is a macro to be expanded, do it. if (MacroInfo *MI = getMacroInfo(&II)) { if (!DisableMacroExpansion) { - if (Identifier.isExpandDisabled()) { - Diag(Identifier, diag::pp_disabled_macro_expansion); - } else if (MI->isEnabled()) { + if (!Identifier.isExpandDisabled() && MI->isEnabled()) { if (!HandleMacroExpandedIdentifier(Identifier, MI)) return; } else { @@ -602,7 +600,8 @@ void Preprocessor::HandleIdentifier(Token &Identifier) { // expanded, even if it's in a context where it could be expanded in the // future. Identifier.setFlag(Token::DisableExpand); - Diag(Identifier, diag::pp_disabled_macro_expansion); + if (MI->isObjectLike() || isNextPPTokenLParen()) + Diag(Identifier, diag::pp_disabled_macro_expansion); } } } |