From 85f5f4f4e845e6641119cce4a20d030ab6cf3762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 26 Jan 2016 09:49:56 +0100 Subject: [PATCH 1/3] avoid unused variable warning --- .../CGAL/Surface_mesh_shortest_path/function_objects.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/function_objects.h b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/function_objects.h index c9f9eb64658..903d20d9cc5 100644 --- a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/function_objects.h +++ b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/function_objects.h @@ -459,8 +459,6 @@ public: Point_2 p1; - FT t1; - if (intersectResult1) { Point_2* result = boost::get(&*intersectResult1); @@ -469,7 +467,7 @@ public: if (result) { - t1 = m_parametric_distance_along_segment_2(s1, *result); + CGAL_assertion_code(FT t1 = m_parametric_distance_along_segment_2(s1, *result);) p1 = *result; CGAL_assertion(t1 >= FT(-0.00001) && t1 <= FT(1.00001)); } @@ -479,7 +477,6 @@ public: CGAL_assertion(bool(intersectResult2)); - FT t2; Point_2 p2; if (intersectResult2) @@ -490,7 +487,7 @@ public: if (result) { - t2 = m_parametric_distance_along_segment_2(s2, *result); + CGAL_assertion_code(FT t2 = m_parametric_distance_along_segment_2(s2, *result);) p2 = *result; CGAL_assertion(t2 >= FT(-0.00001) && t2 <= FT(1.00001)); } From cc2693df4eda5c6508a08fda36c91d490fd4f1e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 27 Jan 2016 10:16:13 +0100 Subject: [PATCH 2/3] avoid unused variable warning --- .../function_objects.h | 44 ++++++------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/function_objects.h b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/function_objects.h index 903d20d9cc5..23c5fd9d104 100644 --- a/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/function_objects.h +++ b/Surface_mesh_shortest_path/include/CGAL/Surface_mesh_shortest_path/function_objects.h @@ -454,48 +454,30 @@ public: Line_2 s2Line(m_construct_line_2(s2)); LineLineIntersectResult intersectResult1(m_intersect_2(s1Line, l1)); - CGAL_assertion(bool(intersectResult1)); + if (!intersectResult1) return CGAL::SMALLER; - Point_2 p1; + const Point_2* p1_ptr = boost::get(&*intersectResult1); - if (intersectResult1) - { - Point_2* result = boost::get(&*intersectResult1); + CGAL_assertion(p1_ptr && "Intersection should have been a point"); + if (!p1_ptr) return CGAL::SMALLER; - CGAL_assertion(result && "Intersection should have been a point"); - - if (result) - { - CGAL_assertion_code(FT t1 = m_parametric_distance_along_segment_2(s1, *result);) - p1 = *result; - CGAL_assertion(t1 >= FT(-0.00001) && t1 <= FT(1.00001)); - } - } + CGAL_assertion_code(FT t1 = m_parametric_distance_along_segment_2(s1, *p1_ptr);) + CGAL_assertion(t1 >= FT(-0.00001) && t1 <= FT(1.00001)); LineLineIntersectResult intersectResult2 = m_intersect_2(s2Line, l2); - CGAL_assertion(bool(intersectResult2)); + if (!intersectResult2) return CGAL::SMALLER; - Point_2 p2; + const Point_2* p2_ptr = boost::get(&*intersectResult2); - if (intersectResult2) - { - Point_2* result = boost::get(&*intersectResult2); + CGAL_assertion(p2_ptr && "Intersection should have been a point"); + if (!p2_ptr) return CGAL::SMALLER; - CGAL_assertion(result && "Intersection should have been a point"); + CGAL_assertion_code(FT t2 = m_parametric_distance_along_segment_2(s2, *p2_ptr);) + CGAL_assertion(t2 >= FT(-0.00001) && t2 <= FT(1.00001)); - if (result) - { - CGAL_assertion_code(FT t2 = m_parametric_distance_along_segment_2(s2, *result);) - p2 = *result; - CGAL_assertion(t2 >= FT(-0.00001) && t2 <= FT(1.00001)); - } - } - - result_type predicateResult = m_compare_distance_2(s1.source(), p1, s2.source(), p2); - - return predicateResult; + return m_compare_distance_2(s1.source(), *p1_ptr, s2.source(), *p2_ptr); } }; From 73f27dd6fb8f792d679af7d31bb00bb381f34ac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 27 Jan 2016 10:17:20 +0100 Subject: [PATCH 3/3] prevent false detection of error by the testsuite this test is really expensive but useful for debugging. We keep it maintained by ensuring it compiles even if it is never executed --- .../test/Surface_mesh_shortest_path/TestMesh.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp index 389afe84002..62d28aa13c7 100644 --- a/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp +++ b/Surface_mesh_shortest_path/test/Surface_mesh_shortest_path/TestMesh.cpp @@ -343,7 +343,7 @@ int main(int argc, char** argv) } else { - std::cerr << "Error, must specify a polyhedron." << std::endl; + std::cerr << "No polyhedron specified, nothing will be tested." << std::endl; } return 0;