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

Roberto Bagnara bagnara at cs.unipr.it
Mon Jan 14 18:16:17 CET 2013


Module: ppl/ppl
Branch: polyops
Commit: 3d42a8fdc6039720fdb2eb362505bc56273d8098
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=3d42a8fdc6039720fdb2eb362505bc56273d8098

Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date:   Sat Jan  5 20:53:04 2013 +0100

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

---

 interfaces/C/ppl_interface_generator_c_cc_code.m4 |   22 ++++++++++----------
 1 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/interfaces/C/ppl_interface_generator_c_cc_code.m4 b/interfaces/C/ppl_interface_generator_c_cc_code.m4
index 4f743c1..6cc8683 100644
--- a/interfaces/C/ppl_interface_generator_c_cc_code.m4
+++ b/interfaces/C/ppl_interface_generator_c_cc_code.m4
@@ -41,7 +41,7 @@ ppl_new_ at TOPOLOGY@@CLASS at _from_space_dimension
 (ppl_ at CLASS@_t* pph,
  ppl_dimension_type d,
  int empty) try {
-  Degenerate_Element e = (empty != 0) ? EMPTY : UNIVERSE;
+  const Degenerate_Element e = (empty != 0) ? EMPTY : UNIVERSE;
   *pph = to_nonconst(new @TOPOLOGY@@CPP_CLASS@(d, e));
   return 0;
 }
@@ -227,7 +227,7 @@ ppl_ at CLASS@_ at MAXMIN@
   Coefficient& ssup_n = *to_nonconst(sup_n);
   Coefficient& ssup_d = *to_nonconst(sup_d);
   bool optimum;
-  bool ok = pph. at MAXMIN@(lle, ssup_n, ssup_d, optimum);
+  const bool ok = pph. at MAXMIN@(lle, ssup_n, ssup_d, optimum);
   if (ok)
     *poptimum = optimum ? 1 : 0;
   return ok ? 1 : 0;
@@ -251,7 +251,7 @@ ppl_ at CLASS@_ at MAXMIN@_with_point
   Coefficient& ssup_d = *to_nonconst(sup_d);
   Generator& ppoint = *to_nonconst(point);
   bool optimum;
-  bool ok = pph. at MAXMIN@(lle, ssup_n, ssup_d, optimum, ppoint);
+  const bool ok = pph. at MAXMIN@(lle, ssup_n, ssup_d, optimum, ppoint);
   if (ok)
     *poptimum = optimum ? 1 : 0;
   return ok ? 1 : 0;
@@ -386,7 +386,7 @@ ppl_ at CLASS@_constrains
 (ppl_ at CLASS@_t ph,
  ppl_dimension_type var
 ) try {
-  @CPP_CLASS@& pph = *to_nonconst(ph);
+  const @CPP_CLASS@& pph = *to_const(ph);
   return pph.constrains(Variable(var)) ? 1 : 0;
 }
 CATCH_ALL
@@ -845,7 +845,7 @@ ppl_ at CLASS@_map_space_dimensions
  ppl_dimension_type maps[],
  size_t n) try {
   @CPP_CLASS@& pph = *to_nonconst(ph);
-  Array_Partial_Function_Wrapper function(maps, n);
+  const Array_Partial_Function_Wrapper function(maps, n);
   pph.map_space_dimensions(function);
   return 0;
 }
@@ -1288,7 +1288,7 @@ ppl_one_affine_ranking_function_ at TERMINATION_ID@_ at TOPOLOGY@@CLASS@
   const @TOPOLOGY@@CPP_CLASS@& ppset
     = *static_cast<const @TOPOLOGY@@CPP_CLASS@*>(to_const(pset));
   Generator& ppoint = *to_nonconst(point);
-  bool ok = one_affine_ranking_function_ at TERMINATION_ID@(ppset, ppoint);
+  const bool ok = one_affine_ranking_function_ at TERMINATION_ID@(ppset, ppoint);
   return ok ? 1 : 0;
 }
 CATCH_ALL
@@ -1306,9 +1306,9 @@ ppl_one_affine_ranking_function_ at TERMINATION_ID@_ at TOPOLOGY@@CLASS at _2
   const @TOPOLOGY@@CPP_CLASS@& ppset_after
     = *static_cast<const @TOPOLOGY@@CPP_CLASS@*>(to_const(pset_after));
   Generator& ppoint = *to_nonconst(point);
-  bool ok = one_affine_ranking_function_ at TERMINATION_ID@_2(ppset_before,
-                                                           ppset_after,
-                                                           ppoint);
+  const bool ok = one_affine_ranking_function_ at TERMINATION_ID@_2(ppset_before,
+                                                                 ppset_after,
+                                                                 ppoint);
   return ok ? 1 : 0;
 }
 CATCH_ALL
@@ -1402,8 +1402,8 @@ ppl_ at CLASS@_wrap_assign
   Variables_Set vars;
   for (ppl_dimension_type i = n; i-- > 0; )
     vars.insert(ds[i]);
-  const Constraint_System* ccs = to_const(*pcs);
-  bool b = (wrap_individually != 0);
+  const Constraint_System* const ccs = to_const(*pcs);
+  const bool b = (wrap_individually != 0);
   pph.wrap_assign(vars,
                   bounded_integer_type_width(w),
                   bounded_integer_type_representation(r),




More information about the PPL-devel mailing list