Avoid duplicate calculations
[openal-soft.git] / include / static_assert.h
blob12a095a33b8fc91e91d03a06f7569fa52958ef68
1 #ifndef AL_STATIC_ASSERT_H
2 #define AL_STATIC_ASSERT_H
4 #include <assert.h>
7 #ifndef static_assert
8 #ifdef HAVE_C11_STATIC_ASSERT
9 #define static_assert _Static_assert
10 #elif defined(__COUNTER__)
11 #define CTASTR2(_pre,_post) _pre##_post
12 #define CTASTR(_pre,_post) CTASTR2(_pre,_post)
13 #define static_assert(_cond, _msg) typedef struct { int CTASTR(static_assert_failed_at_line_,__LINE__) : !!(_cond); } CTASTR(static_assertion_,__COUNTER__)
14 #else
15 #define static_assert(_cond, _msg) struct { int CTASTR(static_assert_failed_at_line_,__LINE__) : !!(_cond); }
16 #endif
17 #endif
19 #endif /* AL_STATIC_ASSERT_H */