Skip to content

Commit 6670281

Browse files
Jongydpgeorge
authored andcommitted
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 <[email protected]>
1 parent cca2305 commit 6670281

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

py/misc.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ typedef unsigned int uint;
5252

5353
// Static assertion macro
5454
#define MP_STATIC_ASSERT(cond) ((void)sizeof(char[1 - 2 * !(cond)]))
55+
#if defined(_MSC_VER)
56+
#define MP_STATIC_ASSERT_NOT_MSC(cond) (1)
57+
#else
58+
#define MP_STATIC_ASSERT_NOT_MSC(cond) MP_STATIC_ASSERT(cond)
59+
#endif
5560

5661
// Round-up integer division
5762
#define MP_CEIL_DIVIDE(a, b) (((a) + (b) - 1) / (b))

0 commit comments

Comments
 (0)