compilerplugins/Makefile-clang.mk | 8 ++++++-- compilerplugins/clang/constfieldsrewrite.cxx | 1 + compilerplugins/clang/dbgunhandledexception.cxx | 1 + compilerplugins/clang/dyncastvisibility.cxx | 4 ++-- compilerplugins/clang/empty.cxx | 2 +- compilerplugins/clang/getimplementationname.cxx | 3 +-- compilerplugins/clang/implicitboolconversion.cxx | 1 + compilerplugins/clang/nullptr.cxx | 6 ++---- compilerplugins/clang/sharedvisitor/generator.cxx | 1 + compilerplugins/clang/stringconstant.cxx | 3 +-- compilerplugins/clang/unusedfieldsremove.cxx | 1 + compilerplugins/clang/unusedmethodsremove.cxx | 1 + 12 files changed, 19 insertions(+), 13 deletions(-)
New commits: commit b1c14c30ba99ede85e41934b565195b0cbc69703 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Sun Oct 6 14:22:59 2019 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Mon Oct 7 21:56:55 2019 +0200 fix various warnings in compilerplugins These are triggered when using llvm-config --cxxflags for building, and sometimes there's -Werror. The warnings were mostly unused variables because of being used only in assert(), or default case in switch that covers all enums (it's better to not handle default to get warning if a case is not handled). Change-Id: I0ecdd1f27390aadf033852b0d1ee0ca424ae3c37 Reviewed-on: https://gerrit.libreoffice.org/80317 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/compilerplugins/clang/constfieldsrewrite.cxx b/compilerplugins/clang/constfieldsrewrite.cxx index 209d97423a23..03fb3d0c3609 100644 --- a/compilerplugins/clang/constfieldsrewrite.cxx +++ b/compilerplugins/clang/constfieldsrewrite.cxx @@ -78,6 +78,7 @@ ConstFieldsRewrite::~ConstFieldsRewrite() //Cleanup int rc = munmap(mmappedData, mmapFilesize); assert(rc == 0); + (void)rc; close(mmapFD); } diff --git a/compilerplugins/clang/dbgunhandledexception.cxx b/compilerplugins/clang/dbgunhandledexception.cxx index 81d6126fb3af..d1406c18a9dd 100644 --- a/compilerplugins/clang/dbgunhandledexception.cxx +++ b/compilerplugins/clang/dbgunhandledexception.cxx @@ -59,6 +59,7 @@ bool DbgUnhandledException::PreTraverseCXXCatchStmt(CXXCatchStmt* catchStmt) bool DbgUnhandledException::PostTraverseCXXCatchStmt(CXXCatchStmt* catchStmt, bool) { assert(currCatchStmt.top() == catchStmt); + (void)catchStmt; currCatchStmt.pop(); return true; } diff --git a/compilerplugins/clang/dyncastvisibility.cxx b/compilerplugins/clang/dyncastvisibility.cxx index 0f6021101e2b..3aa66e0dc21b 100644 --- a/compilerplugins/clang/dyncastvisibility.cxx +++ b/compilerplugins/clang/dyncastvisibility.cxx @@ -59,6 +59,7 @@ bool isDerivedFrom( if (bases->insert(bd).second) { auto const d = isDerivedFrom(bd, base, bases, hidden); assert(d); + (void)d; *hidden |= getTypeVisibility(bd) != DefaultVisibility; } derived = true; @@ -75,9 +76,8 @@ StringRef vis(Visibility v) { return "protected"; case DefaultVisibility: return "default"; - default: - llvm_unreachable("unknown visibility"); } + llvm_unreachable("unknown visibility"); } class DynCastVisibility final: diff --git a/compilerplugins/clang/empty.cxx b/compilerplugins/clang/empty.cxx index 6ddbf2a84a2d..108745460d0c 100644 --- a/compilerplugins/clang/empty.cxx +++ b/compilerplugins/clang/empty.cxx @@ -35,7 +35,7 @@ BinaryOperatorKind reverse(BinaryOperatorKind op) case BO_NE: return op; default: - assert(false); + abort(); } } diff --git a/compilerplugins/clang/getimplementationname.cxx b/compilerplugins/clang/getimplementationname.cxx index cf234079750e..acc45acb7442 100644 --- a/compilerplugins/clang/getimplementationname.cxx +++ b/compilerplugins/clang/getimplementationname.cxx @@ -209,8 +209,7 @@ bool GetImplementationName::isStringConstant( return false;//TODO } default: - assert(false); //TODO??? - return "BAD11"; + abort(); //TODO??? } } diff --git a/compilerplugins/clang/implicitboolconversion.cxx b/compilerplugins/clang/implicitboolconversion.cxx index a6ff1c53c26d..84addf67f858 100644 --- a/compilerplugins/clang/implicitboolconversion.cxx +++ b/compilerplugins/clang/implicitboolconversion.cxx @@ -174,6 +174,7 @@ bool isBoolExpr(Expr const * expr) { CXXOperatorCallExpr const * op = dyn_cast<CXXOperatorCallExpr>(stack.top()); assert(op != nullptr); + (void)op; TemplateDecl const * d = t->getTemplateName().getAsTemplateDecl(); if (d == nullptr diff --git a/compilerplugins/clang/nullptr.cxx b/compilerplugins/clang/nullptr.cxx index 30458d7f7f5a..89535daa9849 100644 --- a/compilerplugins/clang/nullptr.cxx +++ b/compilerplugins/clang/nullptr.cxx @@ -29,11 +29,9 @@ char const * kindName(Expr::NullPointerConstantKind kind) { case Expr::NPCK_GNUNull: return "GNUNull"; case Expr::NPCK_NotNull: - assert(false); // cannot happen - // fall through - default: - std::abort(); + break; // cannot happen } + llvm_unreachable("unknown null pointer kind"); } bool isAnyKindOfPointerType(QualType type) { diff --git a/compilerplugins/clang/sharedvisitor/generator.cxx b/compilerplugins/clang/sharedvisitor/generator.cxx index 467f141b2cb5..052b16b433fd 100644 --- a/compilerplugins/clang/sharedvisitor/generator.cxx +++ b/compilerplugins/clang/sharedvisitor/generator.cxx @@ -420,6 +420,7 @@ static bool readFile( const string& fileName ) } assert( endOk ); + (void)endOk; if( pluginInfo.shouldVisitTemplateInstantiations && pluginInfo.shouldVisitImplicitCode ) plugins[ PluginVisitTemplatesImplicit ].push_back( move( pluginInfo )); diff --git a/compilerplugins/clang/stringconstant.cxx b/compilerplugins/clang/stringconstant.cxx index 8a56e8998b08..ed2fd52b75b0 100644 --- a/compilerplugins/clang/stringconstant.cxx +++ b/compilerplugins/clang/stringconstant.cxx @@ -1333,9 +1333,8 @@ std::string StringConstant::describeChangeKind(ChangeKind kind) { return "sal_Unicode argument"; case ChangeKind::OUStringLiteral1: return "OUStringLiteral1 argument"; - default: - std::abort(); } + llvm_unreachable("unknown change kind"); } bool StringConstant::isStringConstant( diff --git a/compilerplugins/clang/unusedfieldsremove.cxx b/compilerplugins/clang/unusedfieldsremove.cxx index 62c5fc7bb271..b8c339edcbcd 100644 --- a/compilerplugins/clang/unusedfieldsremove.cxx +++ b/compilerplugins/clang/unusedfieldsremove.cxx @@ -69,6 +69,7 @@ UnusedFieldsRemove::~UnusedFieldsRemove() //Cleanup int rc = munmap(mmappedData, mmapFilesize); assert(rc == 0); + (void)rc; close(mmapFD); } diff --git a/compilerplugins/clang/unusedmethodsremove.cxx b/compilerplugins/clang/unusedmethodsremove.cxx index 1a4adc0a5c6b..417c3778edf0 100644 --- a/compilerplugins/clang/unusedmethodsremove.cxx +++ b/compilerplugins/clang/unusedmethodsremove.cxx @@ -70,6 +70,7 @@ UnusedMethodsRemove::~UnusedMethodsRemove() //Cleanup int rc = munmap(mmappedData, mmapFilesize); assert(rc == 0); + (void)rc; close(mmapFD); } commit 0ec6797f8063a1a82dc492840351c3f0f58088a4 Author: Luboš Luňák <l.lu...@collabora.com> AuthorDate: Mon Oct 7 15:07:59 2019 +0200 Commit: Luboš Luňák <l.lu...@collabora.com> CommitDate: Mon Oct 7 21:56:32 2019 +0200 generate make dependencies also for clang.pch Change-Id: Id05f2741763ef0d9e87d9804339d29aee6bc068f Reviewed-on: https://gerrit.libreoffice.org/80380 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lu...@collabora.com> diff --git a/compilerplugins/Makefile-clang.mk b/compilerplugins/Makefile-clang.mk index 6e18ee55487a..14356d1548fd 100644 --- a/compilerplugins/Makefile-clang.mk +++ b/compilerplugins/Makefile-clang.mk @@ -146,7 +146,7 @@ compilerplugins-clean: $(CLANGOUTDIR)/clang-timestamp \ $(CLANGOUTDIR)/plugin$(CLANG_DL_EXT) \ $(CLANGOUTDIR)/sharedvisitor/*.plugininfo \ - $(CLANGOUTDIR)/sharedvisitor/clang.pch \ + $(CLANGOUTDIR)/sharedvisitor/clang.pch{,.d} \ $(CLANGOUTDIR)/sharedvisitor/sharedvisitor.{cxx,d,o} \ $(CLANGOUTDIR)/sharedvisitor/{analyzer,generator}{$(CLANG_EXE_EXT),.d,.o} \ $(CLANGOUTDIR)/sources-new.txt \ @@ -310,7 +310,11 @@ $(CLANGOUTDIR)/sharedvisitor/clang.pch: $(CLANGINDIR)/sharedvisitor/precompiled_ | $(CLANGOUTDIR)/sharedvisitor $(call gb_Output_announce,$(subst $(BUILDDIR)/,,$@),$(true),PCH,1) $(QUIET)$(CLANGDIR)/bin/clang -x c++-header $(LO_CLANG_ANALYZER_PCH_CXXFLAGS) \ - $(COMPILER_PLUGINS_TOOLING_ARGS) $< -o $@ + $(COMPILER_PLUGINS_TOOLING_ARGS) $< -o $@ -MMD -MT $@ -MP \ + -MF $(CLANGOUTDIR)/sharedvisitor/clang.pch.d + +-include $(CLANGOUTDIR)/sharedvisitor/clan.pch.d + else $(CLANGOUTDIR)/sharedvisitor/clang.pch: touch $@ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits