From 123bec89ab8fd59364adcd9fea8d5b11791c6310 Mon Sep 17 00:00:00 2001 From: Abramo Bagnara Date: Sun, 1 Jan 2012 22:01:04 +0000 Subject: Added -Wdisabled-macro-expansion warning. llvm-svn: 147418 --- clang/lib/Lex/Preprocessor.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'clang/lib/Lex/Preprocessor.cpp') diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index dea7efc7658..90b67984665 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -509,8 +509,10 @@ void Preprocessor::HandleIdentifier(Token &Identifier) { // If this is a macro to be expanded, do it. if (MacroInfo *MI = getMacroInfo(&II)) { - if (!DisableMacroExpansion && !Identifier.isExpandDisabled()) { - if (MI->isEnabled()) { + if (!DisableMacroExpansion) { + if (Identifier.isExpandDisabled()) { + Diag(Identifier, diag::pp_disabled_macro_expansion); + } else if (MI->isEnabled()) { if (!HandleMacroExpandedIdentifier(Identifier, MI)) return; } else { @@ -518,6 +520,7 @@ 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); } } } -- cgit v1.2.3