From 9f83f94530938384c53714742800aa82f1dbd241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Fri, 8 Nov 2024 11:05:45 +0100 Subject: [PATCH] assume from c++23 --- Installation/include/CGAL/config.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Installation/include/CGAL/config.h b/Installation/include/CGAL/config.h index ff437a7f444f..091b082d834b 100644 --- a/Installation/include/CGAL/config.h +++ b/Installation/include/CGAL/config.h @@ -157,6 +157,10 @@ #if __cplusplus >= 202002L || _MSVC_LANG >= 202002L # define CGAL_CXX20 1 #endif +// Same for C++23 +#if __cplusplus >= 202302L || _MSVC_LANG >= 202302L +# define CGAL_CXX23 1 +#endif //----------------------------------------------------------------------// @@ -351,8 +355,10 @@ using std::max; #endif // Macro CGAL_ASSUME and CGAL_UNREACHABLE +#ifdef CGAL_CXX23 +# define CGAL_ASSUME(EX) [[ assume(EX) ]] +#elif __has_builtin(__builtin_unreachable) || (CGAL_GCC_VERSION > 0 && !__STRICT_ANSI__) // Call a builtin of the compiler to pass a hint to the compiler -#if __has_builtin(__builtin_unreachable) || (CGAL_GCC_VERSION > 0 && !__STRICT_ANSI__) // From g++ 4.5, there exists a __builtin_unreachable() // Also in LLVM/clang # define CGAL_ASSUME(EX) if(!(EX)) { __builtin_unreachable(); }