unreachable

v1
Brett 2024-08-04 21:23:39 -04:00
parent befd5e0ca1
commit 79ad108fab
3 changed files with 10 additions and 2 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.20) cmake_minimum_required(VERSION 3.20)
include(cmake/color.cmake) include(cmake/color.cmake)
set(BLT_VERSION 0.18.19) set(BLT_VERSION 0.18.20)
set(BLT_TEST_VERSION 0.0.1) set(BLT_TEST_VERSION 0.0.1)
set(BLT_TARGET BLT) set(BLT_TARGET BLT)

View File

@ -96,6 +96,7 @@ namespace blt
#if defined(__GNUC__) || defined(__llvm__) #if defined(__GNUC__) || defined(__llvm__)
#define BLT_UNREACHABLE __builtin_unreachable()
#define BLT_ATTRIB_NO_INLINE __attribute__ ((noinline)) #define BLT_ATTRIB_NO_INLINE __attribute__ ((noinline))
/** /**
* means that the return value is solely a function of the arguments, * means that the return value is solely a function of the arguments,
@ -114,12 +115,19 @@ namespace blt
#else #else
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) #if defined(_MSC_VER) && !defined(__INTEL_COMPILER)
#define BLT_ATTRIB_NO_INLINE __declspec(noinline) #define BLT_ATTRIB_NO_INLINE __declspec(noinline)
#define BLT_UNREACHABLE __assume(false)
#else #else
#define BLT_ATTRIB_NO_INLINE #define BLT_ATTRIB_NO_INLINE
#define BLT_UNREACHABLE
#endif #endif
#define BLT_ATTRIB_CONST #define BLT_ATTRIB_CONST
#define BLT_ATTRIB_PURE #define BLT_ATTRIB_PURE
#endif #endif
#if __cplusplus > 202002L
#undef BLT_UNREACHABLE
#define BLT_UNREACHABLE std::unreachable()
#endif
template<typename T> template<typename T>
BLT_ATTRIB_NO_INLINE void black_box(const T& val) BLT_ATTRIB_NO_INLINE void black_box(const T& val)

@ -1 +1 @@
Subproject commit d88c5e15079047777b418132ece5879e7c9aaa2b Subproject commit 8a889d3699b3c09ade435641fb034427f3fd12b6