[PPL-devel] [GIT] ppl/ppl(master): Avoid implicit conversions to bool.

Enea Zaffanella zaffanella at cs.unipr.it
Thu Mar 1 22:36:59 CET 2012


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

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Thu Mar  1 22:19:18 2012 +0100

Avoid implicit conversions to bool.
Detected by ECLAIR service utypflag.

---

 interfaces/C/ppl_c_implementation_common.cc        |    2 +-
 .../C/ppl_c_implementation_common.inlines.hh       |    2 +-
 interfaces/C/ppl_interface_generator_c_cc_code.m4  |    2 +-
 src/Pointset_Powerset.templates.hh                 |    3 ++-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/interfaces/C/ppl_c_implementation_common.cc b/interfaces/C/ppl_c_implementation_common.cc
index 4422053..045765c 100644
--- a/interfaces/C/ppl_c_implementation_common.cc
+++ b/interfaces/C/ppl_c_implementation_common.cc
@@ -2430,7 +2430,7 @@ int
 ppl_PIP_Decision_Node_get_child_node(ppl_const_PIP_Decision_Node_t pip_dec,
                                      int b,
                                      ppl_const_PIP_Tree_Node_t* pip_tree) try {
-  *pip_tree = to_const(to_const(pip_dec)->child_node(b));
+  *pip_tree = to_const(to_const(pip_dec)->child_node(b != 0));
   return 0;
 }
 CATCH_ALL
diff --git a/interfaces/C/ppl_c_implementation_common.inlines.hh b/interfaces/C/ppl_c_implementation_common.inlines.hh
index 5a8f853..3057913 100644
--- a/interfaces/C/ppl_c_implementation_common.inlines.hh
+++ b/interfaces/C/ppl_c_implementation_common.inlines.hh
@@ -178,7 +178,7 @@ Array_Partial_Function_Wrapper::has_empty_codomain() const {
         break;
       }
   }
-  return empty;
+  return (empty != 0);
 }
 
 inline dimension_type
diff --git a/interfaces/C/ppl_interface_generator_c_cc_code.m4 b/interfaces/C/ppl_interface_generator_c_cc_code.m4
index 87d446d..478a36a 100644
--- a/interfaces/C/ppl_interface_generator_c_cc_code.m4
+++ b/interfaces/C/ppl_interface_generator_c_cc_code.m4
@@ -1381,7 +1381,7 @@ ppl_ at CLASS@_wrap_assign
   for (ppl_dimension_type i = n; i-- > 0; )
     vars.insert(ds[i]);
   const Constraint_System* ccs = to_const(*pcs);
-  bool b = wrap_individually;
+  bool b = (wrap_individually != 0);
   pph.wrap_assign(vars,
                   bounded_integer_type_width(w),
                   bounded_integer_type_representation(r),
diff --git a/src/Pointset_Powerset.templates.hh b/src/Pointset_Powerset.templates.hh
index f2cb3c7..550573a 100644
--- a/src/Pointset_Powerset.templates.hh
+++ b/src/Pointset_Powerset.templates.hh
@@ -115,7 +115,8 @@ Pointset_Powerset<PSET>::concatenate_assign(const Pointset_Powerset& y) {
       new_x.sequence.push_back(zi);
     }
     ++xi;
-    if (abandon_expensive_computations && xi != x_end && y_begin != y_end) {
+    if ((abandon_expensive_computations != 0)
+        && (xi != x_end) && (y_begin != y_end)) {
       // Hurry up!
       PSET x_ph = xi->pointset();
       for (++xi; xi != x_end; ++xi)




More information about the PPL-devel mailing list