Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/DiagnosticLexKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def pp_out_of_date_dependency : Warning<
"current file is older than dependency %0">;
def ext_pp_undef_builtin_macro : ExtWarn<"undefining builtin macro">,
InGroup<BuiltinMacroRedefined>;
def ext_pp_redef_builtin_macro : ExtWarn<"redefining builtin macro">,
def ext_pp_redef_builtin_macro : ExtWarn<"redefining builtin macro '%0'">,
InGroup<BuiltinMacroRedefined>;
def pp_disabled_macro_expansion : Warning<
"disabled expansion of recursive macro">, DefaultIgnore,
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Lex/PPDirectives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3289,7 +3289,7 @@ void Preprocessor::HandleDefineDirective(
// Warn if defining "__LINE__" and other builtins, per C99 6.10.8/4 and
// C++ [cpp.predefined]p4, but allow it as an extension.
if (isLanguageDefinedBuiltin(SourceMgr, OtherMI, II->getName()))
Diag(MacroNameTok, diag::ext_pp_redef_builtin_macro);
Diag(MacroNameTok, diag::ext_pp_redef_builtin_macro) << MacroNameTok.getIdentifierInfo(); // inserting this diagonstic message into stream.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary comment. Ditto below.

// Macros must be identical. This means all tokens and whitespace
// separation must be the same. C99 6.10.3p2.
else if (!OtherMI->isAllowRedefinitionsWithoutWarning() &&
Expand Down Expand Up @@ -3354,7 +3354,7 @@ void Preprocessor::HandleUndefDirective() {
// Warn if undefining "__LINE__" and other builtins, per C99 6.10.8/4 and
// C++ [cpp.predefined]p4, but allow it as an extension.
if (isLanguageDefinedBuiltin(SourceMgr, MI, II->getName()))
Diag(MacroNameTok, diag::ext_pp_undef_builtin_macro);
Diag(MacroNameTok, diag::ext_pp_undef_builtin_macro) << MacroNameTok.getIdentifierInfo(); // inserting this diagnostic message into it

if (MI->isWarnIfUnused())
WarnUnusedMacroLocs.erase(MI->getDefinitionLoc());
Expand Down
Loading