Skip to content

Commit

Permalink
Merge pull request CGAL#2973 from afabri/CGAL-another_fallthrough-GF
Browse files Browse the repository at this point in the history
Yet more fallthrough fixes
  • Loading branch information
lrineau committed Apr 6, 2018
2 parents d1509b4 + 6375bb1 commit 52ff91d
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
38 changes: 36 additions & 2 deletions Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH2.h
Original file line number Diff line number Diff line change
Expand Up @@ -790,20 +790,26 @@ Aff_transformation_repH2<R>::homogeneous(int i, int j) const
case 0: return a;
case 1: return b;
case 2: return c;
default: CGAL_assume(false);
}
break;
case 1: switch (j)
{
case 0: return d;
case 1: return e;
case 2: return f;
default: CGAL_assume(false);
}
break;
case 2: switch (j)
{
case 0: return RT(0);
case 1: return RT(0);
case 2: return g;
default: CGAL_assume(false);
}
}
CGAL_assume(false);
return RT(0);
}

Expand All @@ -828,20 +834,26 @@ Translation_repH2<R>::homogeneous(int i, int j) const
case 0: return _tv.hw();
case 1: return RT(0);
case 2: return _tv.hx();
default: CGAL_assume(false);
}
break;
case 1: switch (j)
{
case 0: return RT(0);
case 1: return _tv.hw();
case 2: return _tv.hy();
default: CGAL_assume(false);
}
break;
case 2: switch (j)
{
case 0: return RT(0);
case 1: return RT(0);
case 2: return _tv.hw();
default: CGAL_assume(false);
}
}
CGAL_assume(false);
return RT(0);
}

Expand All @@ -857,20 +869,26 @@ Translation_repH2<R>::cartesian(int i, int j) const
case 0: return FT(1);
case 1: return FT(0);
case 2: return _tv.x();
default: CGAL_assume(false);
}
break;
case 1: switch (j)
{
case 0: return FT(0);
case 1: return FT(1);
case 2: return _tv.y();
default: CGAL_assume(false);
}
break;
case 2: switch (j)
{
case 0: return FT(0);
case 1: return FT(0);
case 2: return FT(1);
default: CGAL_assume(false);
}
}
CGAL_assume(false);
return FT(0);
}

Expand All @@ -887,20 +905,26 @@ homogeneous(int i, int j) const
case 0: return _cos;
case 1: return - _sin;
case 2: return RT(0);
default: CGAL_assume(false);
}
break;
case 1: switch (j)
{
case 0: return _sin;
case 1: return _cos;
case 2: return RT(0);
default: CGAL_assume(false);
}
break;
case 2: switch (j)
{
case 0: return RT(0);
case 1: return RT(0);
case 2: return _den;
default: CGAL_assume(false);
}
}
CGAL_assume(false);
return RT(0);
}

Expand All @@ -919,13 +943,15 @@ cartesian(int i, int j) const
case 2: return FT(0);
default: CGAL_assume(false);
}
break;
case 1: switch (j)
{
case 0: return FT(_sin) / FT(_den);
case 1: return FT(_cos) / FT(_den);
case 2: return FT(0);
default: CGAL_assume(false);
}
break;
case 2: switch (j)
{
case 0: return FT(0);
Expand Down Expand Up @@ -953,13 +979,15 @@ homogeneous(int i, int j) const
case 2: return RT(0);
default: CGAL_assume(false);
}
break;
case 1: switch (j)
{
case 0: return RT(0);
case 1: return _sf_num;
case 2: return RT(0);
default: CGAL_assume(false);
}
break;
case 2: switch (j)
{
case 0: return RT(0);
Expand Down Expand Up @@ -987,13 +1015,15 @@ cartesian(int i, int j) const
case 2: return FT(0);
default: CGAL_assume(false);
}
break;
case 1: switch (j)
{
case 0: return FT(0);
case 1: return FT(_sf_num) / FT(_sf_den);
case 2: return FT(0);
default: CGAL_assume(false);
}
break;
case 2: switch (j)
{
case 0: return FT(0);
Expand All @@ -1002,8 +1032,8 @@ cartesian(int i, int j) const
default: CGAL_assume(false);
}
}
CGAL_assume(false);
return FT(0);
CGAL_assume(false);
return FT(0);
}

template < class R >
Expand All @@ -1022,13 +1052,15 @@ homogeneous(int i, int j) const
case 2: return l.a()*l.c()*mRT2;
default: CGAL_assume(false);
}
break;
case 1: switch (j)
{
case 0: return l.a()*l.b()*mRT2;
case 1: return l.a()*l.a() - l.b()*l.b();
case 2: return l.b()*l.c()*mRT2;
default: CGAL_assume(false);
}
break;
case 2: switch (j)
{
case 0: return RT(0);
Expand Down Expand Up @@ -1057,13 +1089,15 @@ cartesian(int i, int j) const
case 2: return FT( homogeneous(0,2)) / de;
default: CGAL_assume(false);
}
break;
case 1: switch (j)
{
case 0: return FT( homogeneous(1,0)) / de;
case 1: return FT( l.a()-l.b() ) / FT( l.a()+l.b());
case 2: return FT( homogeneous(1,2)) / de;
default: CGAL_assume(false);
}
break;
case 2: switch (j)
{
case 0: return FT(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ homogeneous(int i, int j) const
case 3: return t03;
default: CGAL_assume(false);
}
break;
case 1: switch (j)
{
case 0: return t10;
Expand All @@ -561,6 +562,7 @@ homogeneous(int i, int j) const
case 3: return t13;
default: CGAL_assume(false);
}
break;
case 2: switch (j)
{
case 0: return t20;
Expand All @@ -569,6 +571,7 @@ homogeneous(int i, int j) const
case 3: return t23;
default: CGAL_assume(false);
}
break;
case 3: switch (j)
{
case 0: return RT0;
Expand Down Expand Up @@ -702,6 +705,7 @@ Translation_repH3<R>::homogeneous(int i, int j) const
case 3: return tv.hx();
default: CGAL_assume(false);
}
break;
case 1: switch (j)
{
case 0: return RT0;
Expand All @@ -710,6 +714,7 @@ Translation_repH3<R>::homogeneous(int i, int j) const
case 3: return tv.hy();
default: CGAL_assume(false);
}
break;
case 2: switch (j)
{
case 0: return RT0;
Expand All @@ -718,6 +723,7 @@ Translation_repH3<R>::homogeneous(int i, int j) const
case 3: return tv.hz();
default: CGAL_assume(false);
}
break;
case 3: switch (j)
{
case 0: return RT0;
Expand Down
3 changes: 3 additions & 0 deletions Visibility_2/include/CGAL/Rotational_sweep_visibility_2.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ class Rotational_sweep_visibility_2 {
return (Visibility_2::orientation_2(geom_traits, s2, t2, q)
== Visibility_2::orientation_2(geom_traits, s2, t2, s1));
}
break;
case RIGHT_TURN:
switch (Visibility_2::orientation_2(geom_traits, s1, t1, s2)) {
case COLLINEAR:
Expand All @@ -225,6 +226,7 @@ class Rotational_sweep_visibility_2 {
return true;
default: CGAL_assume(false);
}
break;
case LEFT_TURN:
switch (Visibility_2::orientation_2(geom_traits, s1, t1, s2)) {
case COLLINEAR:
Expand All @@ -245,6 +247,7 @@ class Rotational_sweep_visibility_2 {
}
}

CGAL_assume(false);
return false;
}

Expand Down

0 comments on commit 52ff91d

Please sign in to comment.