Skip to content

Commit ded85b8

Browse files
committed
Added macro name to redifine and undef macro as a part of the issue#88882
1 parent 0e6c8da commit ded85b8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

clang/include/clang/Basic/DiagnosticLexKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ def pp_out_of_date_dependency : Warning<
396396
"current file is older than dependency %0">;
397397
def ext_pp_undef_builtin_macro : ExtWarn<"undefining builtin macro">,
398398
InGroup<BuiltinMacroRedefined>;
399-
def ext_pp_redef_builtin_macro : ExtWarn<"redefining builtin macro">,
399+
def ext_pp_redef_builtin_macro : ExtWarn<"redefining builtin macro '%0'">,
400400
InGroup<BuiltinMacroRedefined>;
401401
def pp_disabled_macro_expansion : Warning<
402402
"disabled expansion of recursive macro">, DefaultIgnore,

clang/lib/Lex/PPDirectives.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3289,7 +3289,7 @@ void Preprocessor::HandleDefineDirective(
32893289
// Warn if defining "__LINE__" and other builtins, per C99 6.10.8/4 and
32903290
// C++ [cpp.predefined]p4, but allow it as an extension.
32913291
if (isLanguageDefinedBuiltin(SourceMgr, OtherMI, II->getName()))
3292-
Diag(MacroNameTok, diag::ext_pp_redef_builtin_macro);
3292+
Diag(MacroNameTok, diag::ext_pp_redef_builtin_macro) << MacroNameTok.getIdentifierInfo(); // inserting this diagonstic message into stream.
32933293
// Macros must be identical. This means all tokens and whitespace
32943294
// separation must be the same. C99 6.10.3p2.
32953295
else if (!OtherMI->isAllowRedefinitionsWithoutWarning() &&
@@ -3354,7 +3354,7 @@ void Preprocessor::HandleUndefDirective() {
33543354
// Warn if undefining "__LINE__" and other builtins, per C99 6.10.8/4 and
33553355
// C++ [cpp.predefined]p4, but allow it as an extension.
33563356
if (isLanguageDefinedBuiltin(SourceMgr, MI, II->getName()))
3357-
Diag(MacroNameTok, diag::ext_pp_undef_builtin_macro);
3357+
Diag(MacroNameTok, diag::ext_pp_undef_builtin_macro) << MacroNameTok.getIdentifierInfo(); // inserting this diagnostic message into it
33583358

33593359
if (MI->isWarnIfUnused())
33603360
WarnUnusedMacroLocs.erase(MI->getDefinitionLoc());

0 commit comments

Comments
 (0)