X-Git-Url: https://git.distorted.org.uk/~mdw/mLib/blobdiff_plain/02ce250eda201a9f8a4a5480937238a321e084da..f50c1365107c09453531f01bcaebc3b197c3627f:/utils/macros.h diff --git a/utils/macros.h b/utils/macros.h index 5f432f7..9e27a48 100644 --- a/utils/macros.h +++ b/utils/macros.h @@ -34,6 +34,8 @@ /*----- Header files ------------------------------------------------------*/ +#include + #ifndef MLIB_COMPILER_H # include "compiler.h" #endif @@ -48,6 +50,13 @@ #define MLIB__GLUE(x, y) x##y #define GLUE(x, y) MLIB__GLUE(x, y) +#ifdef static_assert +# define STATIC_ASSERT(cond, msg) static_assert(cond, msg) +#else +# define STATIC_ASSERT(cond, msg) \ + IGNORABLE extern char static_assert_failed[2*!!(cond) - 1] +#endif + /*----- Compiler diagnostics ----------------------------------------------*/ /* --- Compiler-specific definitions --- */