From c26dd87dc4325c867008146f0ed946ba855fec65 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 30 Sep 2024 11:57:04 +0100 Subject: [PATCH] No code after unreachable() --- .../CGAL/Homogeneous/Aff_transformationH2.h | 9 ------- .../CGAL/Homogeneous/Aff_transformationH3.h | 2 -- .../CGAL/Intersections_2/Ray_2_Ray_2.h | 3 +-- .../CGAL/Intersections_2/Ray_2_Segment_2.h | 3 +-- .../Intersections_2/Segment_2_Segment_2.h | 3 --- .../internal/Line_3_Triangle_3_do_intersect.h | 6 ++--- .../Plane_3_Triangle_3_do_intersect.h | 1 - .../Point_3_Triangle_3_do_intersect.h | 2 -- .../internal/Ray_3_Triangle_3_do_intersect.h | 24 ++++++------------ .../Segment_3_Triangle_3_do_intersect.h | 25 ++++++------------- .../Triangle_3_Triangle_3_do_intersect.h | 18 +++++-------- .../include/CGAL/KSP_3/Finalizer.h | 1 - .../Mesh_3/Robust_intersection_traits_3.h | 1 - .../intersect_triangle_and_segment_3.h | 4 --- .../include/CGAL/Trisegment_2.h | 1 - .../CGAL/Triangulation_data_structure_2.h | 2 +- .../Constrained_Delaunay_triangulation_2.h | 1 - .../include/CGAL/Triangulation_2.h | 3 +-- .../CGAL/Triangulation_segment_traverser_3.h | 6 ++--- .../CGAL/Rotational_sweep_visibility_2.h | 1 - 20 files changed, 30 insertions(+), 86 deletions(-) diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH2.h b/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH2.h index 7678de819f53..b4c0daf7a5e9 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH2.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH2.h @@ -876,7 +876,6 @@ Aff_transformation_repH2::homogeneous(int i, int j) const } } CGAL_unreachable(); - return RT(0); } template < class R > @@ -920,7 +919,6 @@ Translation_repH2::homogeneous(int i, int j) const } } CGAL_unreachable(); - return RT(0); } template < class R > @@ -955,7 +953,6 @@ Translation_repH2::cartesian(int i, int j) const } } CGAL_unreachable(); - return FT(0); } template < class R > @@ -991,7 +988,6 @@ homogeneous(int i, int j) const } } CGAL_unreachable(); - return RT(0); } template < class R > @@ -1027,7 +1023,6 @@ cartesian(int i, int j) const } } CGAL_unreachable(); - return FT(0); } template < class R > @@ -1063,7 +1058,6 @@ homogeneous(int i, int j) const } } CGAL_unreachable(); - return RT(0); } template @@ -1099,7 +1093,6 @@ cartesian(int i, int j) const } } CGAL_unreachable(); - return FT(0); } template < class R > @@ -1136,7 +1129,6 @@ homogeneous(int i, int j) const } } CGAL_unreachable(); - return RT(0); } template @@ -1173,7 +1165,6 @@ cartesian(int i, int j) const } } CGAL_unreachable(); - return FT(0); } } //namespace CGAL diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH3.h index fa0ba377b4d3..23d72aa4034a 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/Aff_transformationH3.h @@ -737,7 +737,6 @@ homogeneous(int i, int j) const } } CGAL_unreachable(); - return RT0; } template < class R > @@ -895,7 +894,6 @@ Translation_repH3::homogeneous(int i, int j) const } } CGAL_unreachable(); - return RT0; } template < class R > diff --git a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Ray_2.h b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Ray_2.h index b496228e513f..9f020e5cb27b 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Ray_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Ray_2.h @@ -186,8 +186,7 @@ Ray_2_Ray_2_pair::intersection_type() const } } default: - CGAL_unreachable(); // should not be reached: - return _result; + CGAL_unreachable(); } } diff --git a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Segment_2.h index b1449ce8dc6e..2ab57031e30b 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Ray_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Segment_2.h @@ -204,8 +204,7 @@ Ray_2_Segment_2_pair::intersection_type() const } } default: - CGAL_unreachable(); // should not be reached: - return _result; + CGAL_unreachable(); } } diff --git a/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h index e1f2a06aa753..064496e39296 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h @@ -143,7 +143,6 @@ seg_seg_do_intersect_crossing( CGAL_unreachable(); } CGAL_unreachable(); - return S2S2_inter_info(false); } // used internally by Arr_segment_traits_2template @@ -204,7 +203,6 @@ seg_seg_do_intersect_contained( CGAL_unreachable(); } CGAL_unreachable(); - return S2S2_inter_info(false); } // used internally by Arr_segment_traits_2 @@ -321,7 +319,6 @@ do_intersect_with_info(const typename K::Segment_2 &seg1, } CGAL_unreachable(); - return S2S2_inter_info(false); } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Triangle_3_do_intersect.h index 72bc2e928dd5..168ed69647e5 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Line_3_Triangle_3_do_intersect.h @@ -58,13 +58,11 @@ do_intersect(const typename K::Triangle_3& t, case POSITIVE: return (orientation(p,q,c,a) != NEGATIVE); case NEGATIVE: return (orientation(p,q,c,a) != POSITIVE); case COPLANAR: return true; - default: // should not happen. + default: CGAL_unreachable(); - return false; } - default: // should not happen. + default: CGAL_unreachable(); - return false; } } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Triangle_3_do_intersect.h index 4a4af5eb4f11..952211f0c412 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Plane_3_Triangle_3_do_intersect.h @@ -45,7 +45,6 @@ do_intersect(const typename K::Triangle_3& t, return true; default:// should not happen. CGAL_unreachable(); - return false; } } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Triangle_3_do_intersect.h index 57f680a528a2..c2429b68fc98 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Point_3_Triangle_3_do_intersect.h @@ -61,11 +61,9 @@ do_intersect(const typename K::Triangle_3& t, case COLLINEAR: return true; default: // should not happen. CGAL_unreachable(); - return false; } default: // should not happen. CGAL_unreachable(); - return false; } } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Triangle_3_do_intersect.h index 768299a27b7b..fdb229c8489e 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Ray_3_Triangle_3_do_intersect.h @@ -140,9 +140,8 @@ do_intersect_coplanar(const typename K::Triangle_3& t, // a is isolated on the positive side return visitor.result(coplanar_orientation(*a,*c,p) != POSITIVE); - default: // should not happen. + default: CGAL_unreachable(); - return visitor.result(false); } case NEGATIVE: @@ -166,9 +165,8 @@ do_intersect_coplanar(const typename K::Triangle_3& t, // a is isolated on the negative side return visitor.result(coplanar_orientation(*b,*a,p) != POSITIVE); - default: // should not happen. + default: CGAL_unreachable(); - return visitor.result(false); } case COLLINEAR: @@ -191,14 +189,12 @@ do_intersect_coplanar(const typename K::Triangle_3& t, return visitor.result(coplanar_orientation(*a,*c,p) != POSITIVE); // case pqc == COLLINEAR is imposiible - default: // should not happen. + default: CGAL_unreachable(); - return visitor.result(false); } - default: // should not happen. + default: CGAL_unreachable(); - return visitor.result(false); } } @@ -263,9 +259,8 @@ do_intersect(const typename K::Triangle_3& t, return visitor.result(true); } // case COPLANAR: should not happen - default: // should not happen. + default: CGAL_unreachable(); - return visitor.result(false); } case NEGATIVE: @@ -293,9 +288,8 @@ do_intersect(const typename K::Triangle_3& t, // case COPLANAR: should not happen - default: // should not happen. + default: CGAL_unreachable(); - return visitor.result(false); } case COPLANAR: // p belongs to the triangle's supporting plane @@ -317,14 +311,12 @@ do_intersect(const typename K::Triangle_3& t, // case COPLANAR: should not happen - default: // should not happen. + default: CGAL_unreachable(); - return visitor.result(false); } - default: // should not happen. + default: CGAL_unreachable(); - return visitor.result(false); } } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Triangle_3_do_intersect.h index ceaa5772f3c4..9f5150cc7b4a 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Segment_3_Triangle_3_do_intersect.h @@ -79,9 +79,8 @@ bool do_intersect_coplanar(const typename K::Point_3& A, // a is isolated on the positive side return coplanar_orientation(*a,*b,q) != NEGATIVE && coplanar_orientation(*c,*a,p) != NEGATIVE; - default:// should not happen. + default: CGAL_unreachable(); - return false; } case NEGATIVE: switch ( pqb ) { @@ -109,9 +108,8 @@ bool do_intersect_coplanar(const typename K::Point_3& A, return coplanar_orientation(*a,*b,p) != NEGATIVE && coplanar_orientation(*c,*a,q) != NEGATIVE; - default:// should not happen. + default: CGAL_unreachable(); - return false; } case COLLINEAR: switch ( pqb ) { @@ -139,14 +137,11 @@ bool do_intersect_coplanar(const typename K::Point_3& A, // case pqc == COLLINEAR is impossible since the triangle is // assumed to be non flat - default:// should not happen. + default: CGAL_unreachable(); - return false; - } - default:// should not happen. + default: CGAL_unreachable(); - return false; } } @@ -215,9 +210,8 @@ do_intersect(const typename K::Triangle_3& t, return orientation(p,q,a,b) != POSITIVE && orientation(p,q,b,c) != POSITIVE && orientation(p,q,c,a) != POSITIVE; - default: // should not happen. + default: CGAL_unreachable(); - return false; } case NEGATIVE: switch ( abcq ) { @@ -237,9 +231,8 @@ do_intersect(const typename K::Triangle_3& t, && orientation(q,p,b,c) != POSITIVE && orientation(q,p,c,a) != POSITIVE; - default: // should not happen. + default: CGAL_unreachable(); - return false; } case COPLANAR: // p belongs to the triangle's supporting plane switch ( abcq ) { @@ -259,13 +252,11 @@ do_intersect(const typename K::Triangle_3& t, // supporting plane return do_intersect_coplanar(t,s,k); - default: // should not happen. + default: CGAL_unreachable(); - return false; } - default: // should not happen. + default: CGAL_unreachable(); - return false; } } diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_do_intersect.h index 6f5a8a5eec3b..9163fde0f40d 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_do_intersect.h @@ -305,21 +305,18 @@ do_intersect(const typename K::Triangle_3& t1, case COPLANAR: return do_intersect_coplanar(t1,t2,k); - default: // should not happen. + default: CGAL_unreachable(); - return false; } break; - default: // should not happen. + default: CGAL_unreachable(); - return false; } break; - default: // should not happen. + default: CGAL_unreachable(); - return false; } const Point_3* s_min2; @@ -430,21 +427,18 @@ do_intersect(const typename K::Triangle_3& t1, // since the triangles are assumed to be non-flat return do_intersect_coplanar(t1,t2,k); - default: // should not happen. + default: CGAL_unreachable(); - return false; } break; - default: // should not happen. + default: CGAL_unreachable(); - return false; } break; - default: // should not happen. + default: CGAL_unreachable(); - return false; } return (orientation(*s_min1,*t_min1,*s_min2,*t_min2) != POSITIVE) && diff --git a/Kinetic_space_partition/include/CGAL/KSP_3/Finalizer.h b/Kinetic_space_partition/include/CGAL/KSP_3/Finalizer.h index 6b225fa4f57e..08cf676664ea 100644 --- a/Kinetic_space_partition/include/CGAL/KSP_3/Finalizer.h +++ b/Kinetic_space_partition/include/CGAL/KSP_3/Finalizer.h @@ -415,7 +415,6 @@ class Finalizer { } CGAL_unreachable(); - return false; } IVertex non_collinear_vertex(const PFace& pface, const IEdge& iedge) const { diff --git a/Mesh_3/include/CGAL/Mesh_3/Robust_intersection_traits_3.h b/Mesh_3/include/CGAL/Mesh_3/Robust_intersection_traits_3.h index b26e7b1f6496..19ac20f0702b 100644 --- a/Mesh_3/include/CGAL/Mesh_3/Robust_intersection_traits_3.h +++ b/Mesh_3/include/CGAL/Mesh_3/Robust_intersection_traits_3.h @@ -389,7 +389,6 @@ ts_intersection(const typename K::Triangle_3 &t, return result_type(); default: CGAL_unreachable(); - return result_type(); } } } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersect_triangle_and_segment_3.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersect_triangle_and_segment_3.h index 4ee58d791666..c34dc8aadaed 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersect_triangle_and_segment_3.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersect_triangle_and_segment_3.h @@ -128,7 +128,6 @@ intersection_type( default: CGAL_unreachable(); - return result_type(EMPTY,GT::null_halfedge(),false,false); } case NEGATIVE: switch ( abcq ) { @@ -145,7 +144,6 @@ intersection_type( return find_intersection(q,p,a,b,c,h_2,tm2,false,true); default: CGAL_unreachable(); - return result_type(EMPTY,GT::null_halfedge(),false,false); } case COPLANAR: // p belongs to the triangle's supporting plane switch ( abcq ) { @@ -165,11 +163,9 @@ intersection_type( default: CGAL_unreachable(); - return result_type(EMPTY,GT::null_halfedge(),false,false); } default: CGAL_unreachable(); - return result_type(EMPTY,GT::null_halfedge(),false,false); } } diff --git a/Straight_skeleton_2/include/CGAL/Trisegment_2.h b/Straight_skeleton_2/include/CGAL/Trisegment_2.h index 84143a5d6dd1..38ec084673b5 100644 --- a/Straight_skeleton_2/include/CGAL/Trisegment_2.h +++ b/Straight_skeleton_2/include/CGAL/Trisegment_2.h @@ -167,7 +167,6 @@ class Trisegment_2 return w(2); default: CGAL_unreachable(); - return w(0); // arbitrary, meaningless value because a const& is expected } } diff --git a/TDS_2/include/CGAL/Triangulation_data_structure_2.h b/TDS_2/include/CGAL/Triangulation_data_structure_2.h index 0b7b5d70a5ef..4aa6fdafec0a 100644 --- a/TDS_2/include/CGAL/Triangulation_data_structure_2.h +++ b/TDS_2/include/CGAL/Triangulation_data_structure_2.h @@ -1119,7 +1119,7 @@ insert_dim_up(Vertex_handle w, bool orient) break; default: CGAL_unreachable(); - break; } + } return v; } diff --git a/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h index 6988b39ce5b9..6e8d9ba164cc 100644 --- a/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h @@ -490,7 +490,6 @@ class Constrained_Delaunay_triangulation_2 return pit; } CGAL_unreachable(); - return std::make_pair(fit,eit); } template diff --git a/Triangulation_2/include/CGAL/Triangulation_2.h b/Triangulation_2/include/CGAL/Triangulation_2.h index a7c1b5430623..dc0de4ed4745 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_2.h @@ -1488,8 +1488,7 @@ insert(const Point& p, Locate_type lt, Face_handle loc, int li) case VERTEX: return loc->vertex(li); } - CGAL_unreachable(); // AF: The comment "locate step failed" gives the idea that it may fail, but all cases are covered - return Vertex_handle(); + CGAL_unreachable(); } diff --git a/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h b/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h index 6f25e793fda1..6b2288f5d338 100644 --- a/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_segment_traverser_3.h @@ -944,9 +944,7 @@ class Triangulation_segment_simplex_iterator_3 default: CGAL_unreachable(); } - //should not be reached CGAL_unreachable(); - return false; } bool cell_has_edge(const Cell_handle ch, const Edge& e) const @@ -1056,7 +1054,7 @@ class Triangulation_segment_simplex_iterator_3 } while (++circ != end); std::cerr << "There is no facet shared by e and v" << std::endl; - CGAL_unreachable(); + CGAL_assertion(false); return Facet(Cell_handle(), 0); } @@ -1073,7 +1071,7 @@ class Triangulation_segment_simplex_iterator_3 } while (++circ != end); std::cerr << "There is no cell shared by e and v" << std::endl; - CGAL_unreachable(); + CGAL_assertion(false); return Cell_handle(); } diff --git a/Visibility_2/include/CGAL/Rotational_sweep_visibility_2.h b/Visibility_2/include/CGAL/Rotational_sweep_visibility_2.h index fd7bfd719a8e..bbd74ca53d87 100644 --- a/Visibility_2/include/CGAL/Rotational_sweep_visibility_2.h +++ b/Visibility_2/include/CGAL/Rotational_sweep_visibility_2.h @@ -238,7 +238,6 @@ class Rotational_sweep_visibility_2 { } CGAL_unreachable(); - return false; } };