From a1069ebcc2fa3c67e5679a42a1ac2407e7431188 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 12 Nov 2021 10:15:12 -0600 Subject: [PATCH] check size of integers if possible --- py/circuitpy_mpconfig.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index a17d0183b1..5105be4d95 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -176,6 +176,10 @@ extern void common_hal_mcu_enable_interrupts(void); #define INT_FMT "%d" typedef int mp_int_t; // must be pointer size typedef unsigned mp_uint_t; // must be pointer size +#if __GNUC__ >= 10 // on recent gcc versions we can check that this is so +_Static_assert(sizeof(mp_int_t) == sizeof(void *)); +_Static_assert(sizeof(mp_uint_t) == sizeof(void *)); +#endif typedef long mp_off_t; #define MP_PLAT_PRINT_STRN(str, len) mp_hal_stdout_tx_strn_cooked(str, len)