tools/mpy-tool.py: Fix build error when no qstrs present in frozen mpy.
If you happen to only have a really simple frozen file that doesn't contain any new qstrs then the generated frozen_mpy.c file contains an empty enumeration which causes a C compile time error.pull/1/head
parent
0d165fec9c
commit
39eef27083
|
@ -510,13 +510,14 @@ def freeze_mpy(base_qstrs, raw_codes):
|
||||||
print('#endif')
|
print('#endif')
|
||||||
print()
|
print()
|
||||||
|
|
||||||
print('enum {')
|
if len(new) > 0:
|
||||||
for i in range(len(new)):
|
print('enum {')
|
||||||
if i == 0:
|
for i in range(len(new)):
|
||||||
print(' MP_QSTR_%s = MP_QSTRnumber_of,' % new[i][1])
|
if i == 0:
|
||||||
else:
|
print(' MP_QSTR_%s = MP_QSTRnumber_of,' % new[i][1])
|
||||||
print(' MP_QSTR_%s,' % new[i][1])
|
else:
|
||||||
print('};')
|
print(' MP_QSTR_%s,' % new[i][1])
|
||||||
|
print('};')
|
||||||
|
|
||||||
# As in qstr.c, set so that the first dynamically allocated pool is twice this size; must be <= the len
|
# As in qstr.c, set so that the first dynamically allocated pool is twice this size; must be <= the len
|
||||||
qstr_pool_alloc = min(len(new), 10)
|
qstr_pool_alloc = min(len(new), 10)
|
||||||
|
|
Loading…
Reference in New Issue