diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-03-22 03:10:51 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-03-22 03:10:51 +0000 |
commit | d1995b2a362c45d4d119b0cec8977360dd6ef33f (patch) | |
tree | dcab47b0d320e4faf30a641c58c0ae4512b86e67 | |
parent | f0b0f1f9d97f4cf4d2f00c60fbc3d377a93465f8 (diff) |
Introduce LLVM_STATIC_ASSERT macro, which expands to C/C++'s static_assert on compilers which support it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177699 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Support/Compiler.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/llvm/Support/Compiler.h b/include/llvm/Support/Compiler.h index 25f42a98e7..13d057be04 100644 --- a/include/llvm/Support/Compiler.h +++ b/include/llvm/Support/Compiler.h @@ -351,4 +351,14 @@ #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 |