static_assert.h 462 B

1234567891011121314151617
  1. #ifndef AL_STATIC_ASSERT_H
  2. #define AL_STATIC_ASSERT_H
  3. #include <assert.h>
  4. #ifndef static_assert
  5. #ifdef HAVE_C11_STATIC_ASSERT
  6. #define static_assert _Static_assert
  7. #else
  8. #define CTASTR2(_pre,_post) _pre##_post
  9. #define CTASTR(_pre,_post) CTASTR2(_pre,_post)
  10. #define static_assert(_cond, _msg) typedef struct { int CTASTR(static_assert_failed_at_line_,__LINE__) : !!(_cond); } CTASTR(static_assertion_,__COUNTER__)
  11. #endif
  12. #endif
  13. #endif /* AL_STATIC_ASSERT_H */