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
This commit is contained in:
Richard Smith
2012-12-12 02:46:14 +00:00
parent 962711ee71
commit 181879c293
2 changed files with 7 additions and 4 deletions

View File

@@ -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);
}
}
}