[PPL-devel] [GIT] ppl/ppl(master): Const-qualify immutable objects.

Roberto Bagnara bagnara at cs.unipr.it
Fri Jan 4 19:08:30 CET 2013


Module: ppl/ppl
Branch: master
Commit: 9ddca3fbdf256f9c2457298e2947185210a4a77f
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=9ddca3fbdf256f9c2457298e2947185210a4a77f

Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date:   Fri Jan  4 19:08:19 2013 +0100

Const-qualify immutable objects.
Detected by ECLAIR service cnstpnte.

---

 src/Box_templates.hh         |    6 ++++--
 src/CO_Tree.cc               |    2 +-
 src/Linear_System_inlines.hh |    2 +-
 src/MIP_Problem.cc           |    2 +-
 src/OR_Matrix_inlines.hh     |    2 +-
 src/Polyhedron_inlines.hh    |    2 +-
 src/c_streambuf.cc           |    2 +-
 7 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/Box_templates.hh b/src/Box_templates.hh
index 6853b48..227dd65 100644
--- a/src/Box_templates.hh
+++ b/src/Box_templates.hh
@@ -2538,7 +2538,8 @@ Box<ITV>::propagate_constraint_no_check(const Constraint& c) {
       if (open == T_MAYBE
           && maybe_check_fpu_inexact<Temp_Boundary_Type>() == 1)
         open = T_YES;
-      Relation_Symbol rel = (open == T_YES) ? LESS_THAN : LESS_OR_EQUAL;
+      const Relation_Symbol rel
+        = (open == T_YES) ? LESS_THAN : LESS_OR_EQUAL;
       seq[k_var.id()].add_constraint(i_constraint(rel, t_bound));
       reset_empty_up_to_date();
     }
@@ -2672,7 +2673,8 @@ Box<ITV>::propagate_constraint_no_check(const Constraint& c) {
       if (open == T_MAYBE
           && maybe_check_fpu_inexact<Temp_Boundary_Type>() == 1)
         open = T_YES;
-      Relation_Symbol rel = (open == T_YES) ? GREATER_THAN : GREATER_OR_EQUAL;
+      const Relation_Symbol rel
+        = (open == T_YES) ? GREATER_THAN : GREATER_OR_EQUAL;
       seq[k_var.id()].add_constraint(i_constraint(rel, t_bound));
       reset_empty_up_to_date();
     }
diff --git a/src/CO_Tree.cc b/src/CO_Tree.cc
index 5a67d90..a7e5ecd 100644
--- a/src/CO_Tree.cc
+++ b/src/CO_Tree.cc
@@ -169,7 +169,7 @@ PPL::CO_Tree::erase_element_and_shift_left(dimension_type key) {
     return;
   const dimension_type i = dfs_index(itr);
   dimension_type* p = indexes + i;
-  const dimension_type* p_end = indexes + (reserved_size + 1);
+  const dimension_type* const p_end = indexes + (reserved_size + 1);
   for ( ; p != p_end; ++p)
     if (*p != unused_index)
       --(*p);
diff --git a/src/Linear_System_inlines.hh b/src/Linear_System_inlines.hh
index 995043e..a2aedba 100644
--- a/src/Linear_System_inlines.hh
+++ b/src/Linear_System_inlines.hh
@@ -366,7 +366,7 @@ inline void
 Linear_System<Row>::remove_row_no_ok(const dimension_type i,
                                      const bool keep_sorted) {
   PPL_ASSERT(i < num_rows());
-  bool was_pending = (i >= index_first_pending);
+  const bool was_pending = (i >= index_first_pending);
 
   if (sorted && keep_sorted && !was_pending) {
     for (dimension_type j = i + 1; j < rows.size(); ++j)
diff --git a/src/MIP_Problem.cc b/src/MIP_Problem.cc
index 8c3d12c..b5030d8 100644
--- a/src/MIP_Problem.cc
+++ b/src/MIP_Problem.cc
@@ -1035,7 +1035,7 @@ PPL::MIP_Problem::steepest_edge_float_entering_index() const {
   // this implementation and the dense implementation below.
   for (std::vector<std::pair<dimension_type, double> >::const_reverse_iterator
        i = columns.rbegin(), i_end = columns.rend(); i != i_end; ++i) {
-    double challenger_value = sqrt(i->second);
+    const double challenger_value = sqrt(i->second);
     if (entering_index == 0 || challenger_value > current_value) {
       current_value = challenger_value;
       entering_index = i->first;
diff --git a/src/OR_Matrix_inlines.hh b/src/OR_Matrix_inlines.hh
index 4dfd006..f0e8349 100644
--- a/src/OR_Matrix_inlines.hh
+++ b/src/OR_Matrix_inlines.hh
@@ -465,7 +465,7 @@ inline dimension_type
 OR_Matrix<T>::max_num_rows() {
   // Compute the maximum number of rows that are contained in a DB_Row
   // that allocates a pseudo-triangular matrix.
-  dimension_type k = isqrt(2*DB_Row<T>::max_size() + 1);
+  const dimension_type k = isqrt(2*DB_Row<T>::max_size() + 1);
   return (k - 1) - (k - 1) % 2;
 }
 
diff --git a/src/Polyhedron_inlines.hh b/src/Polyhedron_inlines.hh
index aa521e8..f543e9c 100644
--- a/src/Polyhedron_inlines.hh
+++ b/src/Polyhedron_inlines.hh
@@ -434,7 +434,7 @@ Polyhedron::strictly_contains(const Polyhedron& y) const {
 
 inline void
 Polyhedron::drop_some_non_integer_points(Complexity_Class complexity) {
-  const Variables_Set* p_vs = 0;
+  const Variables_Set* const p_vs = 0;
   drop_some_non_integer_points(p_vs, complexity);
 }
 
diff --git a/src/c_streambuf.cc b/src/c_streambuf.cc
index 3c83995..a15499a 100644
--- a/src/c_streambuf.cc
+++ b/src/c_streambuf.cc
@@ -30,7 +30,7 @@ namespace Parma_Polyhedra_Library {
 
 c_streambuf::int_type
 c_streambuf::uflow() {
-  int_type c = underflow();
+  const int_type c = underflow();
   next_char_buf = traits_type::eof();
   return c;
 }




More information about the PPL-devel mailing list