Skip to content

Commit

Permalink
assume from c++23
Browse files Browse the repository at this point in the history
  • Loading branch information
sloriot committed Nov 8, 2024
1 parent dd334d3 commit 9f83f94
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Installation/include/CGAL/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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


//----------------------------------------------------------------------//
Expand Down Expand Up @@ -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(); }
Expand Down

0 comments on commit 9f83f94

Please sign in to comment.