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>
This commit is contained in:
Luboš Luňák
2019-10-06 14:22:59 +02:00
parent 0ec6797f80
commit b1c14c30ba
11 changed files with 13 additions and 11 deletions

View File

@@ -78,6 +78,7 @@ ConstFieldsRewrite::~ConstFieldsRewrite()
//Cleanup
int rc = munmap(mmappedData, mmapFilesize);
assert(rc == 0);
(void)rc;
close(mmapFD);
}

View File

@@ -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;
}

View File

@@ -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:

View File

@@ -35,7 +35,7 @@ BinaryOperatorKind reverse(BinaryOperatorKind op)
case BO_NE:
return op;
default:
assert(false);
abort();
}
}

View File

@@ -209,8 +209,7 @@ bool GetImplementationName::isStringConstant(
return false;//TODO
}
default:
assert(false); //TODO???
return "BAD11";
abort(); //TODO???
}
}

View File

@@ -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

View File

@@ -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) {

View File

@@ -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 ));

View File

@@ -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(

View File

@@ -69,6 +69,7 @@ UnusedFieldsRemove::~UnusedFieldsRemove()
//Cleanup
int rc = munmap(mmappedData, mmapFilesize);
assert(rc == 0);
(void)rc;
close(mmapFD);
}

View File

@@ -70,6 +70,7 @@ UnusedMethodsRemove::~UnusedMethodsRemove()
//Cleanup
int rc = munmap(mmappedData, mmapFilesize);
assert(rc == 0);
(void)rc;
close(mmapFD);
}