Introduce LLVM_STATIC_ASSERT macro, which expands to C/C++'s static_assert on compile...
[oota-llvm.git] / include / llvm / Support / Compiler.h
index 25f42a98e7dec07caa0d5275374c6760ef85ea9a..13d057be049f3675bf60f180198402b549672e3e 100644 (file)
 #define LLVM_EXPLICIT
 #endif
 
+/// \macro LLVM_STATIC_ASSERT
+/// \brief Expands to C/C++'s static_assert on compilers which support it.
+#if __has_feature(cxx_static_assert)
+# define LLVM_STATIC_ASSERT(expr, msg) static_assert(expr, msg)
+#elif __has_feature(c_static_assert)
+# define LLVM_STATIC_ASSERT(expr, msg) _Static_assert(expr, msg)
+#else
+# define LLVM_STATIC_ASSERT(expr, msg)
+#endif
+
 #endif