From 43d08d6dd6fab6c88eeb20663ab97d622c2ea915 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 18 May 2018 13:10:31 +1000 Subject: [PATCH] py/misc.h: Add MP_STATIC_ASSERT macro to do static assertions. --- py/misc.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/py/misc.h b/py/misc.h index 72560da1eb..e6d25b8509 100644 --- a/py/misc.h +++ b/py/misc.h @@ -50,6 +50,9 @@ typedef unsigned int uint; #define _MP_STRINGIFY(x) #x #define MP_STRINGIFY(x) _MP_STRINGIFY(x) +// Static assertion macro +#define MP_STATIC_ASSERT(cond) ((void)sizeof(char[1 - 2 * !(cond)])) + /** memory allocation ******************************************/ // TODO make a lazy m_renew that can increase by a smaller amount than requested (but by at least 1 more element)