Browse Source

Throw exceptions after switch/case to silence compiler warnings about not returning anything

tempestpy_adaptions
Matthias Volk 6 years ago
parent
commit
685b5c6b27
  1. 4
      src/storm-pomdp/storage/PomdpMemory.cpp
  2. 4
      src/storm/logic/Bound.h
  3. 5
      src/storm/logic/ComparisonType.h
  4. 3
      src/storm/modelchecker/results/FilterType.cpp
  5. 4
      src/storm/solver/LinearEquationSolverRequirements.cpp
  6. 4
      src/storm/solver/MinMaxLinearEquationSolverRequirements.cpp
  7. 2
      src/storm/solver/Multiplier.cpp
  8. 2
      src/storm/storage/dd/bisimulation/SignatureComputer.cpp
  9. 8
      src/storm/storage/jani/JSONExporter.cpp
  10. 5
      src/storm/utility/builder.cpp

4
src/storm-pomdp/storage/PomdpMemory.cpp

@ -2,6 +2,7 @@
#include "storm/utility/macros.h" #include "storm/utility/macros.h"
#include "storm/exceptions/InvalidArgumentException.h" #include "storm/exceptions/InvalidArgumentException.h"
#include "storm/exceptions/IllegalArgumentException.h"
namespace storm { namespace storm {
namespace storage { namespace storage {
@ -110,6 +111,7 @@ namespace storm {
case PomdpMemoryPattern::Full: case PomdpMemoryPattern::Full:
return buildFullyConnectedMemory(numStates); return buildFullyConnectedMemory(numStates);
} }
STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentException, "Unknown PomdpMemoryPattern");
} }
PomdpMemory PomdpMemoryBuilder::buildTrivialMemory() const { PomdpMemory PomdpMemoryBuilder::buildTrivialMemory() const {
@ -177,4 +179,4 @@ namespace storm {
return PomdpMemory(transitions, 0); return PomdpMemory(transitions, 0);
} }
} }
}
}

4
src/storm/logic/Bound.h

@ -1,10 +1,11 @@
#ifndef STORM_LOGIC_BOUND_H_ #ifndef STORM_LOGIC_BOUND_H_
#define STORM_LOGIC_BOUND_H_ #define STORM_LOGIC_BOUND_H_
#include "storm/exceptions/IllegalArgumentException.h"
#include "storm/logic/ComparisonType.h" #include "storm/logic/ComparisonType.h"
#include "storm/storage/expressions/Expression.h" #include "storm/storage/expressions/Expression.h"
#include "storm/utility/constants.h" #include "storm/utility/constants.h"
#include "storm/utility/macros.h"
namespace storm { namespace storm {
namespace logic { namespace logic {
@ -29,6 +30,7 @@ namespace storm {
case ComparisonType::LessEqual: case ComparisonType::LessEqual:
return compareValue <= thresholdAsValueType; return compareValue <= thresholdAsValueType;
} }
STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentException, "Unknown ComparisonType");
} }
friend std::ostream& operator<<(std::ostream& out, Bound const& bound); friend std::ostream& operator<<(std::ostream& out, Bound const& bound);

5
src/storm/logic/ComparisonType.h

@ -3,6 +3,9 @@
#include <iostream> #include <iostream>
#include "storm/utility/macros.h"
#include "storm/exceptions/IllegalArgumentException.h"
namespace storm { namespace storm {
namespace logic { namespace logic {
enum class ComparisonType { Less, LessEqual, Greater, GreaterEqual }; enum class ComparisonType { Less, LessEqual, Greater, GreaterEqual };
@ -26,6 +29,7 @@ namespace storm {
case ComparisonType::GreaterEqual: case ComparisonType::GreaterEqual:
return ComparisonType::Less; return ComparisonType::Less;
} }
STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentException, "Unknown ComparisonType");
} }
inline ComparisonType invertPreserveStrictness(ComparisonType t) { inline ComparisonType invertPreserveStrictness(ComparisonType t) {
@ -39,6 +43,7 @@ namespace storm {
case ComparisonType::GreaterEqual: case ComparisonType::GreaterEqual:
return ComparisonType::LessEqual; return ComparisonType::LessEqual;
} }
STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentException, "Unknown ComparisonType");
} }
std::ostream& operator<<(std::ostream& out, ComparisonType const& comparisonType); std::ostream& operator<<(std::ostream& out, ComparisonType const& comparisonType);

