From 6670281472aa3c931b08e623488a02c335aeda20 Mon Sep 17 00:00:00 2001 From: Yonatan Goldschmidt Date: Sat, 16 Jul 2022 16:47:41 +0300 Subject: [PATCH] py/misc: Add MP_STATIC_ASSERT_NOT_MSC(). To be used in cases where the condition of the assert does not compile under msvc. Signed-off-by: Yonatan Goldschmidt --- py/misc.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/py/misc.h b/py/misc.h index d94afd0b0d..b7b6146abc 100644 --- a/py/misc.h +++ b/py/misc.h @@ -52,6 +52,11 @@ typedef unsigned int uint; // Static assertion macro #define MP_STATIC_ASSERT(cond) ((void)sizeof(char[1 - 2 * !(cond)])) +#if defined(_MSC_VER) +#define MP_STATIC_ASSERT_NOT_MSC(cond) (1) +#else +#define MP_STATIC_ASSERT_NOT_MSC(cond) MP_STATIC_ASSERT(cond) +#endif // Round-up integer division #define MP_CEIL_DIVIDE(a, b) (((a) + (b) - 1) / (b))