[PPL-devel] [GIT] ppl/ppl(master): Make sure each case within a switch statement is properly terminated.

Roberto Bagnara bagnara at cs.unipr.it
Sun Feb 12 21:45:52 CET 2012


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

Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date:   Sun Feb 12 21:43:25 2012 +0100

Make sure each case within a switch statement is properly terminated.
Detected by ECLAIR service swchbrek.

---

 src/BD_Shape.templates.hh        |    2 ++
 src/Grid_conversion.cc           |    2 ++
 src/Grid_public.cc               |    5 +++--
 src/Grid_simplify.cc             |    2 ++
 src/Octagonal_Shape.templates.hh |    2 ++
 5 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/BD_Shape.templates.hh b/src/BD_Shape.templates.hh
index 8b74cac..8ef7bfe 100644
--- a/src/BD_Shape.templates.hh
+++ b/src/BD_Shape.templates.hh
@@ -1512,6 +1512,8 @@ BD_Shape<T>::relation_with(const Constraint& c) const {
         case -1:
           return Poly_Con_Relation::strictly_intersects();
         }
+        PPL_UNREACHABLE;
+        break;
       case 0:
         if (min_numer == 0) {
           if (c.is_strict_inequality())
diff --git a/src/Grid_conversion.cc b/src/Grid_conversion.cc
index 0149624..2cbcee5 100644
--- a/src/Grid_conversion.cc
+++ b/src/Grid_conversion.cc
@@ -464,8 +464,10 @@ Grid::conversion(Congruence_System& source, Grid_Generator_System& dest,
     switch (dim_kinds[dim]) {
     case PARAMETER:
       dest[row].set_divisor(system_divisor);
+      // Intentionally fall through.
     case LINE:
       --row;
+      // Intentionally fall through.
     case GEN_VIRTUAL:
       break;
     }
diff --git a/src/Grid_public.cc b/src/Grid_public.cc
index 1d778b2..ad38d6e 100644
--- a/src/Grid_public.cc
+++ b/src/Grid_public.cc
@@ -637,7 +637,8 @@ PPL::Grid::relation_with(const Constraint& c) const {
             point_is_included = !c.is_equality();
 	  break;
 	}
-	// Not the first point: convert `g' to be a parameter ...
+	// Not the first point: convert `g' to be a parameter
+	// and fall through into the parameter case.
 	Grid_Generator& gen = const_cast<Grid_Generator&>(g);
 	const Grid_Generator& point = *first_point;
         const Coefficient& p_div = g[0];
@@ -658,8 +659,8 @@ PPL::Grid::relation_with(const Constraint& c) const {
         gen.strong_normalize();
 	gen.set_is_parameter();
         PPL_ASSERT(gen.OK());
-	// ... and fall through into the parameter case.
       }
+      // Intentionally fall through.
 
     case Grid_Generator::PARAMETER:
     case Grid_Generator::LINE:
diff --git a/src/Grid_simplify.cc b/src/Grid_simplify.cc
index 38b0807..3a08160 100644
--- a/src/Grid_simplify.cc
+++ b/src/Grid_simplify.cc
@@ -365,8 +365,10 @@ Grid::simplify(Grid_Generator_System& sys, Dimension_Kinds& dim_kinds) {
     switch (dim_kinds[dim]) {
     case PARAMETER:
       sys[row].set_divisor(system_divisor);
+      // Intentionally fall through.
     case LINE:
       --row;
+      // Intentionally fall through.
     case GEN_VIRTUAL:
       break;
     }
diff --git a/src/Octagonal_Shape.templates.hh b/src/Octagonal_Shape.templates.hh
index 1c47af1..27bcd0a 100644
--- a/src/Octagonal_Shape.templates.hh
+++ b/src/Octagonal_Shape.templates.hh
@@ -1937,6 +1937,8 @@ Octagonal_Shape<T>::relation_with(const Constraint& c) const {
         case -1:
           return Poly_Con_Relation::strictly_intersects();
         }
+        PPL_UNREACHABLE;
+        break;
       case 0:
         if (min_numer == 0) {
           if (c.is_strict_inequality())




More information about the PPL-devel mailing list