[PPL-devel] [GIT] ppl/ppl(devel): Fixed several catch declarations. Added constructors and assignment operators.
Roberto Bagnara
roberto.bagnara at bugseng.com
Tue Aug 11 15:10:06 CEST 2020
Module: ppl/ppl
Branch: devel
Commit: eb747ec58bfb48d60aef9e1ed8dea8e9ec19f2a3
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=eb747ec58bfb48d60aef9e1ed8dea8e9ec19f2a3
Author: Roberto Bagnara <roberto.bagnara at bugseng.com>
Date: Tue Aug 11 15:08:59 2020 +0200
Fixed several catch declarations. Added constructors and assignment operators.
---
src/Box_Status_idefs.hh | 3 +++
src/Linear_Form_defs.hh | 3 +++
src/Linear_Form_inlines.hh | 7 +++++++
src/OR_Matrix_defs.hh | 3 +++
src/iterator_to_const_defs.hh | 7 +++++++
src/iterator_to_const_inlines.hh | 7 +++++++
tests/Concrete_Expression/bdshape1.cc | 4 ++--
tests/Concrete_Expression/bdshape2.cc | 4 ++--
tests/Concrete_Expression/linearform1.cc | 12 ++++++------
tests/Concrete_Expression/octagonalshape1.cc | 4 ++--
tests/Concrete_Expression/octagonalshape2.cc | 4 ++--
tests/Concrete_Expression/polyhedron2.cc | 4 ++--
12 files changed, 46 insertions(+), 16 deletions(-)
diff --git a/src/Box_Status_idefs.hh b/src/Box_Status_idefs.hh
index ac4b0988b..3a70108f5 100644
--- a/src/Box_Status_idefs.hh
+++ b/src/Box_Status_idefs.hh
@@ -50,6 +50,9 @@ public:
//! Ordinary copy constructor.
Status(const Status& y);
+ //! Assignment operator.
+ constexpr Status& operator=(const Status& y) = default;
+
//! Copy constructor from a box of different type.
template <typename Other_ITV>
Status(const typename Box<Other_ITV>::Status& y);
diff --git a/src/Linear_Form_defs.hh b/src/Linear_Form_defs.hh
index df4592fdd..f3b94459d 100644
--- a/src/Linear_Form_defs.hh
+++ b/src/Linear_Form_defs.hh
@@ -266,6 +266,9 @@ public:
//! Ordinary copy constructor.
Linear_Form(const Linear_Form& f);
+ //! Assignment operator.
+ Linear_Form& operator=(const Linear_Form& f);
+
//! Destructor.
~Linear_Form();
diff --git a/src/Linear_Form_inlines.hh b/src/Linear_Form_inlines.hh
index 8f8ee0640..ed775ef12 100644
--- a/src/Linear_Form_inlines.hh
+++ b/src/Linear_Form_inlines.hh
@@ -56,6 +56,13 @@ Linear_Form<C>::Linear_Form(const Linear_Form& f)
: vec(f.vec) {
}
+template <typename C>
+inline Linear_Form<C>&
+Linear_Form<C>::operator=(const Linear_Form& f) {
+ vec = f.vec;
+ return *this;
+}
+
template <typename C>
inline
Linear_Form<C>::~Linear_Form() {
diff --git a/src/OR_Matrix_defs.hh b/src/OR_Matrix_defs.hh
index 2902e2268..0b036c613 100644
--- a/src/OR_Matrix_defs.hh
+++ b/src/OR_Matrix_defs.hh
@@ -128,6 +128,9 @@ private:
//! Default constructor: creates an invalid object that has to be assigned.
Pseudo_Row();
+ //! Copy constructor.
+ constexpr Pseudo_Row(const Pseudo_Row& y) = default;
+
//! Assignment operator.
Pseudo_Row& operator=(const Pseudo_Row& y);
diff --git a/src/iterator_to_const_defs.hh b/src/iterator_to_const_defs.hh
index 5a0c7d9c1..d7272c521 100644
--- a/src/iterator_to_const_defs.hh
+++ b/src/iterator_to_const_defs.hh
@@ -80,6 +80,9 @@ public:
//! Copy constructor.
iterator_to_const(const iterator_to_const& y);
+ //! Assignment operator.
+ iterator_to_const& operator=(const iterator_to_const& y);
+
//! Dereference operator.
reference operator*() const;
@@ -151,6 +154,10 @@ public:
//! Copy constructor.
const_iterator_to_const(const const_iterator_to_const& y);
+ //! Assignment operator.
+ constexpr const_iterator_to_const&
+ operator=(const const_iterator_to_const& y) = default;
+
//! Constructs from the corresponding non-const iterator.
const_iterator_to_const(const iterator_to_const<Container>& y);
diff --git a/src/iterator_to_const_inlines.hh b/src/iterator_to_const_inlines.hh
index 16bcd7ee2..8ea9d25c7 100644
--- a/src/iterator_to_const_inlines.hh
+++ b/src/iterator_to_const_inlines.hh
@@ -39,6 +39,13 @@ iterator_to_const<Container>::iterator_to_const(const iterator_to_const& y)
: base(y.base) {
}
+template <typename Container>
+inline iterator_to_const<Container>&
+iterator_to_const<Container>::operator=(const iterator_to_const& y) {
+ base = y.base;
+ return *this;
+}
+
template <typename Container>
inline
iterator_to_const<Container>::iterator_to_const(const Base& b)
diff --git a/tests/Concrete_Expression/bdshape1.cc b/tests/Concrete_Expression/bdshape1.cc
index 810a4a337..59afa3a03 100644
--- a/tests/Concrete_Expression/bdshape1.cc
+++ b/tests/Concrete_Expression/bdshape1.cc
@@ -37,7 +37,7 @@ test01() {
try {
bd1.affine_form_image(A, l);
}
- catch(std::invalid_argument e) {
+ catch(std::invalid_argument& e) {
nout << "bd1_space_dim < lf_space_dim" << endl;
ok1 = true;
}
@@ -48,7 +48,7 @@ test01() {
try {
bd2.affine_form_image(B, l);
}
- catch(std::invalid_argument e) {
+ catch(std::invalid_argument& e) {
nout << "space_dim < var_id + 1" << endl;
bd2.affine_form_image(A, l);
Constraint_System cs(A < A);
diff --git a/tests/Concrete_Expression/bdshape2.cc b/tests/Concrete_Expression/bdshape2.cc
index ac231dba1..155706ad8 100644
--- a/tests/Concrete_Expression/bdshape2.cc
+++ b/tests/Concrete_Expression/bdshape2.cc
@@ -38,7 +38,7 @@ test01() {
bd1.refine_with_linear_form_inequality(l1,l2);
std::cout <<"no eccezione" <<std::endl;
}
- catch(std::invalid_argument e) {
+ catch(std::invalid_argument& e) {
ok1 = true;
}
@@ -48,7 +48,7 @@ test01() {
bd1.refine_with_linear_form_inequality(l2,l1);
std::cout <<"no eccezione" <<std::endl;
}
- catch(std::invalid_argument e){
+ catch(std::invalid_argument& e){
FP_BD_Shape bd2(1);
bd2.refine_with_linear_form_inequality(l1, l1);
bd2.refine_with_linear_form_inequality(-l1, l1);
diff --git a/tests/Concrete_Expression/linearform1.cc b/tests/Concrete_Expression/linearform1.cc
index 7ccb1fb90..baa73276e 100644
--- a/tests/Concrete_Expression/linearform1.cc
+++ b/tests/Concrete_Expression/linearform1.cc
@@ -230,7 +230,7 @@ test08() {
try {
f = FP_Linear_Form(A);
}
- catch(std::length_error e) {
+ catch(std::length_error& e) {
nout << "Overflow in Linear_Form(const Variable v)." << endl;
ok1 = true;
}
@@ -239,7 +239,7 @@ test08() {
try {
f += A;
}
- catch(std::length_error e) {
+ catch(std::length_error& e) {
nout << "Overflow in operator+=(Linear_Form<C>& f, const Variable v)."
<< endl;
ok2 = true;
@@ -249,7 +249,7 @@ test08() {
try {
f -= A;
}
- catch(std::length_error e) {
+ catch(std::length_error& e) {
nout << "Overflow in operator-=(Linear_Form<C>& f, const Variable v)."
<< endl;
Variable B(1);
@@ -264,7 +264,7 @@ test08() {
try {
g = f - A;
}
- catch(std::length_error e) {
+ catch(std::length_error& e) {
nout << "Overflow in operator-(Linear_Form<C>& f, const Variable v)."
<< endl;
ok4 = true;
@@ -274,7 +274,7 @@ test08() {
try {
g = A - f;
}
- catch(std::length_error e) {
+ catch(std::length_error& e) {
nout << "Overflow in operator-(const Variable v, Linear_Form<C>& f)."
<< endl;
ok5 = true;
@@ -284,7 +284,7 @@ test08() {
try {
g = A + f;
}
- catch(std::length_error e) {
+ catch(std::length_error& e) {
nout << "Overflow in operator+(const Variable v, Linear_Form<C>& f)."
<< endl;
ok6 = true;
diff --git a/tests/Concrete_Expression/octagonalshape1.cc b/tests/Concrete_Expression/octagonalshape1.cc
index 0c0c68845..9b9b66756 100644
--- a/tests/Concrete_Expression/octagonalshape1.cc
+++ b/tests/Concrete_Expression/octagonalshape1.cc
@@ -37,7 +37,7 @@ test01() {
try {
oc1.affine_form_image(A, l);
}
- catch(std::invalid_argument e) {
+ catch(std::invalid_argument& e) {
nout << "oc1_space_dim < lf_space_dim" << endl;
ok1 = true;
}
@@ -48,7 +48,7 @@ test01() {
try {
oc2.affine_form_image(B, l);
}
- catch(std::invalid_argument e) {
+ catch(std::invalid_argument& e) {
nout << "space_dim < var_id + 1" << endl;
oc2.affine_form_image(A, l);
Constraint_System cs(A < A);
diff --git a/tests/Concrete_Expression/octagonalshape2.cc b/tests/Concrete_Expression/octagonalshape2.cc
index 1f83ac3de..a3b10fd94 100644
--- a/tests/Concrete_Expression/octagonalshape2.cc
+++ b/tests/Concrete_Expression/octagonalshape2.cc
@@ -37,7 +37,7 @@ test01() {
try {
oc1.refine_with_linear_form_inequality(l1, l2);
}
- catch(std::invalid_argument e) {
+ catch(std::invalid_argument& e) {
nout << "space_dim < left_space_dim" << endl;
ok1 = true;
}
@@ -46,7 +46,7 @@ test01() {
try {
oc1.refine_with_linear_form_inequality(l2, l1);
}
- catch(std::invalid_argument e) {
+ catch(std::invalid_argument& e) {
nout << "space_dim < right_space_dim" << endl;
FP_Octagonal_Shape oc2(1);
oc2.refine_with_linear_form_inequality(l1, l1);
diff --git a/tests/Concrete_Expression/polyhedron2.cc b/tests/Concrete_Expression/polyhedron2.cc
index 4b80c565e..a3a760807 100644
--- a/tests/Concrete_Expression/polyhedron2.cc
+++ b/tests/Concrete_Expression/polyhedron2.cc
@@ -38,13 +38,13 @@ test01() {
FP_Linear_Form l2;
pol.refine_with_linear_form_inequality(l1, l2);
}
- catch (std::invalid_argument) {
+ catch (std::invalid_argument&) {
try {
FP_Linear_Form l1;
FP_Linear_Form l2(Variable(3));
pol.refine_with_linear_form_inequality(l1, l2);
}
- catch (std::invalid_argument) {
+ catch (std::invalid_argument&) {
nout << "incompatible dimensions." << endl;
return true;
}
More information about the PPL-devel
mailing list