From 9ed9a45a085d95c7c83b5cb9f70b018d34a1980c Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 25 Sep 2024 15:49:47 +0100 Subject: [PATCH 01/24] CGAL: Deal with CGAL_assertion(false) --- .../CGAL/Algebraic_kernel_d/Curve_analysis_2.h | 2 +- .../Alpha_shapes_2/internal/Lazy_alpha_nt_2.h | 4 ++-- .../Alpha_shapes_3/internal/Lazy_alpha_nt_3.h | 2 +- .../CGAL/Arr_point_location/Td_X_trapezoid.h | 5 ++--- .../include/CGAL/Compute_cone_boundaries_2.h | 6 ++---- .../include/CGAL/Construct_yao_graph_2.h | 5 +---- .../include/CGAL/KSP_3/Intersection_graph.h | 2 +- .../Lab/Plugins/PCA/Affine_transform_plugin.cpp | 2 +- ...Map_linear_cell_complex_storages_with_index.h | 8 ++------ Mesh_3/include/CGAL/Mesh_3/Lloyd_move.h | 4 +--- .../intersect_triangle_and_segment_3.h | 16 ++++++++-------- .../Two_vertices_parameterizer_3.h | 4 ++-- .../CGAL/Triangulation_data_structure_2.h | 2 +- .../internal/smooth_vertices.h | 2 +- .../internal/tetrahedral_remeshing_helpers.h | 2 +- .../CGAL/Constrained_Delaunay_triangulation_2.h | 2 +- Triangulation_2/include/CGAL/Triangulation_2.h | 2 +- 17 files changed, 29 insertions(+), 41 deletions(-) diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_analysis_2.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_analysis_2.h index 6fecb592a121..9e46877c7d5f 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_analysis_2.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Curve_analysis_2.h @@ -890,7 +890,7 @@ class Curve_analysis_2 : public ::CGAL::Handle_with_policy< Rep_ > { break; } default:{ - CGAL_assertion(false); // !!! Never reached + CGAL_unreachable(); } } } diff --git a/Alpha_shapes_2/include/CGAL/Alpha_shapes_2/internal/Lazy_alpha_nt_2.h b/Alpha_shapes_2/include/CGAL/Alpha_shapes_2/internal/Lazy_alpha_nt_2.h index 6d77e38f9045..c2fa9ca8d71e 100644 --- a/Alpha_shapes_2/include/CGAL/Alpha_shapes_2/internal/Lazy_alpha_nt_2.h +++ b/Alpha_shapes_2/include/CGAL/Alpha_shapes_2/internal/Lazy_alpha_nt_2.h @@ -212,7 +212,7 @@ class Lazy_alpha_nt_2 exact_ = Exact_squared_radius()( to_exact(*data().p0),to_exact(*data().p1),to_exact(*data().p2) ); break; default: - CGAL_assertion(false); + CGAL_unreachable(); } } @@ -229,7 +229,7 @@ class Lazy_alpha_nt_2 approx_ = Approx_squared_radius()( to_approx(*data().p0),to_approx(*data().p1),to_approx(*data().p2) ); break; default: - CGAL_assertion(false); + CGAL_unreachable()); } } diff --git a/Alpha_shapes_3/include/CGAL/Alpha_shapes_3/internal/Lazy_alpha_nt_3.h b/Alpha_shapes_3/include/CGAL/Alpha_shapes_3/internal/Lazy_alpha_nt_3.h index 219c307815a1..6023edd8e8bc 100644 --- a/Alpha_shapes_3/include/CGAL/Alpha_shapes_3/internal/Lazy_alpha_nt_3.h +++ b/Alpha_shapes_3/include/CGAL/Alpha_shapes_3/internal/Lazy_alpha_nt_3.h @@ -224,7 +224,7 @@ class Lazy_alpha_nt_3{ approx_ = Approx_squared_radius()( to_approx(*data().p0),to_approx(*data().p1),to_approx(*data().p2),to_approx(*data().p3) ); break; default: - CGAL_assertion(false); + CGAL_unreachable(); } } diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_X_trapezoid.h b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_X_trapezoid.h index 9904b1705420..674db5583fe0 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_X_trapezoid.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_point_location/Td_X_trapezoid.h @@ -605,10 +605,9 @@ class Td_X_trapezoid : public Handle case CGAL_TD_VERTEX: return TD_VERTEX; default: - CGAL_assertion(false); - return TD_TRAPEZOID; - } + CGAL_unreachable(); } + } /*! Access trapezoid type flag. */ CGAL_TD_INLINE unsigned char type_flag() const diff --git a/Cone_spanners_2/include/CGAL/Compute_cone_boundaries_2.h b/Cone_spanners_2/include/CGAL/Compute_cone_boundaries_2.h index 4256fd0dc179..f1e83b22b0ba 100644 --- a/Cone_spanners_2/include/CGAL/Compute_cone_boundaries_2.h +++ b/Cone_spanners_2/include/CGAL/Compute_cone_boundaries_2.h @@ -91,10 +91,8 @@ class Compute_cone_boundaries_2 { DirectionOutputIterator operator()(const unsigned int cone_number, const Direction_2& initial_direction, DirectionOutputIterator result) { - if (cone_number<2) { - std::cout << "The number of cones must be larger than 1!" << std::endl; - CGAL_assertion(false); - } + + CGAL_assertion_msg(cone_number>1, "The number of cones must be larger than 1"); *result++ = initial_direction; diff --git a/Cone_spanners_2/include/CGAL/Construct_yao_graph_2.h b/Cone_spanners_2/include/CGAL/Construct_yao_graph_2.h index 8f2b599f311a..71b4f338dd4b 100644 --- a/Cone_spanners_2/include/CGAL/Construct_yao_graph_2.h +++ b/Cone_spanners_2/include/CGAL/Construct_yao_graph_2.h @@ -93,10 +93,7 @@ class Construct_yao_graph_2 { ): cone_number(k), cones_choice(cones_selected), rays(std::vector(k)) { - if (k<2) { - std::cout << "The number of cones must be larger than 1!" << std::endl; - CGAL_assertion(false); - } + CGAL_assertion_msg(k>1, "The number of cones must be larger than 1"); /* Initialize a functor, specialization will happen here depending on the kernel type to compute the cone boundaries either exactly or inexactly */ diff --git a/Kinetic_space_partition/include/CGAL/KSP_3/Intersection_graph.h b/Kinetic_space_partition/include/CGAL/KSP_3/Intersection_graph.h index e86d696bc0b8..a8779480c0ba 100644 --- a/Kinetic_space_partition/include/CGAL/KSP_3/Intersection_graph.h +++ b/Kinetic_space_partition/include/CGAL/KSP_3/Intersection_graph.h @@ -420,7 +420,7 @@ class Intersection_graph { } void set_crossed(const Edge_descriptor& edge, std::size_t sp_idx) { - CGAL_assertion(false); + CGAL_assertion(false); // AF: I am surprised that after the assert we do something m_graph[edge].crossed.insert(sp_idx); } }; diff --git a/Lab/demo/Lab/Plugins/PCA/Affine_transform_plugin.cpp b/Lab/demo/Lab/Plugins/PCA/Affine_transform_plugin.cpp index 0edc6f05f184..0231529e6928 100644 --- a/Lab/demo/Lab/Plugins/PCA/Affine_transform_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PCA/Affine_transform_plugin.cpp @@ -728,7 +728,7 @@ end() endPolygonMesh(transform_matrix); break; default: - CGAL_assertion(false); + CGAL_unreachable(); } dockWidget->hide(); diff --git a/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages_with_index.h b/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages_with_index.h index c85b1476fb9a..5303221a9f35 100644 --- a/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages_with_index.h +++ b/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages_with_index.h @@ -191,12 +191,8 @@ namespace CGAL { // Allocate a dart for null_dart_descriptor assert(mdarts.empty()); // the compact container is empty Dart_index local_null_dart_descriptor = mdarts.emplace(); - if(local_null_dart_descriptor!=0) - { - std::cerr<<"[ERROR] fatal in CMap_linear_cell_complex_storage_with_index::init_storage" - <source(), s->target()); else { - CGAL_assertion(false); + CGAL_assertion(false); AF: So are we not completely sure? return std::nullopt; } }; diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h index 2e93f2f8335a..c39c85f31111 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/tetrahedral_remeshing_helpers.h @@ -844,7 +844,7 @@ void set_index(typename C3t3::Vertex_handle v, const C3t3& c3t3) case -1://far points from concurrent Mesh_3 break; default: - CGAL_assertion(false); + CGAL_unreachable(); } } diff --git a/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h b/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h index 714e9295b61f..6988b39ce5b9 100644 --- a/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Constrained_Delaunay_triangulation_2.h @@ -489,7 +489,7 @@ class Constrained_Delaunay_triangulation_2 pit = propagate_conflicts(p,fh,2,pit); return pit; } - CGAL_assertion(false); + CGAL_unreachable(); return std::make_pair(fit,eit); } diff --git a/Triangulation_2/include/CGAL/Triangulation_2.h b/Triangulation_2/include/CGAL/Triangulation_2.h index 433ea5cb5af3..a7c1b5430623 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_2.h @@ -1488,7 +1488,7 @@ insert(const Point& p, Locate_type lt, Face_handle loc, int li) case VERTEX: return loc->vertex(li); } - CGAL_assertion(false); // locate step failed + CGAL_unreachable(); // AF: The comment "locate step failed" gives the idea that it may fail, but all cases are covered return Vertex_handle(); } From 0d5faec8dfb726557778ba9cf890f53990aed6f9 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 25 Sep 2024 16:15:30 +0100 Subject: [PATCH 02/24] typo --- .../internal/Corefinement/intersect_triangle_and_segment_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 afc259d4eabd..4ee58d791666 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 @@ -167,7 +167,7 @@ intersection_type( CGAL_unreachable(); return result_type(EMPTY,GT::null_halfedge(),false,false); } - default:. + default: CGAL_unreachable(); return result_type(EMPTY,GT::null_halfedge(),false,false); } From 33812aa8a0c1ba169a67c802b74b618e46d43550 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 25 Sep 2024 16:18:48 +0100 Subject: [PATCH 03/24] typo --- .../CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h index 37fa53280065..29ad14a7255b 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h @@ -875,7 +875,7 @@ std::size_t smooth_vertices_on_surfaces(C3t3& c3t3, return CGAL::midpoint(s->source(), s->target()); else { - CGAL_assertion(false); AF: So are we not completely sure? + CGAL_assertion(false); // AF: So are we not completely sure? return std::nullopt; } }; From b27baeb94590f503ac4c8e1df3bd7e5e7ccbe87f Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 25 Sep 2024 17:05:52 +0100 Subject: [PATCH 04/24] more replacements --- .../include/CGAL/Alpha_shapes_2/internal/Lazy_alpha_nt_2.h | 2 +- Cone_spanners_2/include/CGAL/Construct_theta_graph_2.h | 5 +---- Kinetic_space_partition/include/CGAL/KSP_3/Finalizer.h | 2 +- .../internal/Isotropic_remeshing/remesh_impl.h | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Alpha_shapes_2/include/CGAL/Alpha_shapes_2/internal/Lazy_alpha_nt_2.h b/Alpha_shapes_2/include/CGAL/Alpha_shapes_2/internal/Lazy_alpha_nt_2.h index c2fa9ca8d71e..fb2b69ce0737 100644 --- a/Alpha_shapes_2/include/CGAL/Alpha_shapes_2/internal/Lazy_alpha_nt_2.h +++ b/Alpha_shapes_2/include/CGAL/Alpha_shapes_2/internal/Lazy_alpha_nt_2.h @@ -229,7 +229,7 @@ class Lazy_alpha_nt_2 approx_ = Approx_squared_radius()( to_approx(*data().p0),to_approx(*data().p1),to_approx(*data().p2) ); break; default: - CGAL_unreachable()); + CGAL_unreachable(); } } diff --git a/Cone_spanners_2/include/CGAL/Construct_theta_graph_2.h b/Cone_spanners_2/include/CGAL/Construct_theta_graph_2.h index d4b47ed33c22..d36a7068f141 100644 --- a/Cone_spanners_2/include/CGAL/Construct_theta_graph_2.h +++ b/Cone_spanners_2/include/CGAL/Construct_theta_graph_2.h @@ -99,10 +99,7 @@ class Construct_theta_graph_2 { ): cone_number(k), cones_choice(cones_selected), rays(std::vector(k)) { - if (k<2) { - std::cout << "The number of cones must be larger than 1!" << std::endl; - CGAL_assertion(false); - } + CGAL_assertion_msg(k>1, "The number of cones must be larger than 1"); /* Initialize a functor, specialization will happen here depending on the kernel type to compute the cone boundaries either exactly or inexactly */ diff --git a/Kinetic_space_partition/include/CGAL/KSP_3/Finalizer.h b/Kinetic_space_partition/include/CGAL/KSP_3/Finalizer.h index 8b1c033e8b44..6b225fa4f57e 100644 --- a/Kinetic_space_partition/include/CGAL/KSP_3/Finalizer.h +++ b/Kinetic_space_partition/include/CGAL/KSP_3/Finalizer.h @@ -414,7 +414,7 @@ class Finalizer { return true; } - CGAL_assertion(false); + CGAL_unreachable(); return false; } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index 4d5622c6f0d8..b2188894a679 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -1940,7 +1940,7 @@ namespace internal { else if(is_on_mesh(h)) nb_mesh++; else if(is_on_border(h)) nb_border++; else if(is_an_isolated_constraint(h)) nb_isolated++; - else CGAL_assertion(false); + else CGAL_unreachable(); } CGAL_USE(nb_border); CGAL_USE(nb_mesh); From c01dae9989f616152b7f20f62546590eaaa95593 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 25 Sep 2024 17:10:06 +0100 Subject: [PATCH 05/24] As there are exactly 3 cases we make the third one default --- .../include/CGAL/Triangulation_on_sphere_2.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2.h b/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2.h index 545e54ac112e..7df4e2ad7361 100644 --- a/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2.h +++ b/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2.h @@ -964,18 +964,12 @@ march_locate_2D(Face_handle f, li = (o0 == COLLINEAR) ? 2 : (o1 == COLLINEAR) ? 0 : 1; break; } - case 2: + default: // i.e., case 2: { lt = VERTEX; li = (o0 != COLLINEAR) ? 2 : (o1 != COLLINEAR) ? 0 : 1; break; } - default: - { - // impossible - CGAL_assertion(false); - return f; - } } test_distance(t, f, lt, li); From ae087e2c91ab287dd01f95917a9074d40ce4ee8b Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 25 Sep 2024 17:25:11 +0100 Subject: [PATCH 06/24] Remove a static function in a class that only serves for specializing it --- .../internal/Functors_for_face_graph_wrapper.h | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Functors_for_face_graph_wrapper.h b/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Functors_for_face_graph_wrapper.h index 200ffb829379..550b4de1dfec 100644 --- a/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Functors_for_face_graph_wrapper.h +++ b/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Functors_for_face_graph_wrapper.h @@ -36,16 +36,8 @@ namespace internal { /// Get_beta template struct Get_beta -{ - typedef typename boost::graph_traits::halfedge_descriptor Dart_const_descriptor; +{}; - static Dart_const_descriptor value(const HEG& /*heg*/, Dart_const_descriptor /*dh*/) - { - std::cout<<"ERROR Get_beta"< struct Get_beta { From 4d4de0da5176264c9bbb588225df7d5127edd23b Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 26 Sep 2024 11:57:39 +0100 Subject: [PATCH 07/24] next batch of changes --- .../CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h | 9 ++------- .../CGAL/Alpha_shapes_3/internal/Lazy_alpha_nt_3.h | 2 +- Classification/include/CGAL/Classification/Image.h | 2 +- Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h | 6 ++---- .../CGAL/Optimal_bounding_box/internal/optimize_2.h | 5 +---- Straight_skeleton_2/include/CGAL/Trisegment_2.h | 4 ++-- .../include/CGAL/Surface_mesh_deformation.h | 3 +-- .../internal/Functors_for_face_graph_wrapper.h | 3 +-- .../Tetrahedral_remeshing/internal/smooth_vertices.h | 7 ++----- 9 files changed, 13 insertions(+), 28 deletions(-) diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h index c3be1d699544..409087417e56 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h @@ -1665,13 +1665,8 @@ class Algebraic_curve_kernel_2 : public AlgebraicKernel_d_1{ const Polynomial_2& f = ca1.polynomial_2(); const Polynomial_2& g = ca2.polynomial_2(); - if(f == g) { - // both curves are equal, but have different representations! - // std::cout <<"f: " << f <gcd_cache_2(); typedef typename Curve_analysis_2::size_type size_type; Polynomial_2 gcd = gcd_cache(std::make_pair(f,g)); diff --git a/Alpha_shapes_3/include/CGAL/Alpha_shapes_3/internal/Lazy_alpha_nt_3.h b/Alpha_shapes_3/include/CGAL/Alpha_shapes_3/internal/Lazy_alpha_nt_3.h index 6023edd8e8bc..2603c6af7849 100644 --- a/Alpha_shapes_3/include/CGAL/Alpha_shapes_3/internal/Lazy_alpha_nt_3.h +++ b/Alpha_shapes_3/include/CGAL/Alpha_shapes_3/internal/Lazy_alpha_nt_3.h @@ -205,7 +205,7 @@ class Lazy_alpha_nt_3{ exact_ = Exact_squared_radius()( to_exact(*data().p0),to_exact(*data().p1),to_exact(*data().p2),to_exact(*data().p3) ); break; default: - CGAL_assertion(false); + CGAL_unreachable(); } } diff --git a/Classification/include/CGAL/Classification/Image.h b/Classification/include/CGAL/Classification/Image.h index 084e9572764a..afdee2d6e2a4 100644 --- a/Classification/include/CGAL/Classification/Image.h +++ b/Classification/include/CGAL/Classification/Image.h @@ -46,7 +46,7 @@ class Image // https://github.com/boostorg/core/issues/148 Image(const Image&) { - CGAL_assertion(false); + CGAL_unreachable(); } Image () : m_width(0), m_height(0), m_depth(0) diff --git a/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h b/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h index b0de017c924f..0f9d64487af5 100644 --- a/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h +++ b/Mesh_3/include/CGAL/Mesh_3/C3T3_helpers.h @@ -73,10 +73,8 @@ class Intrusive_list { } - Intrusive_list(const Intrusive_list& ) - { - CGAL_assertion(false); - } + Intrusive_list(const Intrusive_list& ) = delete; + #ifdef CGAL_CONSTRUCT_INTRUSIVE_LIST_RANGE_CONSTRUCTOR template diff --git a/Optimal_bounding_box/include/CGAL/Optimal_bounding_box/internal/optimize_2.h b/Optimal_bounding_box/include/CGAL/Optimal_bounding_box/internal/optimize_2.h index ae450d781e8d..e24b50b51627 100644 --- a/Optimal_bounding_box/include/CGAL/Optimal_bounding_box/internal/optimize_2.h +++ b/Optimal_bounding_box/include/CGAL/Optimal_bounding_box/internal/optimize_2.h @@ -169,6 +169,7 @@ void optimize_along_OBB_axes(typename Traits::Matrix& rot, auto it = std::min_element(volumes.begin(), volumes.end()); typename std::iterator_traits::difference_type d = std::distance(volumes.begin(), it); + CGAL_assertion(d == 0 || d == 1 || d == 2); #ifdef CGAL_OPTIMAL_BOUNDING_BOX_DEBUG_PP std::cout << "volumes: " << volumes[0] << " " << volumes[1] << " " << volumes[2] << std::endl; @@ -212,10 +213,6 @@ void optimize_along_OBB_axes(typename Traits::Matrix& rot, rot = opt * rot; } - else - { - CGAL_assertion(false); - } } // This operation makes no sense if an exact number type is used, so skip it, if so diff --git a/Straight_skeleton_2/include/CGAL/Trisegment_2.h b/Straight_skeleton_2/include/CGAL/Trisegment_2.h index ce7fa34a79c0..84143a5d6dd1 100644 --- a/Straight_skeleton_2/include/CGAL/Trisegment_2.h +++ b/Straight_skeleton_2/include/CGAL/Trisegment_2.h @@ -148,7 +148,7 @@ class Trisegment_2 case TRISEGMENT_COLLINEARITY_02: return e(2); default: - CGAL_assertion(false); + CGAL_unreachable(); return e(0); // arbitrary, meaningless value because a const& is expected } } @@ -166,7 +166,7 @@ class Trisegment_2 case TRISEGMENT_COLLINEARITY_02: return w(2); default: - CGAL_assertion(false); + CGAL_unreachable(); return w(0); // arbitrary, meaningless value because a const& is expected } } diff --git a/Surface_mesh_deformation/include/CGAL/Surface_mesh_deformation.h b/Surface_mesh_deformation/include/CGAL/Surface_mesh_deformation.h index a536e13ddaed..f1129a6e79f0 100644 --- a/Surface_mesh_deformation/include/CGAL/Surface_mesh_deformation.h +++ b/Surface_mesh_deformation/include/CGAL/Surface_mesh_deformation.h @@ -556,6 +556,7 @@ class Surface_mesh_deformation erase_control_vertex(vd); // also erase from being control typename std::vector::iterator it = std::find(roi.begin(), roi.end(), vd); + CGAL_assertion_msg(it != roi.end(), "inconsistency between is_roi_map, and roi vector"); if(it != roi.end()) { is_roi_map[id(vd)] = false; @@ -564,8 +565,6 @@ class Surface_mesh_deformation need_preprocess_both(); return true; } - - CGAL_assertion(false); // inconsistency between is_roi_map, and roi vector! return false; } diff --git a/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Functors_for_face_graph_wrapper.h b/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Functors_for_face_graph_wrapper.h index 550b4de1dfec..52e386b0000f 100644 --- a/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Functors_for_face_graph_wrapper.h +++ b/Surface_mesh_topology/include/CGAL/Surface_mesh_topology/internal/Functors_for_face_graph_wrapper.h @@ -35,8 +35,7 @@ namespace internal { //////////////////////////////////////////////////////////////////////////////// /// Get_beta template -struct Get_beta -{}; +struct Get_beta; template struct Get_beta diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h index 29ad14a7255b..d54f00dfff81 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h @@ -871,12 +871,9 @@ std::size_t smooth_vertices_on_surfaces(C3t3& c3t3, { const auto intersection = proj.value().first; using Segment = typename Tr::Geom_traits::Segment_3; - if (const Segment* s = std::get_if(&intersection)) + if (const Segment* s = std::get_if(&intersection)){ + CGAL_assertion(s != nullptr); return CGAL::midpoint(s->source(), s->target()); - else - { - CGAL_assertion(false); // AF: So are we not completely sure? - return std::nullopt; } }; From 182f98390d15a24ff12748d1f4a25c03b587da40 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 26 Sep 2024 13:41:34 +0100 Subject: [PATCH 08/24] Remove unused function --- .../include/CGAL/KSP_3/Intersection_graph.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Kinetic_space_partition/include/CGAL/KSP_3/Intersection_graph.h b/Kinetic_space_partition/include/CGAL/KSP_3/Intersection_graph.h index a8779480c0ba..99b19ceb13d2 100644 --- a/Kinetic_space_partition/include/CGAL/KSP_3/Intersection_graph.h +++ b/Kinetic_space_partition/include/CGAL/KSP_3/Intersection_graph.h @@ -419,10 +419,6 @@ class Intersection_graph { return m_graph[edge].crossed.count(sp_idx) == 1; } - void set_crossed(const Edge_descriptor& edge, std::size_t sp_idx) { - CGAL_assertion(false); // AF: I am surprised that after the assert we do something - m_graph[edge].crossed.insert(sp_idx); - } }; template std::size_t Intersection_graph::Edge_property::edge_counter = 0; From 292eee20d851a1a50751baae50aa8b795395a174 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 26 Sep 2024 14:16:30 +0100 Subject: [PATCH 09/24] another batch --- .../include/CGAL/Combinatorial_map_storages_with_index.h | 7 +------ .../include/CGAL/Poisson_reconstruction_function.h | 6 +----- .../Segment_Delaunay_graph_Linf_2/Basic_predicates_C2.h | 2 +- .../Segment_Delaunay_graph_Linf_2/Vertex_conflict_C2.h | 6 +++--- .../Segment_Delaunay_graph_Linf_2/Voronoi_vertex_ring_C2.h | 2 +- .../Voronoi_vertex_sqrt_field_new_C2.h | 2 +- .../internal/orbifold_cone_helper.h | 6 ++---- .../include/CGAL/Triangulation_on_sphere_2.h | 2 +- 8 files changed, 11 insertions(+), 22 deletions(-) diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_storages_with_index.h b/Combinatorial_map/include/CGAL/Combinatorial_map_storages_with_index.h index d69147d18206..67eb310a61df 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_storages_with_index.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_storages_with_index.h @@ -170,12 +170,7 @@ namespace CGAL { // Allocate a dart for null_dart_descriptor assert(mdarts.empty()); // the compact container is empty Dart_index local_null_dart_descriptor = mdarts.emplace(); - if(local_null_dart_descriptor!=0) - { - std::cerr<<"[ERROR] fatal in Combinatorial_map_storage_with_index::init_storage" - <point()) != ZERO ); diff --git a/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_sqrt_field_new_C2.h b/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_sqrt_field_new_C2.h index 8ea071730250..da5fad7947cc 100644 --- a/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_sqrt_field_new_C2.h +++ b/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_sqrt_field_new_C2.h @@ -1120,7 +1120,7 @@ class Voronoi_vertex_sqrt_field_new_C2 } else if (bdiff == 6) { compute_pss_lines_side(p, lq, lr, (br+1)%8); } else { - CGAL_assertion( false ); + CGAL_assertion(false); } CGAL_assertion( oriented_side_of_line(lq, this->point()) != ZERO ); CGAL_assertion( oriented_side_of_line(lr, this->point()) != ZERO ); diff --git a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/internal/orbifold_cone_helper.h b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/internal/orbifold_cone_helper.h index 48610f5e5236..3705683ce0cf 100644 --- a/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/internal/orbifold_cone_helper.h +++ b/Surface_mesh_parameterization/include/CGAL/Surface_mesh_parameterization/internal/orbifold_cone_helper.h @@ -122,8 +122,7 @@ void find_start_cone(const ConeMap& cmap, return; } - std::cerr << "Error: did not find first cone" << std::endl; - CGAL_postcondition(false); + CGAL_postcondition_msg(false,"Error: did not find first cone"); } // Locate the cone tagged 'First_unique_cone' in the seam mesh. @@ -143,8 +142,7 @@ void find_start_cone(const ConeMap& cmap, return; } - std::cerr << "Error: did not find first cone" << std::endl; - CGAL_postcondition(false); + CGAL_postcondition_msg(false,"Error: did not find first cone"); } /// Check the validity of the input cones in the `Seam_mesh` mesh. diff --git a/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2.h b/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2.h index 7df4e2ad7361..36498b6c59ed 100644 --- a/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2.h +++ b/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2.h @@ -780,7 +780,7 @@ march_locate_2D(Face_handle f, } } - CGAL_precondition(false); + CGAL_assertion(false); } } From 2b156447547d0c95f2278a1f6ccf89e86bcd78a5 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 26 Sep 2024 15:14:07 +0100 Subject: [PATCH 10/24] Add _msg --- .../include/CGAL/Combinatorial_map_storages_with_index.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_storages_with_index.h b/Combinatorial_map/include/CGAL/Combinatorial_map_storages_with_index.h index 67eb310a61df..7a64159fb71a 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_storages_with_index.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_storages_with_index.h @@ -170,7 +170,7 @@ namespace CGAL { // Allocate a dart for null_dart_descriptor assert(mdarts.empty()); // the compact container is empty Dart_index local_null_dart_descriptor = mdarts.emplace(); - CGAL_assertion(local_null_dart_descriptor ==0, "[ERROR] fatal in Combinatorial_map_storage_with_index::init_storage"); + CGAL_assertion_msg(local_null_dart_descriptor ==0, "[ERROR] fatal in Combinatorial_map_storage_with_index::init_storage"); } void clear_storage() From 5590b06c5af8d610a83c2f62641fe952f3e49cfb Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 26 Sep 2024 15:37:23 +0100 Subject: [PATCH 11/24] Deal with 2D intersections --- .../include/CGAL/Intersections_2/Ray_2_Ray_2.h | 3 ++- .../CGAL/Intersections_2/Ray_2_Segment_2.h | 3 ++- .../CGAL/Intersections_2/Segment_2_Segment_2.h | 7 ++++--- .../internal/Line_3_Triangle_3_do_intersect.h | 5 +++-- .../internal/Plane_3_Triangle_3_do_intersect.h | 3 ++- .../internal/Point_3_Triangle_3_do_intersect.h | 5 +++-- .../internal/Ray_3_Triangle_3_do_intersect.h | 17 +++++++++-------- .../Segment_3_Triangle_3_do_intersect.h | 18 +++++++++--------- .../Triangle_3_Triangle_3_do_intersect.h | 13 +++++++------ .../CGAL/Mesh_3/Robust_intersection_traits_3.h | 4 ++-- 10 files changed, 43 insertions(+), 35 deletions(-) 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 850f3e364b07..b496228e513f 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 @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -185,7 +186,7 @@ Ray_2_Ray_2_pair::intersection_type() const } } default: - CGAL_kernel_assertion(false); // should not be reached: + CGAL_unreachable(); // should not be reached: return _result; } } 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 acc6d4a41dfa..b1449ce8dc6e 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 @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -203,7 +204,7 @@ Ray_2_Segment_2_pair::intersection_type() const } } default: - CGAL_kernel_assertion(false); // should not be reached: + CGAL_unreachable(); // should not be reached: return _result; } 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 28d7920bd2a9..e1f2a06aa753 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 @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -141,7 +142,7 @@ seg_seg_do_intersect_crossing( default: CGAL_unreachable(); } - CGAL_kernel_assertion(false); + CGAL_unreachable(); return S2S2_inter_info(false); } @@ -202,7 +203,7 @@ seg_seg_do_intersect_contained( default: CGAL_unreachable(); } - CGAL_kernel_assertion(false); + CGAL_unreachable(); return S2S2_inter_info(false); } @@ -319,7 +320,7 @@ do_intersect_with_info(const typename K::Segment_2 &seg1, CGAL_unreachable(); } - CGAL_kernel_assertion(false); + 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 a5b5dd1fc76b..72bc2e928dd5 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 @@ -15,6 +15,7 @@ #include #include +#include namespace CGAL { namespace Intersections { @@ -58,11 +59,11 @@ do_intersect(const typename K::Triangle_3& t, case NEGATIVE: return (orientation(p,q,c,a) != POSITIVE); case COPLANAR: return true; default: // should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return false; } default: // should not happen. - CGAL_kernel_assertion(false); + 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 ea0462dadd6e..4a4af5eb4f11 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 @@ -15,6 +15,7 @@ #include #include +#include namespace CGAL { namespace Intersections { @@ -43,7 +44,7 @@ do_intersect(const typename K::Triangle_3& t, case ON_ORIENTED_BOUNDARY: return true; default:// should not happen. - CGAL_kernel_assertion(false); + 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 f22d551e8421..57f680a528a2 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 @@ -15,6 +15,7 @@ #include #include +#include namespace CGAL { namespace Intersections { @@ -59,11 +60,11 @@ do_intersect(const typename K::Triangle_3& t, return (coplanar_orientation(c,a,p) != POSITIVE); case COLLINEAR: return true; default: // should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return false; } default: // should not happen. - CGAL_kernel_assertion(false); + 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 ada4bc5207eb..768299a27b7b 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 @@ -15,6 +15,7 @@ #include #include +#include namespace CGAL { namespace Intersections { @@ -140,7 +141,7 @@ do_intersect_coplanar(const typename K::Triangle_3& t, return visitor.result(coplanar_orientation(*a,*c,p) != POSITIVE); default: // should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return visitor.result(false); } @@ -166,7 +167,7 @@ do_intersect_coplanar(const typename K::Triangle_3& t, return visitor.result(coplanar_orientation(*b,*a,p) != POSITIVE); default: // should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return visitor.result(false); } @@ -191,12 +192,12 @@ do_intersect_coplanar(const typename K::Triangle_3& t, // case pqc == COLLINEAR is imposiible default: // should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return visitor.result(false); } default: // should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return visitor.result(false); } } @@ -263,7 +264,7 @@ do_intersect(const typename K::Triangle_3& t, } // case COPLANAR: should not happen default: // should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return visitor.result(false); } @@ -293,7 +294,7 @@ do_intersect(const typename K::Triangle_3& t, // case COPLANAR: should not happen default: // should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return visitor.result(false); } @@ -317,12 +318,12 @@ do_intersect(const typename K::Triangle_3& t, // case COPLANAR: should not happen default: // should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return visitor.result(false); } default: // should not happen. - CGAL_kernel_assertion(false); + 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 23fc5d897f43..ceaa5772f3c4 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 @@ -15,7 +15,7 @@ #include #include - +#include namespace CGAL { namespace Intersections { namespace internal { @@ -80,7 +80,7 @@ bool do_intersect_coplanar(const typename K::Point_3& A, return coplanar_orientation(*a,*b,q) != NEGATIVE && coplanar_orientation(*c,*a,p) != NEGATIVE; default:// should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return false; } case NEGATIVE: @@ -110,7 +110,7 @@ bool do_intersect_coplanar(const typename K::Point_3& A, && coplanar_orientation(*c,*a,q) != NEGATIVE; default:// should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return false; } case COLLINEAR: @@ -140,12 +140,12 @@ bool do_intersect_coplanar(const typename K::Point_3& A, // assumed to be non flat default:// should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return false; } default:// should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return false; } } @@ -216,7 +216,7 @@ do_intersect(const typename K::Triangle_3& t, && orientation(p,q,b,c) != POSITIVE && orientation(p,q,c,a) != POSITIVE; default: // should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return false; } case NEGATIVE: @@ -238,7 +238,7 @@ do_intersect(const typename K::Triangle_3& t, && orientation(q,p,c,a) != POSITIVE; default: // should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return false; } case COPLANAR: // p belongs to the triangle's supporting plane @@ -260,11 +260,11 @@ do_intersect(const typename K::Triangle_3& t, return do_intersect_coplanar(t,s,k); default: // should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return false; } default: // should not happen. - CGAL_kernel_assertion(false); + 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 0ab18e3e0c8c..6f5a8a5eec3b 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 @@ -15,6 +15,7 @@ #include #include +#include #include namespace CGAL { @@ -305,19 +306,19 @@ do_intersect(const typename K::Triangle_3& t1, case COPLANAR: return do_intersect_coplanar(t1,t2,k); default: // should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return false; } break; default: // should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return false; } break; default: // should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return false; } @@ -430,19 +431,19 @@ do_intersect(const typename K::Triangle_3& t1, return do_intersect_coplanar(t1,t2,k); default: // should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return false; } break; default: // should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return false; } break; default: // should not happen. - CGAL_kernel_assertion(false); + CGAL_unreachable(); return false; } 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 4bb670cbaa98..b26e7b1f6496 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 @@ -387,8 +387,8 @@ ts_intersection(const typename K::Triangle_3 &t, // Mesh_3, because if the intersection is not a point, it is // ignored anyway. return result_type(); - default: // should not happen. - CGAL_kernel_assertion(false); + default: + CGAL_unreachable(); return result_type(); } } From ea7f578bb1291d63f80174ca265fe015b44e7ced Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 26 Sep 2024 18:26:43 +0100 Subject: [PATCH 12/24] Fix a previous commit --- .../CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h index d54f00dfff81..aca5c18f196a 100644 --- a/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h +++ b/Tetrahedral_remeshing/include/CGAL/Tetrahedral_remeshing/internal/smooth_vertices.h @@ -871,10 +871,9 @@ std::size_t smooth_vertices_on_surfaces(C3t3& c3t3, { const auto intersection = proj.value().first; using Segment = typename Tr::Geom_traits::Segment_3; - if (const Segment* s = std::get_if(&intersection)){ - CGAL_assertion(s != nullptr); - return CGAL::midpoint(s->source(), s->target()); - } + const Segment* s = std::get_if(&intersection); + CGAL_assertion(s != nullptr); + return CGAL::midpoint(s->source(), s->target()); }; const auto n = vertices_normals.at(v).at(si); From deee093f24e19e28e89d48cc309435582332ddcf Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 26 Sep 2024 18:44:20 +0100 Subject: [PATCH 13/24] = delete did not compile for nearest_vertex_dispatch() --- Triangulation_2/include/CGAL/Triangulation_hierarchy_2.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Triangulation_2/include/CGAL/Triangulation_hierarchy_2.h b/Triangulation_2/include/CGAL/Triangulation_hierarchy_2.h index 295132483846..fd788a3e61a1 100644 --- a/Triangulation_2/include/CGAL/Triangulation_hierarchy_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_hierarchy_2.h @@ -251,8 +251,7 @@ class Triangulation_hierarchy_2 Vertex_handle nearest_vertex_dispatch(const Point&, Face_handle, Tag_true) const { - CGAL_assertion(false); - return Vertex_handle(); + CGAL_unreachable(); } void locate_in_all(const Point& p, From af0a79e55fe1037a4ec09595bc2db86c5fb0221c Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 26 Sep 2024 18:55:36 +0100 Subject: [PATCH 14/24] another batch --- AABB_tree/demo/AABB_tree/Scene.cpp | 4 +--- Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h | 7 +------ Triangulation_2/include/CGAL/Delaunay_triangulation_2.h | 3 +-- Triangulation_2/include/CGAL/Regular_triangulation_2.h | 3 +-- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/AABB_tree/demo/AABB_tree/Scene.cpp b/AABB_tree/demo/AABB_tree/Scene.cpp index a84d9d3f2542..b7bb10f80c80 100644 --- a/AABB_tree/demo/AABB_tree/Scene.cpp +++ b/AABB_tree/demo/AABB_tree/Scene.cpp @@ -1252,9 +1252,7 @@ void Scene::cutting_plane(bool override) return; } - // Should not be here - std::cerr << "Unknown cut_plane type" << std::endl; - CGAL_assertion(false); + CGAL_unreachable(); } } diff --git a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h index ddb1ba1109f6..11189652b0f0 100644 --- a/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h +++ b/Mesh_3/include/CGAL/Mesh_domain_with_polyline_features_3.h @@ -976,12 +976,7 @@ Mesh_domain_with_polyline_features_3:: point_corner_index(const Point_3& p) const { typename Corners::const_iterator p_index_it = corners_.find(p); - if ( p_index_it == corners_.end() ) - { - CGAL_assertion(false); - return Index(); - } - + CGAL_assertion( p_index_it != corners_.end()); return p_index_it->second; } diff --git a/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h b/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h index 617e8c23a8a4..2b616a8ca5cd 100644 --- a/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Delaunay_triangulation_2.h @@ -418,8 +418,7 @@ class Delaunay_triangulation_2 pit = propagate_conflicts(p,fh,2,pit); return pit; } - CGAL_assertion(false); - return std::make_pair(fit,eit); + CGAL_unreachable(); } template diff --git a/Triangulation_2/include/CGAL/Regular_triangulation_2.h b/Triangulation_2/include/CGAL/Regular_triangulation_2.h index 54938928e5c4..b1971f8bbf50 100644 --- a/Triangulation_2/include/CGAL/Regular_triangulation_2.h +++ b/Triangulation_2/include/CGAL/Regular_triangulation_2.h @@ -640,8 +640,7 @@ class Regular_triangulation_2 } return make_triple(fit, eit, vit); } - CGAL_assertion(false); - return make_triple(fit, eit, vit); + CGAL_unreachable(); } template From 8d06336c2a01f8d947e48f26ecf1ef67ed4fd645 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 27 Sep 2024 07:44:52 +0100 Subject: [PATCH 15/24] We cannot go in the else as line 336 checks that --- Lab/demo/Lab/Plugins/PMP/Smoothing_plugin.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Lab/demo/Lab/Plugins/PMP/Smoothing_plugin.cpp b/Lab/demo/Lab/Plugins/PMP/Smoothing_plugin.cpp index 91673050de35..f2f4ec90570c 100644 --- a/Lab/demo/Lab/Plugins/PMP/Smoothing_plugin.cpp +++ b/Lab/demo/Lab/Plugins/PMP/Smoothing_plugin.cpp @@ -379,11 +379,6 @@ public Q_SLOTS: selection_item->poly_item_changed(); selection_item->changed_with_poly_item(); } - else - { - std::cerr << "Something's gone wrong.\n"; - CGAL_assertion(false); - } QApplication::restoreOverrideCursor(); } From ca8221c753519e67bffc487cbb19bdf9ea831f23 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 27 Sep 2024 07:57:44 +0100 Subject: [PATCH 16/24] cleanup of leftover from factorization --- .../graph/internal/initialized_index_maps_helpers.h | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/internal/initialized_index_maps_helpers.h b/BGL/include/CGAL/boost/graph/internal/initialized_index_maps_helpers.h index eddefcec7fb2..7a3320fc97fd 100644 --- a/BGL/include/CGAL/boost/graph/internal/initialized_index_maps_helpers.h +++ b/BGL/include/CGAL/boost/graph/internal/initialized_index_maps_helpers.h @@ -80,13 +80,6 @@ bool is_index_map_valid(const CGAL::internal_np::face_index_t, FaceIndexProperty return is_index_map_valid(face_index_map, num_faces(g), faces(g)); } -template -void initialize_index_map(const PropertyTag, IndexPropertyMap, const Graph&) -{ - // Unknown parameter; should never be here. - CGAL_assertion(false); -} - template ::value> @@ -120,12 +113,6 @@ struct Index_map_initializer put(face_index_map, fd, i++); } - template - void operator()(const PropertyTag, IndexPropertyMap, const Graph&) - { - // Unknown parameter; should never be here. - CGAL_assertion(false); - } }; template From 071a9c24f7e7ad891c46e54d221d0d0d2e23547a Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 27 Sep 2024 09:17:48 +0100 Subject: [PATCH 17/24] Sdg_Linf_2 --- .../Segment_Delaunay_graph_Linf_2/Basic_predicates_C2.h | 4 +--- .../Segment_Delaunay_graph_Linf_2/Voronoi_vertex_ring_C2.h | 6 ++---- .../Voronoi_vertex_sqrt_field_new_C2.h | 6 ++---- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Basic_predicates_C2.h b/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Basic_predicates_C2.h index 33cc17f9c72c..961bba0cf7ac 100644 --- a/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Basic_predicates_C2.h +++ b/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Basic_predicates_C2.h @@ -641,9 +641,7 @@ struct Basic_predicates_C2 CGAL_SDG_DEBUG(std::cout << "ON_BOUNDED_SIDE" << std::endl;); return ON_BOUNDED_SIDE; default: - CGAL_SDG_DEBUG(std::cout << "error: should never reach here";); - CGAL_assertion(false); - return ON_BOUNDARY; + CGAL_unreachable(); } } diff --git a/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_ring_C2.h b/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_ring_C2.h index e2979813c528..4675a46348ac 100644 --- a/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_ring_C2.h +++ b/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_ring_C2.h @@ -592,8 +592,8 @@ class Voronoi_vertex_ring_C2 const unsigned int bq = bearing(lq); const unsigned int br = bearing(lr); const unsigned int bdiff = bearing_diff(bq, br); - CGAL_assertion( bdiff != 0 ); - CGAL_assertion( bdiff != 7 ); + CGAL_assertion( bdiff > 0 ); + CGAL_assertion( bdiff < 7 ); if (bdiff == 1) { compute_pss_corner_and_pt(p, q, r, lq, lr, bq, br); @@ -605,8 +605,6 @@ class Voronoi_vertex_ring_C2 compute_pss_side_p_known(p, q, r, lq, lr, bq, br); } else if (bdiff == 6) { compute_pss_lines_side(p, lq, lr, (br+1)%8); - } else { - CGAL_assertion(false); } CGAL_assertion_code( is_v_computed = true ); CGAL_assertion( oriented_side_of_line(lq, this->point()) != ZERO ); diff --git a/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_sqrt_field_new_C2.h b/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_sqrt_field_new_C2.h index da5fad7947cc..bad4f8fc5ab3 100644 --- a/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_sqrt_field_new_C2.h +++ b/Segment_Delaunay_graph_Linf_2/include/CGAL/Segment_Delaunay_graph_Linf_2/Voronoi_vertex_sqrt_field_new_C2.h @@ -1106,8 +1106,7 @@ class Voronoi_vertex_sqrt_field_new_C2 const Bearing bq = bearing(lq); const Bearing br = bearing(lr); const Bearing bdiff = bearing_diff(bq, br); - CGAL_assertion( bdiff != 0 ); - CGAL_assertion( bdiff != 7 ); + CGAL_assertion( bdiff > 0 && bdiff < 7 ); if (bdiff == 1) { compute_pss_corner_and_pt(p, lq, lr, bq, br); @@ -1119,9 +1118,8 @@ class Voronoi_vertex_sqrt_field_new_C2 compute_pss_side_p_known(p, q, r, lq, lr, bq, br); } else if (bdiff == 6) { compute_pss_lines_side(p, lq, lr, (br+1)%8); - } else { - CGAL_assertion(false); } + CGAL_assertion( oriented_side_of_line(lq, this->point()) != ZERO ); CGAL_assertion( oriented_side_of_line(lr, this->point()) != ZERO ); } From c26dd87dc4325c867008146f0ed946ba855fec65 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 30 Sep 2024 11:57:04 +0100 Subject: [PATCH 18/24] 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; } }; From 1b33e7a1178c8febf99b0ece254fd2686a365d79 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 30 Sep 2024 11:59:42 +0100 Subject: [PATCH 19/24] Undo change in ToS_2 after remark by Laurent --- .../include/CGAL/Triangulation_on_sphere_2.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2.h b/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2.h index 36498b6c59ed..6b26605356ca 100644 --- a/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2.h +++ b/Triangulation_on_sphere_2/include/CGAL/Triangulation_on_sphere_2.h @@ -964,12 +964,16 @@ march_locate_2D(Face_handle f, li = (o0 == COLLINEAR) ? 2 : (o1 == COLLINEAR) ? 0 : 1; break; } - default: // i.e., case 2: + case 2: { lt = VERTEX; li = (o0 != COLLINEAR) ? 2 : (o1 != COLLINEAR) ? 0 : 1; break; } + default: + { + CGAL_unreachable(); + } } test_distance(t, f, lt, li); From 4f5cd056497c041e44eb3dacbb9e885e88bab5d3 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 30 Sep 2024 12:51:24 +0100 Subject: [PATCH 20/24] ws --- .../internal/Line_3_Triangle_3_do_intersect.h | 2 +- .../internal/Ray_3_Triangle_3_do_intersect.h | 16 ++++++++-------- .../internal/Segment_3_Triangle_3_do_intersect.h | 8 ++++---- .../Triangle_3_Triangle_3_do_intersect.h | 12 ++++++------ 4 files changed, 19 insertions(+), 19 deletions(-) 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 168ed69647e5..5f127755af2c 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 @@ -61,7 +61,7 @@ do_intersect(const typename K::Triangle_3& t, default: CGAL_unreachable(); } - default: + default: CGAL_unreachable(); } } 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 fdb229c8489e..c429172b3c56 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,7 +140,7 @@ 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: + default: CGAL_unreachable(); } @@ -165,7 +165,7 @@ 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: + default: CGAL_unreachable(); } @@ -189,11 +189,11 @@ do_intersect_coplanar(const typename K::Triangle_3& t, return visitor.result(coplanar_orientation(*a,*c,p) != POSITIVE); // case pqc == COLLINEAR is imposiible - default: + default: CGAL_unreachable(); } - default: + default: CGAL_unreachable(); } } @@ -259,7 +259,7 @@ do_intersect(const typename K::Triangle_3& t, return visitor.result(true); } // case COPLANAR: should not happen - default: + default: CGAL_unreachable(); } @@ -288,7 +288,7 @@ do_intersect(const typename K::Triangle_3& t, // case COPLANAR: should not happen - default: + default: CGAL_unreachable(); } @@ -311,11 +311,11 @@ do_intersect(const typename K::Triangle_3& t, // case COPLANAR: should not happen - default: + default: CGAL_unreachable(); } - default: + default: CGAL_unreachable(); } } 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 9f5150cc7b4a..fcc929708eab 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 @@ -210,7 +210,7 @@ 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: + default: CGAL_unreachable(); } case NEGATIVE: @@ -231,7 +231,7 @@ do_intersect(const typename K::Triangle_3& t, && orientation(q,p,b,c) != POSITIVE && orientation(q,p,c,a) != POSITIVE; - default: + default: CGAL_unreachable(); } case COPLANAR: // p belongs to the triangle's supporting plane @@ -252,10 +252,10 @@ do_intersect(const typename K::Triangle_3& t, // supporting plane return do_intersect_coplanar(t,s,k); - default: + default: CGAL_unreachable(); } - default: + default: CGAL_unreachable(); } } 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 9163fde0f40d..cd2fcfe1f62d 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,17 +305,17 @@ do_intersect(const typename K::Triangle_3& t1, case COPLANAR: return do_intersect_coplanar(t1,t2,k); - default: + default: CGAL_unreachable(); } break; - default: + default: CGAL_unreachable(); } break; - default: + default: CGAL_unreachable(); } @@ -427,17 +427,17 @@ 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: + default: CGAL_unreachable(); } break; - default: + default: CGAL_unreachable(); } break; - default: + default: CGAL_unreachable(); } From 240488ca0c3a299b6194ece8c061ec987c6d6443 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 2 Oct 2024 07:43:55 +0100 Subject: [PATCH 21/24] Fix warning --- .../include/CGAL/Poisson_reconstruction_function.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Poisson_surface_reconstruction_3/include/CGAL/Poisson_reconstruction_function.h b/Poisson_surface_reconstruction_3/include/CGAL/Poisson_reconstruction_function.h index ea3b31413ac3..23bb0f269339 100644 --- a/Poisson_surface_reconstruction_3/include/CGAL/Poisson_reconstruction_function.h +++ b/Poisson_surface_reconstruction_3/include/CGAL/Poisson_reconstruction_function.h @@ -1128,7 +1128,7 @@ class Poisson_reconstruction_function } while(circ != done); - CGAL_assertion(! voronoi_points.size() < 3); + CGAL_assertion(! (voronoi_points.size() < 3)); // sum up areas FT area = 0.0; From 19f809e6e9f8fcd9dd800eba591617ea6f346263 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 2 Oct 2024 07:53:44 +0100 Subject: [PATCH 22/24] Fix warning in Combinatorial_map --- .../include/CGAL/Combinatorial_map_storages_with_index.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_storages_with_index.h b/Combinatorial_map/include/CGAL/Combinatorial_map_storages_with_index.h index 7a64159fb71a..2966bf0b9d53 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_storages_with_index.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_storages_with_index.h @@ -169,7 +169,7 @@ namespace CGAL { { // Allocate a dart for null_dart_descriptor assert(mdarts.empty()); // the compact container is empty - Dart_index local_null_dart_descriptor = mdarts.emplace(); + CGAL_assertion_code( Dart_index local_null_dart_descriptor = ) mdarts.emplace(); CGAL_assertion_msg(local_null_dart_descriptor ==0, "[ERROR] fatal in Combinatorial_map_storage_with_index::init_storage"); } From 10bd324d6a6f7c69972efa50ab2c26f9c206fad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 4 Oct 2024 08:49:38 +0200 Subject: [PATCH 23/24] use cgal macro --- .../include/CGAL/CMap_linear_cell_complex_storages_with_index.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages_with_index.h b/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages_with_index.h index 5303221a9f35..b23023707eed 100644 --- a/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages_with_index.h +++ b/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages_with_index.h @@ -189,7 +189,7 @@ namespace CGAL { void init_storage() { // Allocate a dart for null_dart_descriptor - assert(mdarts.empty()); // the compact container is empty + CGAL_assertion(mdarts.empty()); // the compact container is empty Dart_index local_null_dart_descriptor = mdarts.emplace(); CGAL_assertion_msg(local_null_dart_descriptor==0, "[ERROR] fatal in CMap_linear_cell_complex_storage_with_index::init_storage"); From 09c3b97d577c716d60a069f7497d220136ec5f1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 7 Oct 2024 10:23:28 +0200 Subject: [PATCH 24/24] fix warning --- .../include/CGAL/CMap_linear_cell_complex_storages_with_index.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages_with_index.h b/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages_with_index.h index b23023707eed..3fb7e1c2ab08 100644 --- a/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages_with_index.h +++ b/Linear_cell_complex/include/CGAL/CMap_linear_cell_complex_storages_with_index.h @@ -190,7 +190,7 @@ namespace CGAL { { // Allocate a dart for null_dart_descriptor CGAL_assertion(mdarts.empty()); // the compact container is empty - Dart_index local_null_dart_descriptor = mdarts.emplace(); + CGAL_assertion_code( Dart_index local_null_dart_descriptor = ) mdarts.emplace(); CGAL_assertion_msg(local_null_dart_descriptor==0, "[ERROR] fatal in CMap_linear_cell_complex_storage_with_index::init_storage"); }