compilerplugins/clang/redundantcast.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
New commits: commit c5616014bb288b89610b8b59b9515a06577a8c41 Author: Stephan Bergmann <[email protected]> Date: Fri Aug 25 20:21:25 2017 +0200 loplugin:redundantcast: suppress warnings in reworked glibc assert macro Change-Id: I20be230b3ff5d11395f33a9896d0a575c3051fb7 diff --git a/compilerplugins/clang/redundantcast.cxx b/compilerplugins/clang/redundantcast.cxx index 03e48f8fe261..19393e0c6449 100644 --- a/compilerplugins/clang/redundantcast.cxx +++ b/compilerplugins/clang/redundantcast.cxx @@ -439,6 +439,20 @@ bool RedundantCast::VisitCXXStaticCastExpr(CXXStaticCastExpr const * expr) { { 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( DiagnosticsEngine::Warning, ("static_cast from %0 %1 to %2 %3 is redundant%select{| or should be" _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
