Skip to content

Commit a647f8e

Browse files
committed
Collapse all _msg diagnostics
1 parent f1f116d commit a647f8e

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9301,16 +9301,10 @@ def warn_unused_call : Warning<
93019301
"ignoring return value of function declared with %0 attribute">,
93029302
InGroup<UnusedValue>;
93039303
def warn_unused_return_type : Warning<
9304-
"ignoring %select{return value|temporary}0 of type %2 declared with %1 attribute">,
9305-
InGroup<UnusedValue>;
9306-
def warn_unused_return_type_msg : Warning<
9307-
"ignoring %select{return value|temporary}0 of type %2 declared with %1 attribute: %3">,
9304+
"ignoring %select{return value|temporary}0 of type %2 declared with %1 attribute%select{|: %4}3">,
93089305
InGroup<UnusedValue>;
93099306
def warn_unused_constructor : Warning<
9310-
"ignoring temporary created by a constructor declared with %0 attribute">,
9311-
InGroup<UnusedValue>;
9312-
def warn_unused_constructor_msg : Warning<
9313-
"ignoring temporary created by a constructor declared with %0 attribute: %1">,
9307+
"ignoring temporary created by a constructor declared with %0 attribute%select{|: %2}1">,
93149308
InGroup<UnusedValue>;
93159309
def warn_side_effects_unevaluated_context : Warning<
93169310
"expression with side effects has no effect in an unevaluated context">,
@@ -9319,10 +9313,7 @@ def warn_side_effects_typeid : Warning<
93199313
"expression with side effects will be evaluated despite being used as an "
93209314
"operand to 'typeid'">, InGroup<PotentiallyEvaluatedExpression>;
93219315
def warn_unused_result : Warning<
9322-
"ignoring return value of function declared with %0 attribute">,
9323-
InGroup<UnusedResult>;
9324-
def warn_unused_result_msg : Warning<
9325-
"ignoring return value of function declared with %0 attribute: %1">,
9316+
"ignoring return value of function declared with %0 attribute%select{|: %2}1">,
93269317
InGroup<UnusedResult>;
93279318
def warn_unused_result_typedef_unsupported_spelling : Warning<
93289319
"'[[%select{nodiscard|gnu::warn_unused_result}0]]' attribute ignored when "

clang/lib/Sema/SemaStmt.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -214,19 +214,20 @@ static bool DiagnoseNoDiscard(Sema &S, const NamedDecl *OffendingDecl,
214214
if (Msg.empty()) {
215215
if (OffendingDecl)
216216
return S.Diag(Loc, diag::warn_unused_return_type)
217-
<< IsCtor << A << OffendingDecl << R1 << R2;
217+
<< IsCtor << A << OffendingDecl << false << R1 << R2;
218218
if (IsCtor)
219-
return S.Diag(Loc, diag::warn_unused_constructor) << A << R1 << R2;
220-
return S.Diag(Loc, diag::warn_unused_result) << A << R1 << R2;
219+
return S.Diag(Loc, diag::warn_unused_constructor)
220+
<< A << false << R1 << R2;
221+
return S.Diag(Loc, diag::warn_unused_result) << A << false << R1 << R2;
221222
}
222223

223224
if (OffendingDecl)
224-
return S.Diag(Loc, diag::warn_unused_return_type_msg)
225-
<< IsCtor << A << OffendingDecl << Msg << R1 << R2;
225+
return S.Diag(Loc, diag::warn_unused_return_type)
226+
<< IsCtor << A << OffendingDecl << true << Msg << R1 << R2;
226227
if (IsCtor)
227-
return S.Diag(Loc, diag::warn_unused_constructor_msg)
228-
<< A << Msg << R1 << R2;
229-
return S.Diag(Loc, diag::warn_unused_result_msg) << A << Msg << R1 << R2;
228+
return S.Diag(Loc, diag::warn_unused_constructor)
229+
<< A << true << Msg << R1 << R2;
230+
return S.Diag(Loc, diag::warn_unused_result) << A << true << Msg << R1 << R2;
230231
}
231232

232233
void Sema::DiagnoseUnusedExprResult(const Stmt *S, unsigned DiagID) {

0 commit comments

Comments
 (0)