J
Jerry Coffin
[... minor change in header causing unnecessary re-compilation]
The one time I ran into this being a problem, I didn't use the compiler
to find dependencies particularly. Rather, I saved a pre-processed
version of the header and made the other files depend on that. When the
header itself changed, I preprocessed it to an intermediate file, then
compared that to the existing preprocessed file. The preprocessed file
was replaced if and only if the content (ignoring #line directives) had
changed.
The only noticeable shortcoming was that error messages sometimes cited
the wrong lines in the header -- but those were usually incorrectly
instantiated templates, and the real error was in the instantiation, not
the template itself.
It takes a little more than one line. In fact, it takes some
collaboration from the compiler, and some shell behind it. But
it does work, and it works correctly (unlike most other tools
I've seen), because it depends on the compiler to find the
dependencies, rather than trying to reimplement the compiler's
logic internally.
The one time I ran into this being a problem, I didn't use the compiler
to find dependencies particularly. Rather, I saved a pre-processed
version of the header and made the other files depend on that. When the
header itself changed, I preprocessed it to an intermediate file, then
compared that to the existing preprocessed file. The preprocessed file
was replaced if and only if the content (ignoring #line directives) had
changed.
The only noticeable shortcoming was that error messages sometimes cited
the wrong lines in the header -- but those were usually incorrectly
instantiated templates, and the real error was in the instantiation, not
the template itself.