From 02eea0da2448f2be9bcc04f340a6a0a1fae18f7b Mon Sep 17 00:00:00 2001 From: stijn Date: Tue, 22 Apr 2025 14:53:07 +0200 Subject: py: Make struct-initializing macros compatible with C++. This requires explicitly naming and initializing all members so add that where needed and possible. For MP_DEFINE_NLR_JUMP_CALLBACK_FUNCTION_1 this would require initializing the .callback member, but that's a bit of a waste since the macro is always followed by a call to nlr_push_jump_callback() to initialize exactly that member, so rewrite the macro without initializers. Signed-off-by: stijn --- py/objtuple.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'py/objtuple.h') diff --git a/py/objtuple.h b/py/objtuple.h index 034814b826..3c82a9edcf 100644 --- a/py/objtuple.h +++ b/py/objtuple.h @@ -50,7 +50,7 @@ extern const mp_obj_type_t mp_type_attrtuple; #define MP_DEFINE_ATTRTUPLE(tuple_obj_name, fields, nitems, ...) \ const mp_rom_obj_tuple_t tuple_obj_name = { \ - .base = {&mp_type_attrtuple}, \ + .base = {.type = &mp_type_attrtuple}, \ .len = nitems, \ .items = { __VA_ARGS__, MP_ROM_PTR((void *)fields) } \ } -- cgit v1.2.3