mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 03:30:14 +01:00
py: Change makemoduledefs process so it uses output of qstr extraction.
This cleans up the parsing of MP_REGISTER_MODULE() and generation of genhdr/moduledefs.h so that it uses the same process as compressed error string messages, using the output of qstr extraction. This makes sure all MP_REGISTER_MODULE()'s that are part of the build are correctly picked up. Previously the extraction would miss some (eg if you had a mod.c file in the board directory for an stm32 board). Build speed is more or less unchanged. Thanks to @stinos for the ports/windows/msvc/genhdr.targets changes. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -34,7 +34,11 @@
|
||||
#include "py/runtime.h"
|
||||
#include "py/builtin.h"
|
||||
|
||||
#ifndef NO_QSTR
|
||||
// Only include module definitions when not doing qstr extraction, because the
|
||||
// qstr extraction stage also generates this module definition header file.
|
||||
#include "genhdr/moduledefs.h"
|
||||
#endif
|
||||
|
||||
#if MICROPY_MODULE_BUILTIN_INIT
|
||||
STATIC void mp_module_call_init(mp_obj_t module_name, mp_obj_t module_obj);
|
||||
@@ -161,10 +165,8 @@ mp_obj_t mp_obj_new_module(qstr module_name) {
|
||||
// Global module table and related functions
|
||||
|
||||
STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = {
|
||||
#ifdef MICROPY_REGISTERED_MODULES
|
||||
// builtin modules declared with MP_REGISTER_MODULE()
|
||||
MICROPY_REGISTERED_MODULES
|
||||
#endif
|
||||
};
|
||||
|
||||
MP_DEFINE_CONST_MAP(mp_builtin_module_map, mp_builtin_module_table);
|
||||
|
||||
Reference in New Issue
Block a user