[PPL-devel] [GIT] ppl/ppl(compliance): Added missing braces. Fixes violations of rule MP1.6-3-1 detected by ECLAIR.

Patrik Pomelli patrik.pomelli at bugseng.com
Mon Jun 30 07:22:59 CEST 2014


Module: ppl/ppl
Branch: compliance
Commit: 36d6c98178210d2180d25997fd40a2431f59a1af
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=36d6c98178210d2180d25997fd40a2431f59a1af

Author: Patrik Pomelli <patrik.pomelli at bugseng.com>
Date:   Mon Jun 30 02:32:03 2014 +0200

Added missing braces. Fixes violations of rule MP1.6-3-1 detected by ECLAIR.

Signed-off-by: Roberto Bagnara <roberto.bagnara at bugseng.com>

---

 src/Generator_System_inlines.hh        |    3 ++-
 src/Linear_System_templates.hh         |    3 ++-
 src/MIP_Problem.cc                     |    4 ++--
 src/Polyhedron_conversion_templates.hh |    3 ++-
 src/Polyhedron_minimize_templates.hh   |    3 ++-
 5 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/Generator_System_inlines.hh b/src/Generator_System_inlines.hh
index 74d8427..2fa2294 100644
--- a/src/Generator_System_inlines.hh
+++ b/src/Generator_System_inlines.hh
@@ -104,8 +104,9 @@ Generator_System::set_space_dimension(dimension_type space_dim) {
   }
 
 #ifndef NDEBUG
-  for (dimension_type i = 0; i < sys.num_rows(); ++i)
+  for (dimension_type i = 0; i < sys.num_rows(); ++i) {
     PPL_ASSERT(sys[i].OK());
+  }
 #endif
   PPL_ASSERT(sys.OK());
   PPL_ASSERT(OK());
diff --git a/src/Linear_System_templates.hh b/src/Linear_System_templates.hh
index 752b588..1e00935 100644
--- a/src/Linear_System_templates.hh
+++ b/src/Linear_System_templates.hh
@@ -569,8 +569,9 @@ Linear_System<Row>::gauss(const dimension_type n_lines_or_equalities) {
   PPL_ASSERT(num_pending_rows() == 0);
   PPL_ASSERT(n_lines_or_equalities == num_lines_or_equalities());
 #ifndef NDEBUG
-  for (dimension_type i = n_lines_or_equalities; i-- > 0; )
+  for (dimension_type i = n_lines_or_equalities; i-- > 0; ) {
     PPL_ASSERT((*this)[i].is_line_or_equality());
+  }
 #endif
 
   dimension_type rank = 0;
diff --git a/src/MIP_Problem.cc b/src/MIP_Problem.cc
index c1ada16..3494b59 100644
--- a/src/MIP_Problem.cc
+++ b/src/MIP_Problem.cc
@@ -1675,7 +1675,7 @@ PPL::MIP_Problem::erase_artificials(const dimension_type begin_artificials,
   const dimension_type old_last_column = tableau.num_columns() - 1;
   dimension_type tableau_n_rows = tableau.num_rows();
   // Step 1: try to remove from the base all the remaining slack variables.
-  for (dimension_type i = 0; i < tableau_n_rows; ++i)
+  for (dimension_type i = 0; i < tableau_n_rows; ++i) {
     if (begin_artificials <= base[i] && base[i] < end_artificials) {
       // Search for a non-zero element to enter the base.
       Row& tableau_i = tableau[i];
@@ -1707,7 +1707,7 @@ PPL::MIP_Problem::erase_artificials(const dimension_type begin_artificials,
         base.pop_back();
       }
     }
-
+  }
   // Step 2: Adjust data structures so as to enter phase 2 of the simplex.
 
   // Resize the tableau.
diff --git a/src/Polyhedron_conversion_templates.hh b/src/Polyhedron_conversion_templates.hh
index 77d2be0..e9fffd7 100644
--- a/src/Polyhedron_conversion_templates.hh
+++ b/src/Polyhedron_conversion_templates.hh
@@ -918,8 +918,9 @@ Polyhedron::conversion(Source_Linear_System& source,
 #ifndef NDEBUG
   // The previous code can modify the rows' fields, exploiting the friendness.
   // Check that all rows are OK now.
-  for (dimension_type i = dest.num_rows(); i-- > 0; )
+  for (dimension_type i = dest.num_rows(); i-- > 0; ) {
     PPL_ASSERT(dest.sys.rows[i].OK());
+  }
 #endif
 
   dest.sys.index_first_pending = dest.num_rows();
diff --git a/src/Polyhedron_minimize_templates.hh b/src/Polyhedron_minimize_templates.hh
index 5a51172..eacf57f 100644
--- a/src/Polyhedron_minimize_templates.hh
+++ b/src/Polyhedron_minimize_templates.hh
@@ -152,8 +152,9 @@ Polyhedron::minimize(const bool con_to_gen,
   dest_num_rows = dest.num_rows();
 
 #ifndef NDEBUG
-  for (dimension_type i = dest.num_rows(); i-- > 0; )
+  for (dimension_type i = dest.num_rows(); i-- > 0; ) {
     PPL_ASSERT(dest[i].OK());
+  }
 #endif
 
   // Checking if the generators in `dest' represent an empty polyhedron:




More information about the PPL-devel mailing list