From 72ced1dca342ab7d6ecab897e6f041f42f39a21b Mon Sep 17 00:00:00 2001 From: eschnett Date: Mon, 20 May 2013 14:44:43 +0000 Subject: Auto-configure static_assert Check whether static_assert is supported by C++. Define a work-around if it is not supported. git-svn-id: http://svn.cactuscode.org/flesh/trunk@5014 17b73243-c579-4c4c-a9d2-2d5706c11dac --- lib/make/cctk_Config.h.in | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/make/cctk_Config.h.in') diff --git a/lib/make/cctk_Config.h.in b/lib/make/cctk_Config.h.in index 9805c839..2e3a0c48 100644 --- a/lib/make/cctk_Config.h.in +++ b/lib/make/cctk_Config.h.in @@ -595,6 +595,15 @@ typedef enum {false, true} bool; # define CCTK_BUILTIN_UNREACHABLE() CCTK_Abort(0, 1) #endif +/* Whether static_assert exists. */ +#undef HAVE_CCTK_CXX_STATIC_ASSERT +#ifdef HAVE_CCTK_CXX_STATIC_ASSERT +# define CCTK_STATIC_ASSERT(cond,msg) static_assert(cond,msg) +#else +# define CCTK_STATIC_ASSERT(cond,msg) do { typedef int ai[(cond) ? 1 : -1]; } while(0) +# define static_assert(cond,msg) CCTK_STATIC_ASSERT(cond,msg) +#endif + /* Some C++ compilers recognise the restrict keyword */ /* Define to empty if the keyword does not work. */ #ifdef CCTK_DISABLE_RESTRICT -- cgit v1.2.3