2014-05-07 02:28:25 -07:00
|
|
|
#ifndef AL_STATIC_ASSERT_H
|
|
|
|
#define AL_STATIC_ASSERT_H
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef static_assert
|
|
|
|
#ifdef HAVE_C11_STATIC_ASSERT
|
|
|
|
#define static_assert _Static_assert
|
2015-03-02 23:05:25 -08:00
|
|
|
#else
|
2014-05-07 02:28:25 -07:00
|
|
|
#define CTASTR2(_pre,_post) _pre##_post
|
|
|
|
#define CTASTR(_pre,_post) CTASTR2(_pre,_post)
|
2015-03-02 23:05:25 -08:00
|
|
|
#if defined(__COUNTER__)
|
2014-05-07 02:28:25 -07:00
|
|
|
#define static_assert(_cond, _msg) typedef struct { int CTASTR(static_assert_failed_at_line_,__LINE__) : !!(_cond); } CTASTR(static_assertion_,__COUNTER__)
|
2014-11-07 19:40:11 -08:00
|
|
|
#else
|
|
|
|
#define static_assert(_cond, _msg) struct { int CTASTR(static_assert_failed_at_line_,__LINE__) : !!(_cond); }
|
2014-05-07 02:28:25 -07:00
|
|
|
#endif
|
|
|
|
#endif
|
2015-03-02 23:05:25 -08:00
|
|
|
#endif
|
2014-05-07 02:28:25 -07:00
|
|
|
|
|
|
|
#endif /* AL_STATIC_ASSERT_H */
|