X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/mLib/blobdiff_plain/2eea69731acfd2491d67e84edaa078f24c48c96b..5e80901ea39f40c1763ee64dae80fb0a89210db3:/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 --- */