summaryrefslogtreecommitdiff
path: root/lib/make/cctk_Config.h.in
diff options
context:
space:
mode:
authoreschnett <eschnett@17b73243-c579-4c4c-a9d2-2d5706c11dac>2013-05-20 14:44:43 +0000
committereschnett <eschnett@17b73243-c579-4c4c-a9d2-2d5706c11dac>2013-05-20 14:44:43 +0000
commit72ced1dca342ab7d6ecab897e6f041f42f39a21b (patch)
treeb5391d2507e1945c5a8dc4dfe47065ba5e29ae46 /lib/make/cctk_Config.h.in
parent6d26c28d3b9562087a41514499cb585df3dd52f0 (diff)
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
Diffstat (limited to 'lib/make/cctk_Config.h.in')
-rw-r--r--lib/make/cctk_Config.h.in9
1 files changed, 9 insertions, 0 deletions
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