[PPL-devel] [GIT] ppl/ppl(master): Avoid implicit conversion from boolean to integral.

Enea Zaffanella zaffanella at cs.unipr.it
Mon Mar 12 13:53:38 CET 2012


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

Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date:   Mon Mar 12 11:39:12 2012 +0100

Avoid implicit conversion from boolean to integral.
Detected by ECLAIR service utypflag.

---

 interfaces/C/ppl_interface_generator_c_cc_code.m4 |    6 +++---
 interfaces/Prolog/SWI/swi_cfli.hh                 |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/interfaces/C/ppl_interface_generator_c_cc_code.m4 b/interfaces/C/ppl_interface_generator_c_cc_code.m4
index 478a36a..387cf2c 100644
--- a/interfaces/C/ppl_interface_generator_c_cc_code.m4
+++ b/interfaces/C/ppl_interface_generator_c_cc_code.m4
@@ -275,7 +275,7 @@ ppl_ at CLASS@_frequency
   Coefficient& pfreq_d = *to_nonconst(freq_d);
   Coefficient& pval_n = *to_nonconst(val_n);
   Coefficient& pval_d = *to_nonconst(val_d);
-  return pph.frequency(lle, pfreq_n, pfreq_d, pval_n, pval_d);
+  return pph.frequency(lle, pfreq_n, pfreq_d, pval_n, pval_d) ? 1 : 0;
 }
 CATCH_ALL
 
@@ -1237,7 +1237,7 @@ ppl_termination_test_ at TERMINATION_ID@_ at TOPOLOGY@@CLASS@
 (ppl_const_ at CLASS@_t pset) try {
   const @TOPOLOGY@@CPP_CLASS@& ppset
     = *static_cast<const @TOPOLOGY@@CPP_CLASS@*>(to_const(pset));
-  return termination_test_ at TERMINATION_ID@(ppset);
+  return termination_test_ at TERMINATION_ID@(ppset) ? 1 : 0;
 }
 CATCH_ALL
 
@@ -1252,7 +1252,7 @@ ppl_termination_test_ at TERMINATION_ID@_ at TOPOLOGY@@CLASS at _2
     = *static_cast<const @TOPOLOGY@@CPP_CLASS@*>(to_const(pset_before));
   const @TOPOLOGY@@CPP_CLASS@& ppset_after
     = *static_cast<const @TOPOLOGY@@CPP_CLASS@*>(to_const(pset_after));
-  return termination_test_ at TERMINATION_ID@_2(ppset_before, ppset_after);
+  return termination_test_ at TERMINATION_ID@_2(ppset_before, ppset_after) ? 1 : 0;
 }
 CATCH_ALL
 
diff --git a/interfaces/Prolog/SWI/swi_cfli.hh b/interfaces/Prolog/SWI/swi_cfli.hh
index 9581096..414d1f4 100644
--- a/interfaces/Prolog/SWI/swi_cfli.hh
+++ b/interfaces/Prolog/SWI/swi_cfli.hh
@@ -294,7 +294,7 @@ Prolog_is_compound(Prolog_term_ref t) {
 */
 inline int
 Prolog_is_cons(Prolog_term_ref t) {
-  return !PL_is_atom(t) && PL_is_list(t);
+  return (!PL_is_atom(t) && PL_is_list(t)) ? 1 : 0;
 }
 
 /*!




More information about the PPL-devel mailing list