Add explicit throws after some assertions to work around a spurious warning in GCC 12.1

This commit is contained in:
Kamil Śliwak 2022-06-01 19:56:30 +02:00
parent f5e421ff91
commit 539e139555
7 changed files with 41 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include <libsmtutil/CVC4Interface.h>
#include <libsolutil/CommonIO.h>
#include <libsolutil/Exceptions.h>
#include <cvc4/util/bitvector.h>
@ -289,6 +290,9 @@ CVC4::Expr CVC4Interface::toCVC4Expr(Expression const& _expr)
}
smtAssert(false, "");
// FIXME: Workaround for spurious GCC 12.1 warning (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105794)
throw exception();
}
CVC4::Type CVC4Interface::cvc4Sort(Sort const& _sort)

View File

@ -20,6 +20,7 @@
#include <libsolutil/CommonData.h>
#include <libsolutil/CommonIO.h>
#include <libsolutil/Exceptions.h>
#ifdef HAVE_Z3_DLOPEN
#include <libsmtutil/Z3Loader.h>
@ -271,6 +272,9 @@ z3::expr Z3Interface::toZ3Expr(Expression const& _expr)
}
smtAssert(false, "");
// FIXME: Workaround for spurious GCC 12.1 warning (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105794)
throw exception();
}
Expression Z3Interface::fromZ3Expr(z3::expr const& _expr)
@ -379,6 +383,9 @@ Expression Z3Interface::fromZ3Expr(z3::expr const& _expr)
return Expression(_expr.decl().name().str(), arguments, fromZ3Sort(_expr.get_sort()));
smtAssert(false, "");
// FIXME: Workaround for spurious GCC 12.1 warning (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105794)
throw exception();
}
z3::sort Z3Interface::z3Sort(Sort const& _sort)

View File

@ -229,6 +229,9 @@ ASTPointer<ASTNode> ASTJsonImporter::convertJsonToASTNode(Json::Value const& _js
return createDocumentation(_json);
else
astAssert(false, "Unknown type of ASTNode: " + nodeType);
// FIXME: Workaround for spurious GCC 12.1 warning (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105794)
throw exception();
}
// ============ functions to instantiate the AST-Nodes from Json-Nodes ==============
@ -1073,6 +1076,9 @@ Visibility ASTJsonImporter::visibility(Json::Value const& _node)
return Visibility::External;
else
astAssert(false, "Unknown visibility declaration");
// FIXME: Workaround for spurious GCC 12.1 warning (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105794)
throw exception();
}
VariableDeclaration::Location ASTJsonImporter::location(Json::Value const& _node)
@ -1092,6 +1098,9 @@ VariableDeclaration::Location ASTJsonImporter::location(Json::Value const& _node
return VariableDeclaration::Location::CallData;
else
astAssert(false, "Unknown location declaration");
// FIXME: Workaround for spurious GCC 12.1 warning (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105794)
throw exception();
}
Literal::SubDenomination ASTJsonImporter::subdenomination(Json::Value const& _node)
@ -1125,6 +1134,9 @@ Literal::SubDenomination ASTJsonImporter::subdenomination(Json::Value const& _no
return Literal::SubDenomination::Year;
else
astAssert(false, "Unknown subdenomination");
// FIXME: Workaround for spurious GCC 12.1 warning (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105794)
throw exception();
}
StateMutability ASTJsonImporter::stateMutability(Json::Value const& _node)
@ -1142,6 +1154,9 @@ StateMutability ASTJsonImporter::stateMutability(Json::Value const& _node)
return StateMutability::Payable;
else
astAssert(false, "Unknown stateMutability");
// FIXME: Workaround for spurious GCC 12.1 warning (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105794)
throw exception();
}
}

View File

@ -1653,6 +1653,9 @@ ASTPointer<Statement> Parser::parseSimpleStatement(ASTPointer<ASTString> const&
solAssert(false, "");
}
}
// FIXME: Workaround for spurious GCC 12.1 warning (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105794)
throw exception();
}
bool Parser::IndexAccessedPath::empty() const

View File

@ -110,6 +110,9 @@ Statement AsmJsonImporter::createStatement(Json::Value const& _node)
return createBlock(_node);
else
yulAssert(false, "Invalid nodeType as statement");
// FIXME: Workaround for spurious GCC 12.1 warning (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105794)
throw exception();
}
Expression AsmJsonImporter::createExpression(Json::Value const& _node)
@ -129,6 +132,9 @@ Expression AsmJsonImporter::createExpression(Json::Value const& _node)
return createLiteral(_node);
else
yulAssert(false, "Invalid nodeType as expression");
// FIXME: Workaround for spurious GCC 12.1 warning (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105794)
throw exception();
}
vector<Expression> AsmJsonImporter::createExpressionVector(Json::Value const& _array)

View File

@ -371,6 +371,9 @@ private:
return true;
}
yulAssert(false, "");
// FIXME: Workaround for spurious GCC 12.1 warning (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105794)
throw std::exception();
}
};

View File

@ -276,6 +276,9 @@ unique_ptr<FitnessMetric> FitnessMetricFactory::build(
default:
assertThrow(false, solidity::util::Exception, "Invalid MetricAggregatorChoice value.");
}
// FIXME: Workaround for spurious GCC 12.1 warning (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105794)
throw exception();
}
PopulationFactory::Options PopulationFactory::Options::fromCommandLine(po::variables_map const& _arguments)