From bb9a899b7c45b830c6b70e2811130a41ebb31ee5 Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Thu, 20 Sep 2012 15:19:49 +1000 Subject: Remove exceptions and C++11 features for LLVM. --- impl/Complete.hpp | 3 ++- impl/EquationSystem.hpp | 6 ++++-- impl/IdMap.hpp | 6 ++++-- impl/Log.hpp | 1 + impl/Makefile | 2 +- impl/MaxStrategy.hpp | 24 ++++++++++++++---------- impl/Operator.hpp | 2 +- impl/VariableAssignment.hpp | 6 +++--- impl/gmon.out | Bin 0 -> 82849 bytes impl/systems/1 | 0 impl/systems/gmon.out | Bin 0 -> 82405 bytes impl/systems/test.eqns | 4 ++++ 12 files changed, 34 insertions(+), 20 deletions(-) create mode 100644 impl/gmon.out create mode 100644 impl/systems/1 create mode 100644 impl/systems/gmon.out create mode 100644 impl/systems/test.eqns diff --git a/impl/Complete.hpp b/impl/Complete.hpp index 81ced52..5219c9e 100644 --- a/impl/Complete.hpp +++ b/impl/Complete.hpp @@ -16,7 +16,8 @@ struct Complete { Complete(const T& value, const bool& infinity) : _value(value), _infinity(infinity) { if (value == 0 && infinity == true) { - throw "Zero infinity? Die die die!"; + std::cout << "throw exception" << *(char*)NULL; + //throw "Zero infinity? Die die die!"; } } Complete(const Complete& other) diff --git a/impl/EquationSystem.hpp b/impl/EquationSystem.hpp index 4c55bd7..c0734aa 100644 --- a/impl/EquationSystem.hpp +++ b/impl/EquationSystem.hpp @@ -97,14 +97,16 @@ struct EquationSystem { Variable* varFromExpr(const Expression& expr) const { if (_expr_to_var) { // we've indexed: - auto* maxExpr = dynamic_cast*>(&expr); + const MaxExpression* maxExpr = dynamic_cast*>(&expr); if (maxExpr) { return (*_expr_to_var)[*maxExpr]; } else { return NULL; } } else { - throw "Must index max expressions before attempting lookup"; + std::cout << "throw exception" << *(char*)NULL; + return NULL; + //throw "Must index max expressions before attempting lookup"; } } diff --git a/impl/IdMap.hpp b/impl/IdMap.hpp index b265e37..27c0806 100644 --- a/impl/IdMap.hpp +++ b/impl/IdMap.hpp @@ -33,13 +33,15 @@ struct IdMap { } virtual const V& operator[] (const T& x) const { if (x.id() >= _length) { - throw "Array out of bounds"; + std::cout << "throw exception" << *(char*)NULL; + //throw "Array out of bounds"; } return _assignment[x.id()]; } virtual V& operator[] (const T& x) { if (x.id() >= _length) { - throw "Array out of bounds"; + std::cout << "throw exception" << *(char*)NULL; + //throw "Array out of bounds"; } return _assignment[x.id()]; } diff --git a/impl/Log.hpp b/impl/Log.hpp index b595105..f7fe6b6 100644 --- a/impl/Log.hpp +++ b/impl/Log.hpp @@ -9,6 +9,7 @@ #include #include #include +#include namespace log { diff --git a/impl/Makefile b/impl/Makefile index 213657b..6fc6f3b 100644 --- a/impl/Makefile +++ b/impl/Makefile @@ -2,7 +2,7 @@ CC=gcc CPP=g++ BUILD=build PARSER=parser -FLAGS=-Wall -Werror -Wextra -pedantic -lantlr3c -std=c++11 +FLAGS=-Wall -Werror -Wextra -pedantic -lantlr3c -fno-exceptions NORMAL_FLAGS=$(FLAGS) -g -pg OPTIMISED_FLAGS=$(FLAGS) -O3 diff --git a/impl/MaxStrategy.hpp b/impl/MaxStrategy.hpp index d15884c..667c127 100644 --- a/impl/MaxStrategy.hpp +++ b/impl/MaxStrategy.hpp @@ -36,9 +36,9 @@ struct DynamicMaxStrategy : public MaxStrategy { _values(system.maxExpressionCount(), 0), _stable(system.maxExpressionCount()), _influence(system.maxExpressionCount(), - IdSet>(system.maxExpressionCount())), + IdSet >(system.maxExpressionCount())), _var_influence(system.variableCount(), - IdSet>(system.maxExpressionCount())) + IdSet >(system.maxExpressionCount())) {} void setRho(DynamicVariableAssignment& rho) { @@ -54,8 +54,10 @@ struct DynamicMaxStrategy : public MaxStrategy { log::strategy << indent() << "Invalidating " << v << " - " << *_system[v] << std::endl; _stable.filter(_var_influence[v]); - for (auto it = _var_influence[v].begin(); - it != _var_influence[v].end(); + for (typename IdSet >::iterator + it = _var_influence[v].begin(), + end = _var_influence[v].end(); + it != end; ++it) { solve(_system.maxExpression(*it)); } @@ -75,7 +77,7 @@ private: if (val != _values[x]) { log::strategy << x << " => " << *x.arguments()[val] << std::endl; - auto oldInfluence = _influence[x]; + IdSet > oldInfluence = _influence[x]; _influence[x].clear(); _values[x] = val; @@ -83,8 +85,10 @@ private: _stable.filter(oldInfluence); - for (auto it = oldInfluence.begin(); - it != oldInfluence.end(); + for (typename IdSet >::iterator + it = oldInfluence.begin(), + end = oldInfluence.end(); + it != end; ++it) { solve(_system.maxExpression(*it)); } @@ -135,9 +139,9 @@ private: const EquationSystem& _system; mutable DynamicVariableAssignment* _rho; mutable IdMap,unsigned int> _values; - mutable IdSet> _stable; - mutable IdMap,IdSet>> _influence; - mutable IdMap,IdSet>> _var_influence; + mutable IdSet > _stable; + mutable IdMap,IdSet > > _influence; + mutable IdMap,IdSet > > _var_influence; }; /*template diff --git a/impl/Operator.hpp b/impl/Operator.hpp index e8d6ca7..b67591f 100644 --- a/impl/Operator.hpp +++ b/impl/Operator.hpp @@ -95,7 +95,7 @@ template struct Multiplication : public Operator { virtual Domain eval(const std::vector& arguments) const { Domain result = 1; - for (auto it = arguments.begin(), + for (typename std::vector::const_iterator it = arguments.begin(), end = arguments.end(); it != end; ++it) { diff --git a/impl/VariableAssignment.hpp b/impl/VariableAssignment.hpp index 371ba56..69eeef2 100644 --- a/impl/VariableAssignment.hpp +++ b/impl/VariableAssignment.hpp @@ -25,7 +25,7 @@ struct DynamicVariableAssignment : public VariableAssignment { _values(system.variableCount(), infinity()), _stable(system.variableCount()), _influence(system.variableCount(), - IdSet>(system.variableCount())) + IdSet >(system.variableCount())) { } const Domain& operator[](const Variable& var) const { @@ -54,7 +54,7 @@ private: if (val != _values[x]) { log::fixpoint << x << " = " << val << std::endl; - auto oldInfluence = _influence[x]; + IdSet > oldInfluence = _influence[x]; _influence[x].clear(); _values[x] = val; @@ -62,7 +62,7 @@ private: _stable.filter(oldInfluence); - for (auto it = oldInfluence.begin(); + for (typename IdSet >::iterator it = oldInfluence.begin(); it != oldInfluence.end(); ++it) { solve(_system.variable(*it)); diff --git a/impl/gmon.out b/impl/gmon.out new file mode 100644 index 0000000..2c22b41 Binary files /dev/null and b/impl/gmon.out differ diff --git a/impl/systems/1 b/impl/systems/1 new file mode 100644 index 0000000..e69de29 diff --git a/impl/systems/gmon.out b/impl/systems/gmon.out new file mode 100644 index 0000000..4cb3fe1 Binary files /dev/null and b/impl/systems/gmon.out differ diff --git a/impl/systems/test.eqns b/impl/systems/test.eqns new file mode 100644 index 0000000..cc554d5 --- /dev/null +++ b/impl/systems/test.eqns @@ -0,0 +1,4 @@ +xup = max(0, min(xup + 1, 9 + 1)) +yup = max(0, min(xup + yup, 9 + yup)) +xlow = max(0, xlow-1) +ylow = max(0, ylow + xlow) -- cgit v1.2.3