From aafc7e0634fb27a2ff753cd911b450e19f218e6a Mon Sep 17 00:00:00 2001 From: Luca Heltai Date: Mon, 2 May 2022 13:30:06 +0300 Subject: [PATCH] Renamed function. Added boost header. --- .../boost/thread/detail/thread_safety.hpp | 160 ++++++++++++++++++ cmake/modules/FindCGAL.cmake | 2 +- include/deal.II/cgal/surface_mesh.h | 2 +- source/cgal/surface_mesh.cc | 2 +- source/cgal/surface_mesh.inst.in | 4 +- tests/cgal/cgal_surface_mesh_01.cc | 2 +- 6 files changed, 167 insertions(+), 5 deletions(-) create mode 100644 bundled/boost-1.70.0/include/boost/thread/detail/thread_safety.hpp diff --git a/bundled/boost-1.70.0/include/boost/thread/detail/thread_safety.hpp b/bundled/boost-1.70.0/include/boost/thread/detail/thread_safety.hpp new file mode 100644 index 0000000000..4aa29a808b --- /dev/null +++ b/bundled/boost-1.70.0/include/boost/thread/detail/thread_safety.hpp @@ -0,0 +1,160 @@ +#ifndef BOOST_THREAD_DETAIL_THREAD_SAFETY_HPP +#define BOOST_THREAD_DETAIL_THREAD_SAFETY_HPP + +#if defined(__GNUC__) && !defined(__GXX_EXPERIMENTAL_CXX0X__) +// +// This is horrible, but it seems to be the only we can shut up the +// "anonymous variadic macros were introduced in C99 [-Wvariadic-macros]" +// warning that get spewed out otherwise in non-C++11 mode. +// +#pragma GCC system_header +#endif + +// See https://clang.llvm.org/docs/ThreadSafetyAnalysis.html + +// Un-comment to enable Thread Safety Analysis +//#define BOOST_THREAD_ENABLE_THREAD_SAFETY_ANALYSIS + +// Enable thread safety attributes only with clang. +// The attributes can be safely erased when compiling with other compilers. +#if defined (BOOST_THREAD_ENABLE_THREAD_SAFETY_ANALYSIS) && defined(__clang__) && (!defined(SWIG)) +#define BOOST_THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x)) +#else +#define BOOST_THREAD_ANNOTATION_ATTRIBUTE__(x) // no-op +#endif + +#define BOOST_THREAD_CAPABILITY(x) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(capability(x)) + +#define BOOST_THREAD_SCOPED_CAPABILITY \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable) + +#define BOOST_THREAD_GUARDED_BY(x) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x)) + +#define BOOST_THREAD_PT_GUARDED_BY(x) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_by(x)) + +#define BOOST_THREAD_ACQUIRED_BEFORE(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(acquired_before(__VA_ARGS__)) + +#define BOOST_THREAD_ACQUIRED_AFTER(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(acquired_after(__VA_ARGS__)) + +#define BOOST_THREAD_REQUIRES(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(requires_capability(__VA_ARGS__)) + +#define BOOST_THREAD_REQUIRES_SHARED(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(requires_shared_capability(__VA_ARGS__)) + +#define BOOST_THREAD_ACQUIRE(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(acquire_capability(__VA_ARGS__)) + +#define BOOST_THREAD_ACQUIRE_SHARED(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(acquire_shared_capability(__VA_ARGS__)) + +#define BOOST_THREAD_RELEASE(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(release_capability(__VA_ARGS__)) + +#define BOOST_THREAD_RELEASE_SHARED(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(release_shared_capability(__VA_ARGS__)) + +#define BOOST_THREAD_TRY_ACQUIRE(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_capability(__VA_ARGS__)) + +#define BOOST_THREAD_TRY_ACQUIRE_SHARED(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(try_acquire_shared_capability(__VA_ARGS__)) + +#define BOOST_THREAD_EXCLUDES(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(locks_excluded(__VA_ARGS__)) + +#define BOOST_THREAD_ASSERT_CAPABILITY(x) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(assert_capability(x)) + +#define BOOST_THREAD_ASSERT_SHARED_CAPABILITY(x) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(assert_shared_capability(x)) + +#define BOOST_THREAD_RETURN_CAPABILITY(x) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x)) + +#define BOOST_THREAD_NO_THREAD_SAFETY_ANALYSIS \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis) + +#if defined(__clang__) && (!defined(SWIG)) && defined(__FreeBSD__) +#if __has_attribute(no_thread_safety_analysis) +#define BOOST_THREAD_DISABLE_THREAD_SAFETY_ANALYSIS __attribute__((no_thread_safety_analysis)) +#else +#define BOOST_THREAD_DISABLE_THREAD_SAFETY_ANALYSIS +#endif +#else +#define BOOST_THREAD_DISABLE_THREAD_SAFETY_ANALYSIS +#endif + +#ifdef USE_LOCK_STYLE_THREAD_SAFETY_ATTRIBUTES +// The original version of thread safety analysis the following attribute +// definitions. These use a lock-based terminology. They are still in use +// by existing thread safety code, and will continue to be supported. + +// Deprecated. +#define BOOST_THREAD_PT_GUARDED_VAR \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_var) + +// Deprecated. +#define BOOST_THREAD_GUARDED_VAR \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(guarded_var) + +// Replaced by REQUIRES +#define BOOST_THREAD_EXCLUSIVE_LOCKS_REQUIRED(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(__VA_ARGS__)) + +// Replaced by REQUIRES_SHARED +#define BOOST_THREAD_SHARED_LOCKS_REQUIRED(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(shared_locks_required(__VA_ARGS__)) + +// Replaced by CAPABILITY +#define BOOST_THREAD_LOCKABLE \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(lockable) + +// Replaced by SCOPED_CAPABILITY +#define BOOST_THREAD_SCOPED_LOCKABLE \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable) + +// Replaced by ACQUIRE +#define BOOST_THREAD_EXCLUSIVE_LOCK_FUNCTION(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(exclusive_lock_function(__VA_ARGS__)) + +// Replaced by ACQUIRE_SHARED +#define BOOST_THREAD_SHARED_LOCK_FUNCTION(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(shared_lock_function(__VA_ARGS__)) + +// Replaced by RELEASE and RELEASE_SHARED +#define BOOST_THREAD_UNLOCK_FUNCTION(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(unlock_function(__VA_ARGS__)) + +// Replaced by TRY_ACQUIRE +#define BOOST_THREAD_EXCLUSIVE_TRYLOCK_FUNCTION(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(exclusive_trylock_function(__VA_ARGS__)) + +// Replaced by TRY_ACQUIRE_SHARED +#define BOOST_THREAD_SHARED_TRYLOCK_FUNCTION(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(shared_trylock_function(__VA_ARGS__)) + +// Replaced by ASSERT_CAPABILITY +#define BOOST_THREAD_ASSERT_EXCLUSIVE_LOCK(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(assert_exclusive_lock(__VA_ARGS__)) + +// Replaced by ASSERT_SHARED_CAPABILITY +#define BOOST_THREAD_ASSERT_SHARED_LOCK(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(assert_shared_lock(__VA_ARGS__)) + +// Replaced by EXCLUDE_CAPABILITY. +#define BOOST_THREAD_LOCKS_EXCLUDED(...) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(locks_excluded(__VA_ARGS__)) + +// Replaced by RETURN_CAPABILITY +#define BOOST_THREAD_LOCK_RETURNED(x) \ + BOOST_THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x)) + +#endif // USE_LOCK_STYLE_THREAD_SAFETY_ATTRIBUTES + +#endif // BOOST_THREAD_DETAIL_THREAD_SAFETY_HPP diff --git a/cmake/modules/FindCGAL.cmake b/cmake/modules/FindCGAL.cmake index 06c380d74f..abc1dc244a 100644 --- a/cmake/modules/FindCGAL.cmake +++ b/cmake/modules/FindCGAL.cmake @@ -36,7 +36,7 @@ IF(DEAL_II_HAVE_CXX17) ELSE(DEAL_II_HAVE_CXX17) SET(CGAL_FOUND FALSE) SET(CGAL_INCLUDE_DIRS "-NOTFOUND") - MESSAGE(WARNING "CGAL wrappers require C++17. Disabling CGAL Support.") + MESSAGE(STATUS "CGAL wrappers require C++17. Disabling CGAL Support.") ENDIF(DEAL_II_HAVE_CXX17) DEAL_II_PACKAGE_HANDLE(CGAL diff --git a/include/deal.II/cgal/surface_mesh.h b/include/deal.II/cgal/surface_mesh.h index 9e2b9e88dd..e10fc76df7 100644 --- a/include/deal.II/cgal/surface_mesh.h +++ b/include/deal.II/cgal/surface_mesh.h @@ -62,7 +62,7 @@ namespace CGALWrappers */ template void - convert_to_cgal_surface_mesh( + dealii_cell_to_cgal_surface_mesh( const typename dealii::Triangulation::cell_iterator &cell, const dealii::Mapping & mapping, CGAL::Surface_mesh & mesh); diff --git a/source/cgal/surface_mesh.cc b/source/cgal/surface_mesh.cc index 2df5775b6b..8d4fcf49f7 100644 --- a/source/cgal/surface_mesh.cc +++ b/source/cgal/surface_mesh.cc @@ -74,7 +74,7 @@ namespace CGALWrappers { template void - convert_to_cgal_surface_mesh( + dealii_cell_to_cgal_surface_mesh( const typename Triangulation::cell_iterator &cell, const Mapping & mapping, CGAL::Surface_mesh & mesh) diff --git a/source/cgal/surface_mesh.inst.in b/source/cgal/surface_mesh.inst.in index 3fe79dc6d4..985bd35eb9 100644 --- a/source/cgal/surface_mesh.inst.in +++ b/source/cgal/surface_mesh.inst.in @@ -19,7 +19,9 @@ for (dim : DIMENSIONS; spacedim : SPACE_DIMENSIONS; cgal_kernel : CGAL_KERNELS) { #if dim <= spacedim template void - convert_to_cgal_surface_mesh( + dealii_cell_to_cgal_surface_mesh( const typename Triangulation::cell_iterator &cell, const Mapping & mapping, CGAL::Surface_mesh & mesh); diff --git a/tests/cgal/cgal_surface_mesh_01.cc b/tests/cgal/cgal_surface_mesh_01.cc index 7254d7346e..009f704ebe 100644 --- a/tests/cgal/cgal_surface_mesh_01.cc +++ b/tests/cgal/cgal_surface_mesh_01.cc @@ -54,7 +54,7 @@ test() GridGenerator::reference_cell(tria, r_cell); const auto cell = tria.begin_active(); - convert_to_cgal_surface_mesh(cell, *mapping, mesh); + dealii_cell_to_cgal_surface_mesh(cell, *mapping, mesh); Assert(mesh.is_valid(), dealii::ExcMessage("The CGAL mesh is not valid")); deallog << "deal vertices: " << cell->n_vertices() << ", cgal vertices " -- 2.39.5