[llvm] r198292 - Support LLVM_STATIC_ASSERT() in clang pre-C++11 mode

Alp Toker alp at nuanti.com
Wed Jan 1 20:07:42 PST 2014


Author: alp
Date: Wed Jan  1 22:07:41 2014
New Revision: 198292

URL: http://llvm.org/viewvc/llvm-project?rev=198292&view=rev
Log:
Support LLVM_STATIC_ASSERT() in clang pre-C++11 mode

Modified:
    llvm/trunk/include/llvm/Support/Compiler.h

Modified: llvm/trunk/include/llvm/Support/Compiler.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Compiler.h?rev=198292&r1=198291&r2=198292&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Compiler.h (original)
+++ llvm/trunk/include/llvm/Support/Compiler.h Wed Jan  1 22:07:41 2014
@@ -21,6 +21,10 @@
 # define __has_feature(x) 0
 #endif
 
+#ifndef __has_extension
+# define __has_extension(x) 0
+#endif
+
 #ifndef __has_attribute
 # define __has_attribute(x) 0
 #endif
@@ -394,6 +398,8 @@
 # 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)
+#elif __has_extension(c_static_assert)
+# define LLVM_STATIC_ASSERT(expr, msg) LLVM_EXTENSION _Static_assert(expr, msg)
 #else
 # define LLVM_STATIC_ASSERT(expr, msg)
 #endif





More information about the llvm-commits mailing list