mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 03:30:14 +01:00
py/makemoduledefs.py: Avoid empty extensible module lists.
An empty array is a C extension supported by clang & GCC but not MSVC. This also saves a bit of code size if there are no extensible modules. Fixes issue #18141. Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This commit is contained in:
committed by
Damien George
parent
653f7784d7
commit
41284577ca
@@ -85,19 +85,25 @@ def generate_module_table_header(modules):
|
||||
)
|
||||
)
|
||||
|
||||
# There should always be at least one module (__main__ in runtime.c)
|
||||
assert mod_defs
|
||||
|
||||
print("\n#define MICROPY_REGISTERED_MODULES \\")
|
||||
|
||||
for mod_def in sorted(mod_defs):
|
||||
print(" {mod_def} \\".format(mod_def=mod_def))
|
||||
|
||||
print("// MICROPY_REGISTERED_MODULES")
|
||||
|
||||
print("\n#define MICROPY_REGISTERED_EXTENSIBLE_MODULES \\")
|
||||
# There are not necessarily any extensible modules (e.g., bare-arm or minimal x86)
|
||||
print("\n#define MICROPY_HAVE_REGISTERED_EXTENSIBLE_MODULES ", len(extensible_mod_defs))
|
||||
|
||||
for mod_def in sorted(extensible_mod_defs):
|
||||
print(" {mod_def} \\".format(mod_def=mod_def))
|
||||
if extensible_mod_defs:
|
||||
print("\n#define MICROPY_REGISTERED_EXTENSIBLE_MODULES \\")
|
||||
|
||||
print("// MICROPY_REGISTERED_EXTENSIBLE_MODULES")
|
||||
for mod_def in sorted(extensible_mod_defs):
|
||||
print(" {mod_def} \\".format(mod_def=mod_def))
|
||||
|
||||
print("// MICROPY_REGISTERED_EXTENSIBLE_MODULES")
|
||||
|
||||
|
||||
def generate_module_delegations(delegations):
|
||||
|
||||
Reference in New Issue
Block a user