1 #ifndef RBIMPL_STATIC_ASSERT_H
2 #define RBIMPL_STATIC_ASSERT_H
28 #if defined(__cplusplus) && defined(__cpp_static_assert)
30 # define RBIMPL_STATIC_ASSERT0 static_assert
32 #elif defined(__cplusplus) && RBIMPL_COMPILER_SINCE(MSVC, 16, 0, 0)
33 # define RBIMPL_STATIC_ASSERT0 static_assert
35 #elif defined(__INTEL_CXX11_MODE__)
36 # define RBIMPL_STATIC_ASSERT0 static_assert
38 #elif defined(__cplusplus) && __cplusplus >= 201103L
39 # define RBIMPL_STATIC_ASSERT0 static_assert
41 #elif defined(__cplusplus) && RBIMPL_HAS_EXTENSION(cxx_static_assert)
42 # define RBIMPL_STATIC_ASSERT0 __extension__ static_assert
44 #elif defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__
45 # define RBIMPL_STATIC_ASSERT0 __extension__ static_assert
47 #elif defined(__STDC_VERSION__) && RBIMPL_HAS_EXTENSION(c_static_assert)
48 # define RBIMPL_STATIC_ASSERT0 __extension__ _Static_assert
50 #elif defined(__STDC_VERSION__) && RBIMPL_COMPILER_SINCE(GCC, 4, 6, 0)
51 # define RBIMPL_STATIC_ASSERT0 __extension__ _Static_assert
53 #elif defined(static_assert)
55 # define RBIMPL_STATIC_ASSERT0 static_assert
65 #if defined(__DOXYGEN__)
66 # define RBIMPL_STATIC_ASSERT static_assert
68 #elif defined(RBIMPL_STATIC_ASSERT0)
69 # define RBIMPL_STATIC_ASSERT(name, expr) \
70 RBIMPL_STATIC_ASSERT0(expr, # name ": " # expr)
73 # define RBIMPL_STATIC_ASSERT(name, expr) \
74 MAYBE_UNUSED(typedef int static_assert_ ## name ## _check[1 - 2 * !(expr)])
Defines RBIMPL_COMPILER_SINCE.
Defines RBIMPL_HAS_EXTENSION.