Skip to content

Commit 27effe6

Browse files
committed
tools/mpy-tools.py: add .is_async; fix casting align issue
1 parent 54ff754 commit 27effe6

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

tools/mpy-tool.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ class Config:
130130
MP_SCOPE_FLAG_VIPERRELOC = 0x10
131131
MP_SCOPE_FLAG_VIPERRODATA = 0x20
132132
MP_SCOPE_FLAG_VIPERBSS = 0x40
133+
# CIRCUITPY-CHANGE: async is distinct from generator
134+
MP_SCOPE_FLAG_ASYNC = 0x80
133135

134136
MP_BC_MASK_EXTRA_BYTE = 0x9E
135137

@@ -897,7 +899,8 @@ def freeze_children(self, prelude_ptr=None):
897899
print()
898900
print("static const mp_raw_code_t *const children_%s[] = {" % self.escaped_name)
899901
for rc in self.children:
900-
print(" (const mp_raw_code_t *)&proto_fun_%s," % rc.escaped_name)
902+
# CIRCUITPY-CHANGE: add (void *) to prevent cast-align compiler warning
903+
print(" (const mp_raw_code_t *)(void *)&proto_fun_%s," % rc.escaped_name)
901904
if prelude_ptr:
902905
print(" (void *)%s," % prelude_ptr)
903906
print("};")
@@ -921,6 +924,8 @@ def freeze_raw_code(self, prelude_ptr=None, type_sig=0):
921924
print(" .proto_fun_indicator[1] = MP_PROTO_FUN_INDICATOR_RAW_CODE_1,")
922925
print(" .kind = %s," % RawCode.code_kind_str[self.code_kind])
923926
print(" .is_generator = %d," % bool(self.scope_flags & MP_SCOPE_FLAG_GENERATOR))
927+
# CIRCUITPY-CHANGE: async is distinct from generator
928+
print(" .is_async = %d," % bool(self.scope_flags & MP_SCOPE_FLAG_ASYNC))
924929
print(" .fun_data = fun_data_%s," % self.escaped_name)
925930
if len(self.children):
926931
print(" .children = (void *)&children_%s," % self.escaped_name)

0 commit comments

Comments
 (0)