Kaydet (Commit) c5616014 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

loplugin:redundantcast: suppress warnings in reworked glibc assert macro

Change-Id: I20be230b3ff5d11395f33a9896d0a575c3051fb7
üst 682f05f0
...@@ -439,6 +439,20 @@ bool RedundantCast::VisitCXXStaticCastExpr(CXXStaticCastExpr const * expr) { ...@@ -439,6 +439,20 @@ bool RedundantCast::VisitCXXStaticCastExpr(CXXStaticCastExpr const * expr) {
{ {
return true; return true;
} }
// Suppress warnings from static_cast<bool> in C++ definition of assert in
// <https://sourceware.org/git/?p=glibc.git;a=commit;
// h=b5889d25e9bf944a89fdd7bcabf3b6c6f6bb6f7c> "assert: Support types
// without operator== (int) [BZ #21972]":
if (t1->isBooleanType() && t2->isBooleanType()) {
auto loc = expr->getLocStart();
if (compiler.getSourceManager().isMacroBodyExpansion(loc)
&& (Lexer::getImmediateMacroName(
loc, compiler.getSourceManager(), compiler.getLangOpts())
== "assert"))
{
return true;
}
}
report( report(
DiagnosticsEngine::Warning, DiagnosticsEngine::Warning,
("static_cast from %0 %1 to %2 %3 is redundant%select{| or should be" ("static_cast from %0 %1 to %2 %3 is redundant%select{| or should be"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment