From afb59e7f98f40cde77c150414a8a5bd13f40781a Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 14 Apr 2017 18:15:56 -0700 Subject: Move internal headers out of the include directory --- common/static_assert.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 common/static_assert.h (limited to 'common/static_assert.h') diff --git a/common/static_assert.h b/common/static_assert.h new file mode 100644 index 00000000..bf0ce065 --- /dev/null +++ b/common/static_assert.h @@ -0,0 +1,21 @@ +#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) +#if defined(__COUNTER__) +#define static_assert(_cond, _msg) typedef struct { int CTASTR(static_assert_failed_at_line_,__LINE__) : !!(_cond); } CTASTR(static_assertion_,__COUNTER__) +#else +#define static_assert(_cond, _msg) struct { int CTASTR(static_assert_failed_at_line_,__LINE__) : !!(_cond); } +#endif +#endif +#endif + +#endif /* AL_STATIC_ASSERT_H */ -- cgit v1.2.3