diff options
Diffstat (limited to 'utils.hpp')
-rw-r--r-- | utils.hpp | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -3,13 +3,19 @@ #pragma once +#if defined(NDEBUG) #ifdef __clang__ -# define UNREACHABLE __builtin_unreachable +# define UNREACHABLE (__builtin_unreachable()) #elif __GNUC__ -# define UNREACHABLE __builtin_unreachable +# define UNREACHABLE (__builtin_unreachable()) #else # define UNREACHABLE #endif +#else +#include <cassert> +#define UNREACHABLE (assert((void*)0 == "Unreachable code reached"), abort(), 1) +#endif + #include <stdint.h> |