summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2019-10-06 14:22:59 +0200
committerLuboš Luňák <l.lunak@collabora.com>2019-10-07 21:56:55 +0200
commitb1c14c30ba99ede85e41934b565195b0cbc69703 (patch)
treebf97cb604fc9704f60fcd2f480a9b2420b4ea604 /compilerplugins
parent0ec6797f8063a1a82dc492840351c3f0f58088a4 (diff)
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.lunak@collabora.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/constfieldsrewrite.cxx1
-rw-r--r--compilerplugins/clang/dbgunhandledexception.cxx1
-rw-r--r--compilerplugins/clang/dyncastvisibility.cxx4
-rw-r--r--compilerplugins/clang/empty.cxx2
-rw-r--r--compilerplugins/clang/getimplementationname.cxx3
-rw-r--r--compilerplugins/clang/implicitboolconversion.cxx1
-rw-r--r--compilerplugins/clang/nullptr.cxx6
-rw-r--r--compilerplugins/clang/sharedvisitor/generator.cxx1
-rw-r--r--compilerplugins/clang/stringconstant.cxx3
-rw-r--r--compilerplugins/clang/unusedfieldsremove.cxx1
-rw-r--r--compilerplugins/clang/unusedmethodsremove.cxx1
11 files changed, 13 insertions, 11 deletions
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);
}