[llvm] r177699 - Introduce LLVM_STATIC_ASSERT macro, which expands to C/C++'s static_assert on compilers which support it.
Chandler Carruth
chandlerc at google.com
Thu Mar 21 20:17:22 PDT 2013
You might want to factor out TOOLING_COMPILE_ASSERT in ASTMatchersInternal.h
On Thu, Mar 21, 2013 at 8:10 PM, Argyrios Kyrtzidis <akyrtzi at gmail.com>wrote:
> Author: akirtzidis
> Date: Thu Mar 21 22:10:51 2013
> New Revision: 177699
>
> URL: http://llvm.org/viewvc/llvm-project?rev=177699&view=rev
> Log:
> Introduce LLVM_STATIC_ASSERT macro, which expands to C/C++'s static_assert
> on compilers which support it.
>
> 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=177699&r1=177698&r2=177699&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/Compiler.h (original)
> +++ llvm/trunk/include/llvm/Support/Compiler.h Thu Mar 21 22:10:51 2013
> @@ -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
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130321/ba79ed4d/attachment.html>
More information about the llvm-commits
mailing list