Skip to content

Commit efe23ac

Browse files
committed
all: Remove third argument to MP_REGISTER_MODULE.
It's no longer needed because this macro is now processed after preprocessing the source code via cpp (in the qstr extraction stage), which means unused MP_REGISTER_MODULE's are filtered out by the preprocessor. Signed-off-by: Damien George <[email protected]>
1 parent 47f6343 commit efe23ac

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+173
-134
lines changed

docs/develop/cmodules.rst

Lines changed: 7 additions & 5 deletions

docs/develop/library.rst

Lines changed: 1 addition & 1 deletion

docs/develop/porting.rst

Lines changed: 1 addition & 6 deletions

examples/usercmodule/cexample/examplemodule.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,4 @@ const mp_obj_module_t example_user_cmodule = {
3131
};
3232

3333
// Register the module to make it available in Python.
34-
// Note: the "1" in the third argument means this module is always enabled.
35-
// This "1" can be optionally replaced with a macro like MODULE_CEXAMPLE_ENABLED
36-
// which can then be used to conditionally enable this module.
37-
MP_REGISTER_MODULE(MP_QSTR_cexample, example_user_cmodule, 1);
34+
MP_REGISTER_MODULE(MP_QSTR_cexample, example_user_cmodule);

examples/usercmodule/cppexample/examplemodule.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,4 @@ const mp_obj_module_t cppexample_user_cmodule = {
2222
};
2323

2424
// Register the module to make it available in Python.
25-
// Note: the "1" in the third argument means this module is always enabled.
26-
// This "1" can be optionally replaced with a macro like MODULE_CPPEXAMPLE_ENABLED
27-
// which can then be used to conditionally enable this module.
28-
MP_REGISTER_MODULE(MP_QSTR_cppexample, cppexample_user_cmodule, 1);
25+
MP_REGISTER_MODULE(MP_QSTR_cppexample, cppexample_user_cmodule);

extmod/modbluetooth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ const mp_obj_module_t mp_module_ubluetooth = {
10041004
.globals = (mp_obj_dict_t *)&mp_module_bluetooth_globals,
10051005
};
10061006

1007-
MP_REGISTER_MODULE(MP_QSTR_ubluetooth, mp_module_ubluetooth, MICROPY_PY_BLUETOOTH);
1007+
MP_REGISTER_MODULE(MP_QSTR_ubluetooth, mp_module_ubluetooth);
10081008

10091009
// Helpers
10101010

extmod/modbtree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ const mp_obj_module_t mp_module_btree = {
380380
.globals = (mp_obj_dict_t *)&mp_module_btree_globals,
381381
};
382382

383-
MP_REGISTER_MODULE(MP_QSTR_btree, mp_module_btree, MICROPY_PY_BTREE);
383+
MP_REGISTER_MODULE(MP_QSTR_btree, mp_module_btree);
384384
#endif
385385

386386
#endif // MICROPY_PY_BTREE

extmod/modframebuf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ const mp_obj_module_t mp_module_framebuf = {
668668
.globals = (mp_obj_dict_t *)&framebuf_module_globals,
669669
};
670670

671-
MP_REGISTER_MODULE(MP_QSTR_framebuf, mp_module_framebuf, MICROPY_PY_FRAMEBUF);
671+
MP_REGISTER_MODULE(MP_QSTR_framebuf, mp_module_framebuf);
672672
#endif
673673

674674
#endif // MICROPY_PY_FRAMEBUF

extmod/modlwip.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,9 +1778,9 @@ const mp_obj_module_t mp_module_lwip = {
17781778
.globals = (mp_obj_dict_t *)&mp_module_lwip_globals,
17791779
};
17801780

1781-
MP_REGISTER_MODULE(MP_QSTR_lwip, mp_module_lwip, MICROPY_PY_LWIP);
1781+
MP_REGISTER_MODULE(MP_QSTR_lwip, mp_module_lwip);
17821782

17831783
// On LWIP-ports, this is the usocket module (replaces extmod/modusocket.c).
1784-
MP_REGISTER_MODULE(MP_QSTR_usocket, mp_module_lwip, MICROPY_PY_LWIP);
1784+
MP_REGISTER_MODULE(MP_QSTR_usocket, mp_module_lwip);
17851785

17861786
#endif // MICROPY_PY_LWIP

extmod/modnetwork.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const mp_obj_module_t mp_module_network = {
102102
.globals = (mp_obj_dict_t *)&mp_module_network_globals,
103103
};
104104

105-
MP_REGISTER_MODULE(MP_QSTR_network, mp_module_network, MICROPY_PY_NETWORK);
105+
MP_REGISTER_MODULE(MP_QSTR_network, mp_module_network);
106106

107107
/*******************************************************************************/
108108
// Implementations of network methods that can be used by any interface

0 commit comments

Comments
 (0)