[PPL-devel] [GIT] ppl/ppl(devel): Empty expression statements avoided.
Roberto Bagnara
roberto.bagnara at bugseng.com
Sat Aug 8 19:44:05 CEST 2020
Module: ppl/ppl
Branch: devel
Commit: f8e843267a401af6215fbda4fcb76cc13ec67fe0
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=f8e843267a401af6215fbda4fcb76cc13ec67fe0
Author: Roberto Bagnara <roberto.bagnara at bugseng.com>
Date: Sat Aug 8 19:43:58 2020 +0200
Empty expression statements avoided.
---
tests/BD_Shape/constrains1.cc | 26 +++++++++++--------
tests/Box/constrains1.cc | 26 +++++++++++--------
tests/Octagonal_Shape/constrains1.cc | 26 +++++++++++--------
tests/Partially_Reduced_Product/bounds1.cc | 2 +-
tests/Polyhedron/maxspacedim1.cc | 40 ++++++++++++++++++------------
5 files changed, 70 insertions(+), 50 deletions(-)
diff --git a/tests/BD_Shape/constrains1.cc b/tests/BD_Shape/constrains1.cc
index 9493731ad..d085325ac 100644
--- a/tests/BD_Shape/constrains1.cc
+++ b/tests/BD_Shape/constrains1.cc
@@ -23,17 +23,21 @@ site: http://bugseng.com/products/ppl/ . */
#include "ppl_test.hh"
-#define TEST_PREDICATE_TRUE(pred) \
- if (!pred) { \
- nout << "!" #pred << endl; \
- ok = false; \
- }
-
-#define TEST_PREDICATE_FALSE(pred) \
- if (pred) { \
- nout << #pred << endl; \
- ok = false; \
- }
+#define TEST_PREDICATE_TRUE(pred) \
+ do { \
+ if (!pred) { \
+ nout << "!" #pred << endl; \
+ ok = false; \
+ } \
+ } while (false)
+
+#define TEST_PREDICATE_FALSE(pred) \
+ do { \
+ if (pred) { \
+ nout << #pred << endl; \
+ ok = false; \
+ } \
+ } while (false)
namespace {
diff --git a/tests/Box/constrains1.cc b/tests/Box/constrains1.cc
index 0284b33d2..2dd551b04 100644
--- a/tests/Box/constrains1.cc
+++ b/tests/Box/constrains1.cc
@@ -23,17 +23,21 @@ site: http://bugseng.com/products/ppl/ . */
#include "ppl_test.hh"
-#define TEST_PREDICATE_TRUE(pred) \
- if (!pred) { \
- nout << "!" #pred << endl; \
- ok = false; \
- }
-
-#define TEST_PREDICATE_FALSE(pred) \
- if (pred) { \
- nout << #pred << endl; \
- ok = false; \
- }
+#define TEST_PREDICATE_TRUE(pred) \
+ do { \
+ if (!pred) { \
+ nout << "!" #pred << endl; \
+ ok = false; \
+ } \
+ } while (false)
+
+#define TEST_PREDICATE_FALSE(pred) \
+ do { \
+ if (pred) { \
+ nout << #pred << endl; \
+ ok = false; \
+ } \
+ } while (false)
namespace {
diff --git a/tests/Octagonal_Shape/constrains1.cc b/tests/Octagonal_Shape/constrains1.cc
index f5d8d56ea..00b4c5287 100644
--- a/tests/Octagonal_Shape/constrains1.cc
+++ b/tests/Octagonal_Shape/constrains1.cc
@@ -23,17 +23,21 @@ site: http://bugseng.com/products/ppl/ . */
#include "ppl_test.hh"
-#define TEST_PREDICATE_TRUE(pred) \
- if (!pred) { \
- nout << "!" #pred << endl; \
- ok = false; \
- }
-
-#define TEST_PREDICATE_FALSE(pred) \
- if (pred) { \
- nout << #pred << endl; \
- ok = false; \
- }
+#define TEST_PREDICATE_TRUE(pred) \
+ do { \
+ if (!pred) { \
+ nout << "!" #pred << endl; \
+ ok = false; \
+ } \
+ } while (false)
+
+#define TEST_PREDICATE_FALSE(pred) \
+ do { \
+ if (pred) { \
+ nout << #pred << endl; \
+ ok = false; \
+ } \
+ } while (false)
namespace {
diff --git a/tests/Partially_Reduced_Product/bounds1.cc b/tests/Partially_Reduced_Product/bounds1.cc
index 1ae3d2f03..2fb4284f1 100644
--- a/tests/Partially_Reduced_Product/bounds1.cc
+++ b/tests/Partially_Reduced_Product/bounds1.cc
@@ -252,7 +252,7 @@ test11() {
prp.refine_with_constraint(A - B <= 1);
#endif
prp.refine_with_congruence(3*B %= 2);
-;
+
Linear_Expression le = A - B;
Coefficient max_n;
diff --git a/tests/Polyhedron/maxspacedim1.cc b/tests/Polyhedron/maxspacedim1.cc
index b593686d8..176212670 100644
--- a/tests/Polyhedron/maxspacedim1.cc
+++ b/tests/Polyhedron/maxspacedim1.cc
@@ -23,26 +23,29 @@ site: http://bugseng.com/products/ppl/ . */
#include "ppl_test.hh"
-#define test01_DO_CLASS(T) \
- nout << #T "::max_space_dimension() = " \
- << T::max_space_dimension() << endl; \
- if (T::max_space_dimension() < max_space_dimension()) \
- return false
+#define test01_DO_CLASS(T) \
+ do { \
+ nout << #T "::max_space_dimension() = " \
+ << T::max_space_dimension() << endl; \
+ if (T::max_space_dimension() < max_space_dimension()) { \
+ return false; \
+ } \
+ } while (false)
#if PPL_SUPPORTED_FLOAT
#define test01_DO_WRD_FLOAT(WRD) test01_DO_CLASS(WRD<float>)
#else
-#define test01_DO_WRD_FLOAT(WRD)
+#define test01_DO_WRD_FLOAT(WRD) do { } while (false)
#endif
#if PPL_SUPPORTED_DOUBLE
#define test01_DO_WRD_DOUBLE(WRD) test01_DO_CLASS(WRD<double>)
#else
-#define test01_DO_WRD_DOUBLE(WRD)
+#define test01_DO_WRD_DOUBLE(WRD) do { } while (false)
#endif
#if PPL_SUPPORTED_LONG_DOUBLE
#define test01_DO_WRD_LONG_DOUBLE(WRD) test01_DO_CLASS(WRD<long double>)
#else
-#define test01_DO_WRD_LONG_DOUBLE(WRD)
+#define test01_DO_WRD_LONG_DOUBLE(WRD) do { } while (false)
#endif
#define test01_DO_WRD(WRD) \
@@ -57,28 +60,34 @@ site: http://bugseng.com/products/ppl/ . */
test01_DO_WRD_LONG_DOUBLE(WRD)
#define test01_DO_CONSTR_CLASS(CONSTR, T) \
- nout << #CONSTR "<" #T ">::max_space_dimension() = " \
- << CONSTR<T>::max_space_dimension() << endl; \
- if (CONSTR<T>::max_space_dimension() < max_space_dimension()) \
- return false
+ do { \
+ nout << #CONSTR "<" #T ">::max_space_dimension() = " \
+ << CONSTR<T>::max_space_dimension() << endl; \
+ if (CONSTR<T>::max_space_dimension() < max_space_dimension()) { \
+ return false; \
+ } \
+ } while (false)
#if PPL_SUPPORTED_FLOAT
#define test01_DO_CONSTR_WRD_FLOAT(CONSTR, WRD) \
test01_DO_CONSTR_CLASS(CONSTR, WRD<float>)
#else
-#define test01_DO_CONSTR_WRD_FLOAT(CONSTR, WRD)
+#define test01_DO_CONSTR_WRD_FLOAT(CONSTR, WRD) \
+ do { } while (false)
#endif
#if PPL_SUPPORTED_DOUBLE
#define test01_DO_CONSTR_WRD_DOUBLE(CONSTR, WRD) \
test01_DO_CONSTR_CLASS(CONSTR, WRD<double>)
#else
-#define test01_DO_CONSTR_WRD_DOUBLE(CONSTR, WRD)
+#define test01_DO_CONSTR_WRD_DOUBLE(CONSTR, WRD) \
+ do { } while (false)
#endif
#if PPL_SUPPORTED_LONG_DOUBLE
#define test01_DO_CONSTR_WRD_LONG_DOUBLE(CONSTR, WRD) \
test01_DO_CONSTR_CLASS(CONSTR, WRD<long double>)
#else
-#define test01_DO_CONSTR_WRD_LONG_DOUBLE(CONSTR, WRD)
+#define test01_DO_CONSTR_WRD_LONG_DOUBLE(CONSTR, WRD) \
+ do { } while (false)
#endif
#define test01_DO_CONSTR_WRD(CONSTR, WRD) \
@@ -134,4 +143,3 @@ test01() {
BEGIN_MAIN
DO_TEST(test01);
END_MAIN
-
More information about the PPL-devel
mailing list