diff --git a/src/defs.h b/src/defs.h index e4a4c49f..290a854d 100644 --- a/src/defs.h +++ b/src/defs.h @@ -368,5 +368,15 @@ #define FIXME "FIXME: " __FILE__ ", " STRINGIFY(__LINE__) +#ifndef STATIC_ASSERT +# if __STDC_VERSION__ >= 201112L +# define STATIC_ASSERT(expr, msg) _Static_assert(expr, msg) +# elif defined(static_assert) +# define STATIC_ASSERT(expr, msg) static_assert(expr, msg) +# else +# define STATIC_ASSERT(expr, msg) switch (0) {case 0:case (expr):;} +# endif +#endif /* STATIC_ASSERT */ + /* *INDENT-ON* */ /* clang-format on */