aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/Preprocessor.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-12-12 02:46:14 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-12-12 02:46:14 +0000
commit1fbf6fb5c7ecbf803e692f0d1622870a36cf83b7 (patch)
treec99520bfb10245cf4d1a216cfd2e36a5e3a23729 /lib/Lex/Preprocessor.cpp
parentb94b62c3b15967d29f63165e834fa4f12944394c (diff)
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169960 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/Preprocessor.cpp')
-rw-r--r--lib/Lex/Preprocessor.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index 4f0b189c8b..df2c98dd8e 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/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);
}
}
}