You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Previously, the including detection process caching relied on the .d
files generated by compilation to know what .h files a given source
files depends on. This works correctly, but if a project does not
compile completely, not all .d files are generated, so not all cached
include detection results can be used.
In practice, this means that if a there is a compilation error in the
first file that is compiled, include detection will run again for all
files on the next run. If you have a few errors to solve and a big
project, this gets annoying quickly.
To fix this, the include detection process should generate .d files
itself. At first glance it appears that there is a problematic case
where the list of included header files changes, the include detection
overwrites the .d file and then compilation only sees the new list
(which was generated later than the .o file was generated). However,
since this implies that changes are made to an #include directive in the
source file itself or one of the files that are still included, this
should be detected normally. There is still a corner case when a file is
changed during the build, but that was already the case.
Since include detections uses `-o /dev/null`, the compiler generates a
slightly different .d file. During compilation, a file `foo.cpp.d` is
generated in the output directory starting with:
/path/to/foo.cpp.o: \
But when just passing `-MMD` to the preproc recipe, it generates a
`foo.d` file in the source directory starting with:
foo.o: \
To make these equal, `-MF` must be passed during include detection to
set the .d filename, and `-MT` must be passed to set the .o filename
inside the .d file.
To enable this feature, platform.txt should be modified by adding ` -MMD
-MF {dep_file} -MT {object_file}` to `preproc.macros.flags` (or
`recipe.preproc.macros`). Without any changes to platform.txt, behaviour
is unchanged.
To allow this, this adds `{dep_file}` and `{object_file}` variables to
the build properties for the preproc macros recipe. For consistency,
`{dep_file}` is also added during normal compilation, though it is not
currently used.
0 commit comments