From 1c01e9423719c96866c82cb395388409db0bba35 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 7 May 2014 02:28:25 -0700 Subject: [PATCH] Move the static_assert definition to its own header --- OpenAL32/Include/alMain.h | 11 +---------- include/atomic.h | 2 ++ include/static_assert.h | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 include/static_assert.h diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 5af33a3a..a95abd44 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -21,16 +21,6 @@ #include "AL/alext.h" -#ifndef static_assert -#ifdef HAVE_C11_STATIC_ASSERT -#define static_assert _Static_assert -#else -#define CTASTR2(_pre,_post) _pre##_post -#define CTASTR(_pre,_post) CTASTR2(_pre,_post) -#define static_assert(_cond, _msg) typedef struct { int CTASTR(static_assert_failed_at_line_,__LINE__) : !!(_cond); } CTASTR(static_assertion_,__COUNTER__) -#endif -#endif - #if defined(_WIN64) #define SZFMT "%I64u" #elif defined(_WIN32) @@ -40,6 +30,7 @@ #endif +#include "static_assert.h" #include "align.h" #include "atomic.h" #include "uintmap.h" diff --git a/include/atomic.h b/include/atomic.h index 3b5ec24d..3915dfd5 100644 --- a/include/atomic.h +++ b/include/atomic.h @@ -1,6 +1,8 @@ #ifndef AL_ATOMIC_H #define AL_ATOMIC_H +#include "static_assert.h" + typedef void *volatile XchgPtr; diff --git a/include/static_assert.h b/include/static_assert.h new file mode 100644 index 00000000..65283cf0 --- /dev/null +++ b/include/static_assert.h @@ -0,0 +1,17 @@ +#ifndef AL_STATIC_ASSERT_H +#define AL_STATIC_ASSERT_H + +#include + + +#ifndef static_assert +#ifdef HAVE_C11_STATIC_ASSERT +#define static_assert _Static_assert +#else +#define CTASTR2(_pre,_post) _pre##_post +#define CTASTR(_pre,_post) CTASTR2(_pre,_post) +#define static_assert(_cond, _msg) typedef struct { int CTASTR(static_assert_failed_at_line_,__LINE__) : !!(_cond); } CTASTR(static_assertion_,__COUNTER__) +#endif +#endif + +#endif /* AL_STATIC_ASSERT_H */ -- 2.11.4.GIT