From d3030094960b65c240181ea832d2fb17048c8c2f Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 16 Jul 2020 10:58:29 +0200 Subject: [PATCH 01/13] Fix `constexpr` errors --- NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h | 4 ++-- STL_Extension/include/CGAL/Concurrent_compact_container.h | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h index ed0aeeb7af5..2a293685bdf 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h @@ -60,8 +60,8 @@ struct Cartesian_filter_K : public Base_ CGAL_NO_UNIQUE_ADDRESS Store_kernel sak; CGAL_NO_UNIQUE_ADDRESS Store_kernel sek; - constexpr Cartesian_filter_K(){} - constexpr Cartesian_filter_K(int d):Base_(d){} + CGAL_CONSTEXPR Cartesian_filter_K(){} + CGAL_CONSTEXPR Cartesian_filter_K(int d):Base_(d){} //FIXME: or do we want an instance of AK and EK belonging to this kernel, //instead of a reference to external ones? CGAL_CONSTEXPR Cartesian_filter_K(AK_ const&a,EK_ const&b):Base_(),sak(a),sek(b){} diff --git a/STL_Extension/include/CGAL/Concurrent_compact_container.h b/STL_Extension/include/CGAL/Concurrent_compact_container.h index da66ef20111..ad5e251f445 100644 --- a/STL_Extension/include/CGAL/Concurrent_compact_container.h +++ b/STL_Extension/include/CGAL/Concurrent_compact_container.h @@ -47,6 +47,11 @@ #include +#ifdef CGAL_CXX11 +#define CGAL_CONSTEXPR constexpr +#else +#define CGAL_CONSTEXPR +#endif namespace CGAL { #define CGAL_GENERATE_MEMBER_DETECTOR(X) \ @@ -192,7 +197,7 @@ protected: #if CGAL_CONCURRENT_COMPACT_CONTAINER_APPROXIMATE_SIZE // `m_size` plus or minus `precision_of_approximate_size - 1` - static constexpr double precision_of_approximate_size_plus_1 = 1.10; + static CGAL_CONSTEXPR double precision_of_approximate_size_plus_1 = 1.10; size_type m_approximate_size; std::atomic m_atomic_approximate_size; void refresh_approximate_size() { From 41175cd50548e6e6b23bfda317328e2997ca32dc Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 16 Jul 2020 14:47:41 +0200 Subject: [PATCH 02/13] WIP --- CGAL_Core/include/CGAL/CORE/Filter.h | 3 ++- Point_set_3/include/CGAL/Point_set_3.h | 6 +++--- Triangulation_3/include/CGAL/Triangulation_3.h | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CGAL_Core/include/CGAL/CORE/Filter.h b/CGAL_Core/include/CGAL/CORE/Filter.h index 3c99c9a3e5a..cfb7f8adeb1 100644 --- a/CGAL_Core/include/CGAL/CORE/Filter.h +++ b/CGAL_Core/include/CGAL/CORE/Filter.h @@ -164,7 +164,8 @@ public: double maxVal = ( core_abs(val) + maxAbs / x.maxAbs) / xxx + DBL_MIN; return filteredFp(val, maxVal, 1 + core_max(ind, x.ind + 1)); } else - return filteredFp( std::nan(""), getDoubleInfty(), 1); + //TODO: check that + return filteredFp( std::strtod("NAN", (char**)NULL), getDoubleInfty(), 1); } /// square root filteredFp sqrt () const { diff --git a/Point_set_3/include/CGAL/Point_set_3.h b/Point_set_3/include/CGAL/Point_set_3.h index 7285d39c587..ee0a1b33e65 100644 --- a/Point_set_3/include/CGAL/Point_set_3.h +++ b/Point_set_3/include/CGAL/Point_set_3.h @@ -799,7 +799,7 @@ public: { Property_map pm; bool added = false; - std::tie (pm, added) = m_base.template add (name, t); + boost::tie (pm, added) = m_base.template add (name, t); return std::make_pair (pm, added); } @@ -820,7 +820,7 @@ public: { Property_map pm; bool okay = false; - std::tie (pm, okay) = m_base.template get(name); + boost::tie (pm, okay) = m_base.template get(name); return std::make_pair (pm, okay); } @@ -864,7 +864,7 @@ public: std::pair add_normal_map (const Vector& default_value = CGAL::NULL_VECTOR) { bool out = false; - std::tie (m_normals, out) = this->add_property_map ("normal", default_value); + boost::tie (m_normals, out) = this->add_property_map ("normal", default_value); return std::make_pair (m_normals, out); } /*! diff --git a/Triangulation_3/include/CGAL/Triangulation_3.h b/Triangulation_3/include/CGAL/Triangulation_3.h index c265dd4c596..13d2e403350 100644 --- a/Triangulation_3/include/CGAL/Triangulation_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_3.h @@ -555,7 +555,7 @@ protected: public: template // Point or Point_3 - typename boost::result_of::type + Point_3 construct_point(const P& p) const { return geom_traits().construct_point_3_object()(p); From 1e6a5ac63644530667bb22d7be04776dbe95ab7a Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 16 Jul 2020 15:11:23 +0200 Subject: [PATCH 03/13] Fix the use of Construct_point_3::result in Periodic_3 --- .../Periodic_3_Delaunay_triangulation_remove_traits_3.h | 8 ++++++++ .../Periodic_3_regular_triangulation_remove_traits_3.h | 8 ++++++++ Triangulation_3/include/CGAL/Triangulation_3.h | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_Delaunay_triangulation_remove_traits_3.h b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_Delaunay_triangulation_remove_traits_3.h index 5594fdffcab..fa17ae7896a 100644 --- a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_Delaunay_triangulation_remove_traits_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_Delaunay_triangulation_remove_traits_3.h @@ -49,6 +49,14 @@ public: using Base::operator(); + template + struct result : Base::template result {}; + + template + struct result { + typedef const Point_3& type; + }; + const Point_3& operator()(const Point_3& p) const { return p; } }; diff --git a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_regular_triangulation_remove_traits_3.h b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_regular_triangulation_remove_traits_3.h index b104ff7f523..2f434c9fe87 100644 --- a/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_regular_triangulation_remove_traits_3.h +++ b/Periodic_3_triangulation_3/include/CGAL/internal/Periodic_3_regular_triangulation_remove_traits_3.h @@ -58,6 +58,14 @@ public: using Base::operator(); // for K::Weighted_point_3 to Point_3 + template + struct result : Base::template result {}; + + template + struct result { + typedef Point_3 type; + }; + Point_3 operator()(const Weighted_point_3& wp) const { return std::make_pair(operator()(wp.first), wp.second /* offset */); } diff --git a/Triangulation_3/include/CGAL/Triangulation_3.h b/Triangulation_3/include/CGAL/Triangulation_3.h index 13d2e403350..fdb5c7f3e38 100644 --- a/Triangulation_3/include/CGAL/Triangulation_3.h +++ b/Triangulation_3/include/CGAL/Triangulation_3.h @@ -555,7 +555,7 @@ protected: public: template // Point or Point_3 - Point_3 + typename boost::result_of::type construct_point(const P& p) const { return geom_traits().construct_point_3_object()(p); From da7e757d9f7688d92429c349f57874400fad303b Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 16 Jul 2020 15:21:38 +0200 Subject: [PATCH 04/13] std::strtod("NAN", (char**)NULL) is a nan --- CGAL_Core/include/CGAL/CORE/Filter.h | 1 - 1 file changed, 1 deletion(-) diff --git a/CGAL_Core/include/CGAL/CORE/Filter.h b/CGAL_Core/include/CGAL/CORE/Filter.h index cfb7f8adeb1..d9f7cdcaa89 100644 --- a/CGAL_Core/include/CGAL/CORE/Filter.h +++ b/CGAL_Core/include/CGAL/CORE/Filter.h @@ -164,7 +164,6 @@ public: double maxVal = ( core_abs(val) + maxAbs / x.maxAbs) / xxx + DBL_MIN; return filteredFp(val, maxVal, 1 + core_max(ind, x.ind + 1)); } else - //TODO: check that return filteredFp( std::strtod("NAN", (char**)NULL), getDoubleInfty(), 1); } /// square root From ae10199e1239efd33d09674e324abaf9aafd2f2d Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Thu, 16 Jul 2020 15:21:53 +0200 Subject: [PATCH 05/13] Fix the constexpr issue with precision_of_approximate_size_plus_1 --- STL_Extension/include/CGAL/Concurrent_compact_container.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/STL_Extension/include/CGAL/Concurrent_compact_container.h b/STL_Extension/include/CGAL/Concurrent_compact_container.h index ad5e251f445..47b020aa4e2 100644 --- a/STL_Extension/include/CGAL/Concurrent_compact_container.h +++ b/STL_Extension/include/CGAL/Concurrent_compact_container.h @@ -149,14 +149,14 @@ public: void inc_size() { ++m_size; #if CGAL_CONCURRENT_COMPACT_CONTAINER_APPROXIMATE_SIZE - if(m_size > (m_approximate_size * precision_of_approximate_size_plus_1)) + if(m_size > (m_approximate_size * 1.10)) refresh_approximate_size(); #endif // CGAL_CONCURRENT_COMPACT_CONTAINER_APPROXIMATE_SIZE } void dec_size() { --m_size; #if CGAL_CONCURRENT_COMPACT_CONTAINER_APPROXIMATE_SIZE - if((m_size * precision_of_approximate_size_plus_1) < m_approximate_size) + if((m_size * 1.10) < m_approximate_size) refresh_approximate_size(); #endif // CGAL_CONCURRENT_COMPACT_CONTAINER_APPROXIMATE_SIZE } @@ -197,7 +197,6 @@ protected: #if CGAL_CONCURRENT_COMPACT_CONTAINER_APPROXIMATE_SIZE // `m_size` plus or minus `precision_of_approximate_size - 1` - static CGAL_CONSTEXPR double precision_of_approximate_size_plus_1 = 1.10; size_type m_approximate_size; std::atomic m_atomic_approximate_size; void refresh_approximate_size() { From 128a07c44ae5ca92627ac2e4f00cddc475151ad8 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 16 Jul 2020 16:27:36 +0200 Subject: [PATCH 06/13] Fix typeset bad call --- .../CGAL/NewKernel_d/Cartesian_filter_K.h | 18 ++++++++++++------ .../CGAL/Concurrent_compact_container.h | 5 ----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h index 2a293685bdf..192abe58431 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Cartesian_filter_K.h @@ -32,22 +32,28 @@ namespace CGAL { // It would be nicer to write the table in the other direction: Orientation_of_points_tag is good up to 6, Side_of_oriented_sphere_tag up to 5, etc. template struct Functors_without_division { typedef typeset<> type; }; template<> struct Functors_without_division > { - typedef typeset type; + typedef typeset + ::add::type type; }; template<> struct Functors_without_division > { - typedef typeset type; + typedef typeset + ::add::type type; }; template<> struct Functors_without_division > { - typedef typeset type; + typedef typeset + ::add::type type; }; template<> struct Functors_without_division > { - typedef typeset type; + typedef typeset + ::add::type type; }; template<> struct Functors_without_division > { - typedef typeset type; + typedef typeset + ::add::type type; }; template<> struct Functors_without_division > { - typedef typeset type; + typedef typeset + ::add::type type; }; // FIXME: diff --git a/STL_Extension/include/CGAL/Concurrent_compact_container.h b/STL_Extension/include/CGAL/Concurrent_compact_container.h index 47b020aa4e2..92a676f00ef 100644 --- a/STL_Extension/include/CGAL/Concurrent_compact_container.h +++ b/STL_Extension/include/CGAL/Concurrent_compact_container.h @@ -47,11 +47,6 @@ #include -#ifdef CGAL_CXX11 -#define CGAL_CONSTEXPR constexpr -#else -#define CGAL_CONSTEXPR -#endif namespace CGAL { #define CGAL_GENERATE_MEMBER_DETECTOR(X) \ From 7248270fc31c177700acf7b9adf4de8f805fc67d Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 17 Jul 2020 09:49:14 +0200 Subject: [PATCH 07/13] Add result_of protocol to the Kernel_checker That is used by `Construct_point_3` in `Triangulation_3`. --- Kernel_23/include/CGAL/Kernel_checker.h | 41 +++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/Kernel_23/include/CGAL/Kernel_checker.h b/Kernel_23/include/CGAL/Kernel_checker.h index b55f21a2c3c..a9a47484d78 100644 --- a/Kernel_23/include/CGAL/Kernel_checker.h +++ b/Kernel_23/include/CGAL/Kernel_checker.h @@ -88,6 +88,15 @@ public: : p1(pp1), p2(pp2), cmp(c) { } + template + struct result; + + template + struct result { + typedef typename Pairify::type, + typename CGAL::cpp11::result_of::type>::result_type type; + }; + template typename Pairify::type, typename CGAL::cpp11::result_of::type>::result_type @@ -113,6 +122,12 @@ public: return Pairify()(res1, res2); } + template + struct result { + typedef typename Pairify::type, + typename CGAL::cpp11::result_of::type>::result_type type; + }; + template typename Pairify::type, typename CGAL::cpp11::result_of::type>::result_type @@ -140,6 +155,12 @@ public: return Pairify()(res1, res2); } + template + struct result { + typedef typename Pairify::type, + typename CGAL::cpp11::result_of::type>::result_type type; + }; + template typename Pairify::type, @@ -171,6 +192,16 @@ public: return Pairify()(res1, res2); } + template + struct result { + typedef + typename Pairify::type, + typename CGAL::cpp11::result_of::type>::result_type + type; + }; + template typename Pairify::type, @@ -207,6 +238,16 @@ public: return Pairify()(res1, res2); } + template + struct result { + typedef + typename Pairify::type, + typename CGAL::cpp11::result_of::type>::result_type + type; + }; + template typename Pairify::type, From ebdf7b2c041e6b9cb4c2d41922cab247ceea3779 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 17 Jul 2020 09:53:07 +0200 Subject: [PATCH 08/13] Fix a compiler with the no_unique_address attribute, in C++03 --- Installation/include/CGAL/config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Installation/include/CGAL/config.h b/Installation/include/CGAL/config.h index 24a30f8a756..acb965c1258 100644 --- a/Installation/include/CGAL/config.h +++ b/Installation/include/CGAL/config.h @@ -555,7 +555,7 @@ using std::max; #endif // Macro to specify [[no_unique_address]] if supported -#if __has_cpp_attribute(no_unique_address) +#if CGAL_CXX11 && __has_cpp_attribute(no_unique_address) # define CGAL_NO_UNIQUE_ADDRESS [[no_unique_address]] #else # define CGAL_NO_UNIQUE_ADDRESS From 4b0b59e5a1217f9bc83bf7544c500d4bb3fb95fa Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 17 Jul 2020 09:50:57 +0200 Subject: [PATCH 09/13] Don't use type aliases in c++98 --- Number_types/test/Number_types/CORE_Expr_ticket_4296.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Number_types/test/Number_types/CORE_Expr_ticket_4296.cpp b/Number_types/test/Number_types/CORE_Expr_ticket_4296.cpp index e7e83503304..8554b68cf02 100644 --- a/Number_types/test/Number_types/CORE_Expr_ticket_4296.cpp +++ b/Number_types/test/Number_types/CORE_Expr_ticket_4296.cpp @@ -1,5 +1,5 @@ #include -using NT = CORE::Expr; +typedef CORE::Expr NT; int main() { From b2be86babcdcb2979e788be27c22f5035cd65828 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Fri, 17 Jul 2020 10:03:38 +0200 Subject: [PATCH 10/13] Fix result_of issue with C++03 --- .../include/CGAL/Partition_2/Triangulation_indirect_traits_2.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Partition_2/include/CGAL/Partition_2/Triangulation_indirect_traits_2.h b/Partition_2/include/CGAL/Partition_2/Triangulation_indirect_traits_2.h index 3015fcb1ff9..3693d97c7b0 100644 --- a/Partition_2/include/CGAL/Partition_2/Triangulation_indirect_traits_2.h +++ b/Partition_2/include/CGAL/Partition_2/Triangulation_indirect_traits_2.h @@ -122,6 +122,7 @@ template class Construct_circulator_2 { public: + typedef Circulator result_type; Circulator operator()(Circulator p1) const { return p1; } }; From 7e525657dd0d122be2cb4a41ed71d2570c32f0aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 20 Jul 2020 07:39:54 +0200 Subject: [PATCH 11/13] hide undocumented inheritance --- AABB_tree/include/CGAL/AABB_traits.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_traits.h b/AABB_tree/include/CGAL/AABB_traits.h index 9758b0b12ed..2e6aaf58c1c 100644 --- a/AABB_tree/include/CGAL/AABB_traits.h +++ b/AABB_tree/include/CGAL/AABB_traits.h @@ -210,9 +210,11 @@ class AABB_tree; /// \sa `AABBPrimitiveWithSharedData` template -class AABB_traits: - public internal::AABB_tree::AABB_traits_base, +class AABB_traits +#ifndef DOXYGEN_RUNNING +: public internal::AABB_tree::AABB_traits_base, public internal::AABB_tree::AABB_traits_base_2 +#endif { typedef typename CGAL::Object Object; public: From 26c28abe681a5c1b0640f96976bc08c4ab5daf2d Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 20 Jul 2020 09:55:54 +0200 Subject: [PATCH 12/13] Add a fake function for cgal_add_compilation_test --- Installation/cmake/modules/CGAL_add_test.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Installation/cmake/modules/CGAL_add_test.cmake b/Installation/cmake/modules/CGAL_add_test.cmake index eb80d4b4695..03362d99028 100644 --- a/Installation/cmake/modules/CGAL_add_test.cmake +++ b/Installation/cmake/modules/CGAL_add_test.cmake @@ -16,6 +16,10 @@ if(NOT POLICY CMP0064) # Add a fake function to avoid CMake errors function(cgal_add_compilation_test) endfunction() + # Add a fake function to avoid CMake errors + function(cgal_setup_test_properties) + endfunction() + # Then return, to exit the file return() From 1641310e872cfecf886674cbfd3b9fbe49de4b4a Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Mon, 15 Jun 2020 17:12:04 +0200 Subject: [PATCH 13/13] Missing #include --- .../internal/Smoothing/curvature_flow_impl.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h index e95b46b5ee4..46d23abb12b 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h @@ -35,6 +35,7 @@ #include #include #include +#include namespace CGAL { namespace Polygon_mesh_processing {