3
src/storm/modelchecker/results/FilterType.cpp

@ -1,5 +1,7 @@
#include "FilterType.h" #include "FilterType.h"
#include "storm/utility/macros.h"
#include "storm/exceptions/IllegalArgumentException.h"
namespace storm { namespace storm {
namespace modelchecker { namespace modelchecker {
@ -27,6 +29,7 @@ namespace storm {
case FilterType::VALUES: case FilterType::VALUES:
return "the values"; return "the values";
} }
STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentException, "Unknown FilterType");
} }
} }
} }

4
src/storm/solver/LinearEquationSolverRequirements.cpp

@ -1,5 +1,8 @@
#include "storm/solver/LinearEquationSolverRequirements.h" #include "storm/solver/LinearEquationSolverRequirements.h"
#include "storm/utility/macros.h"
#include "storm/exceptions/IllegalArgumentException.h"
namespace storm { namespace storm {
namespace solver { namespace solver {
@ -36,6 +39,7 @@ namespace storm {
case Element::LowerBounds: return lowerBounds(); break; case Element::LowerBounds: return lowerBounds(); break;
case Element::UpperBounds: return upperBounds(); break; case Element::UpperBounds: return upperBounds(); break;
} }
STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentException, "Unknown ElementType");
} }
void LinearEquationSolverRequirements::clearLowerBounds() { void LinearEquationSolverRequirements::clearLowerBounds() {

4
src/storm/solver/MinMaxLinearEquationSolverRequirements.cpp

@ -1,5 +1,8 @@
#include "storm/solver/MinMaxLinearEquationSolverRequirements.h" #include "storm/solver/MinMaxLinearEquationSolverRequirements.h"
#include "storm/utility/macros.h"
#include "storm/exceptions/IllegalArgumentException.h"
namespace storm { namespace storm {
namespace solver { namespace solver {
@ -56,6 +59,7 @@ namespace storm {
case Element::LowerBounds: return lowerBounds(); break; case Element::LowerBounds: return lowerBounds(); break;
case Element::UpperBounds: return upperBounds(); break; case Element::UpperBounds: return upperBounds(); break;
} }
STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentException, "Unknown ElementType");
} }
void MinMaxLinearEquationSolverRequirements::clearUniqueSolution() { void MinMaxLinearEquationSolverRequirements::clearUniqueSolution() {

2
src/storm/solver/Multiplier.cpp

@ -12,6 +12,7 @@
#include "storm/solver/NativeMultiplier.h" #include "storm/solver/NativeMultiplier.h"
#include "storm/solver/GmmxxMultiplier.h" #include "storm/solver/GmmxxMultiplier.h"
#include "storm/environment/solver/MultiplierEnvironment.h" #include "storm/environment/solver/MultiplierEnvironment.h"
#include "storm/exceptions/IllegalArgumentException.h"
namespace storm { namespace storm {
namespace solver { namespace solver {
@ -79,6 +80,7 @@ namespace storm {
case MultiplierType::Native: case MultiplierType::Native:
return std::make_unique<NativeMultiplier<ValueType>>(matrix); return std::make_unique<NativeMultiplier<ValueType>>(matrix);
} }
STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentException, "Unknown MultiplierType");
} }
template class Multiplier<double>; template class Multiplier<double>;

2
src/storm/storage/dd/bisimulation/SignatureComputer.cpp

@ -6,6 +6,7 @@
#include "storm/utility/macros.h" #include "storm/utility/macros.h"
#include "storm/exceptions/OutOfRangeException.h" #include "storm/exceptions/OutOfRangeException.h"
#include "storm/exceptions/IllegalArgumentException.h"
namespace storm { namespace storm {
namespace dd { namespace dd {
@ -23,6 +24,7 @@ namespace storm {
case SignatureMode::Eager: return position < 1; case SignatureMode::Eager: return position < 1;
case SignatureMode::Lazy: return position < 2; case SignatureMode::Lazy: return position < 2;
} }
STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentException, "Unknown SignatureMode");
} }
template<storm::dd::DdType DdType, typename ValueType> template<storm::dd::DdType DdType, typename ValueType>

8
src/storm/storage/jani/JSONExporter.cpp

@ -12,6 +12,7 @@
#include "storm/exceptions/InvalidJaniException.h" #include "storm/exceptions/InvalidJaniException.h"
#include "storm/exceptions/NotImplementedException.h" #include "storm/exceptions/NotImplementedException.h"
#include "storm/exceptions/InvalidPropertyException.h" #include "storm/exceptions/InvalidPropertyException.h"
#include "storm/exceptions/IllegalArgumentException.h"
#include "storm/storage/expressions/RationalLiteralExpression.h" #include "storm/storage/expressions/RationalLiteralExpression.h"
#include "storm/storage/expressions/IntegerLiteralExpression.h" #include "storm/storage/expressions/IntegerLiteralExpression.h"
@ -120,9 +121,8 @@ namespace storm {
return ">"; return ">";
case storm::logic::ComparisonType::GreaterEqual: case storm::logic::ComparisonType::GreaterEqual:
return ""; return "";
default:
assert(false);
} }
STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentException, "Unknown ComparisonType");
} }
modernjson::json numberToJson(storm::RationalNumber rn) { modernjson::json numberToJson(storm::RationalNumber rn) {
@ -1104,10 +1104,8 @@ namespace storm {
return "argmax"; return "argmax";
case storm::modelchecker::FilterType::VALUES: case storm::modelchecker::FilterType::VALUES:
return "values"; return "values";
default:
assert(false);
} }
STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentException, "Unknown FilterType");
} }
modernjson::json convertFilterExpression(storm::jani::FilterExpression const& fe, storm::jani::Model const& model, storm::jani::ModelFeatures& modelFeatures) { modernjson::json convertFilterExpression(storm::jani::FilterExpression const& fe, storm::jani::Model const& model, storm::jani::ModelFeatures& modelFeatures) {

5
src/storm/utility/builder.cpp

@ -7,6 +7,8 @@
#include "storm/models/sparse/Pomdp.h" #include "storm/models/sparse/Pomdp.h"
#include "storm/models/sparse/MarkovAutomaton.h" #include "storm/models/sparse/MarkovAutomaton.h"
#include "storm/exceptions/InvalidModelException.h"
namespace storm { namespace storm {
namespace utility { namespace utility {
namespace builder { namespace builder {
@ -27,6 +29,7 @@ namespace storm {
case storm::models::ModelType::S2pg: case storm::models::ModelType::S2pg:
return std::make_shared<storm::models::sparse::StochasticTwoPlayerGame<ValueType, RewardModelType>>(std::move(components)); return std::make_shared<storm::models::sparse::StochasticTwoPlayerGame<ValueType, RewardModelType>>(std::move(components));
} }
STORM_LOG_THROW(false, storm::exceptions::InvalidModelException, "Unknown model type");
} }
template std::shared_ptr<storm::models::sparse::Model<double>> buildModelFromComponents(storm::models::ModelType modelType, storm::storage::sparse::ModelComponents<double>&& components); template std::shared_ptr<storm::models::sparse::Model<double>> buildModelFromComponents(storm::models::ModelType modelType, storm::storage::sparse::ModelComponents<double>&& components);
@ -35,4 +38,4 @@ namespace storm {
template std::shared_ptr<storm::models::sparse::Model<storm::RationalFunction>> buildModelFromComponents(storm::models::ModelType modelType, storm::storage::sparse::ModelComponents<storm::RationalFunction>&& components); template std::shared_ptr<storm::models::sparse::Model<storm::RationalFunction>> buildModelFromComponents(storm::models::ModelType modelType, storm::storage::sparse::ModelComponents<storm::RationalFunction>&& components);
} }
} }
}
}
Loading…
Cancel
Save