26 #define SPOT_LIKELY(expr) __builtin_expect(!!(expr), 1)
27 #define SPOT_UNLIKELY(expr) __builtin_expect(!!(expr), 0)
29 #define SPOT_LIKELY(expr) (expr)
30 #define SPOT_UNLIKELY(expr) (expr)
34 #define SPOT_DEPRECATED __attribute__ ((deprecated))
35 #elif defined(_MSC_VER)
36 #define SPOT_DEPRECATED __declspec(deprecated)
38 #define SPOT_DEPRECATED func
41 #if defined _WIN32 || defined __CYGWIN__
42 #define SPOT_HELPER_DLL_IMPORT __declspec(dllimport)
43 #define SPOT_HELPER_DLL_EXPORT __declspec(dllexport)
44 #define SPOT_HELPER_DLL_LOCAL
47 #define SPOT_HELPER_DLL_IMPORT __attribute__ ((visibility ("default")))
48 #define SPOT_HELPER_DLL_EXPORT __attribute__ ((visibility ("default")))
49 #define SPOT_HELPER_DLL_LOCAL __attribute__ ((visibility ("hidden")))
51 #define SPOT_HELPER_DLL_IMPORT
52 #define SPOT_HELPER_DLL_EXPORT
53 #define SPOT_HELPER_DLL_LOCAL
66 #define spot_assert__ assert
67 #if defined(SPOT_BUILD) or defined(SPOT_DEBUG)
68 #define SPOT_ASSERT(x) spot_assert__(x)
70 #define SPOT_ASSERT(x) while (0)
78 #define SPOT_API SPOT_HELPER_DLL_EXPORT
80 #define SPOT_API SPOT_HELPER_DLL_IMPORT
82 #define SPOT_LOCAL SPOT_HELPER_DLL_LOCAL
87 #define SPOT_API_VAR extern SPOT_API
98 #if defined __clang__ || defined __GNU__
99 # define SPOT_UNREACHABLE_BUILTIN() __builtin_unreachable()
100 # elif defined _MSC_VER
101 # define SPOT_UNREACHABLE_BUILTIN() __assume(0)
103 # define SPOT_UNREACHABLE_BUILTIN() abort()
108 #define SPOT_UNREACHABLE() do { \
109 SPOT_ASSERT(!("unreachable code reached")); \
110 SPOT_UNREACHABLE_BUILTIN(); \
113 #define SPOT_UNIMPLEMENTED() throw std::runtime_error("unimplemented");
118 #define SPOT_RETURN(code) -> decltype(code) { return code; }
126 : std::runtime_error(s)
Definition: common.hh:123