← index #8848PR #2974
Related · high · value 1.953
QUERY · ISSUE

qstr processing does not handle removed files

openby dlechopened 2022-07-01updated 2022-07-01
bug

As noted in https://github.com/micropython/micropython/blob/master/docs/develop/qstr.rst#compile-time-qstr-generation:

Note that this step only uses files that have changed, which means that qstr.i.last will only contain data from files that have changed since the last compile.

This means that qstrs from files that were removed from the list of dependencies are left in the build. Since other generators like the one for module definitions also depend on qstr.i.last, this means the same bug affects these generators as well.

Usually this causes a compiler error. To work around this, we have to delete the build directory and build from scratch (annoying and wastes time). But in cases when it doesn't cause an error, it just means we have extra stuff in our build that isn't supposed to be there. For example, if you are trying to compare a change in size with something enable vs. disable, this can give invalid results if you don't rebuild from scratch.

CANDIDATE · PULL REQUEST

msvc: Remove directory with generated files when cleaning

closedby stinosopened 2017-03-22updated 2017-03-23

This assures after cleaning all build artefacts (qstr related files,
generated version header) have been removed.

Before this patch this wasn't the case which could cause build errors because the qstr files weren't deleted, and the qstr generation code doesn't detect all possible changes leading (actually I'm not sure if this is known, I guess so?) resulting in missing qstr definitions.
Example for reproduction:

  • start from clean build
  • in mpconfigport.h, delete the line with #define MICROPY_STACK_CHECK (1)
  • build
  • restore said line mpconfigport.h
  • build -> MP_QSTR_stack_use is undeclared in modmicropython.c
    After that last step if clean doesn't remove the generated qstr files the error gets never fixed.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied