[cfe-commits] r147418 - in /cfe/trunk: include/clang/Basic/DiagnosticLexKinds.td lib/Lex/Preprocessor.cpp
Ted Kremenek
kremenek at apple.com
Tue Jan 3 11:46:51 PST 2012
Hi Abramo,
Are there any test cases for this warning?
Cheers,
Ted
On Jan 1, 2012, at 2:01 PM, Abramo Bagnara wrote:
> Author: abramo
> Date: Sun Jan 1 16:01:04 2012
> New Revision: 147418
>
> URL: http://llvm.org/viewvc/llvm-project?rev=147418&view=rev
> Log:
> Added -Wdisabled-macro-expansion warning.
>
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
> cfe/trunk/lib/Lex/Preprocessor.cpp
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=147418&r1=147417&r2=147418&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Sun Jan 1 16:01:04 2012
> @@ -167,6 +167,9 @@
> def pp_undef_builtin_macro : Warning<"undefining builtin macro">;
> def pp_redef_builtin_macro : Warning<"redefining builtin macro">,
> InGroup<DiagGroup<"builtin-macro-redefined">>;
> +def pp_disabled_macro_expansion : Warning<
> + "disabled expansion of recursive macro">, DefaultIgnore,
> + InGroup<DiagGroup<"disabled-macro-expansion">>;
> def pp_macro_not_used : Warning<"macro is not used">, DefaultIgnore,
> InGroup<DiagGroup<"unused-macros">>;
> def warn_pp_undef_identifier : Warning<
>
> Modified: cfe/trunk/lib/Lex/Preprocessor.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Preprocessor.cpp?rev=147418&r1=147417&r2=147418&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Lex/Preprocessor.cpp (original)
> +++ cfe/trunk/lib/Lex/Preprocessor.cpp Sun Jan 1 16:01:04 2012
> @@ -509,8 +509,10 @@
>
> // 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 @@
> // 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);
> }
> }
> }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list