Bug 21596 – Header generation should NOT touch the existing identical header file, if any

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-01-30T20:49:39Z
Last change time
2024-12-13T19:14:21Z
Assigned to
No Owner
Creator
Andrei Alexandrescu
Moved to GitHub: dmd#19862 →

Comments

Comment #0 by andrei — 2021-01-30T20:49:39Z
In a traditional build system using D "header" files generated with -H, dependency information is propagated by means of timestamp. Most of the time, a D file is touched in the implementation only, leaving the interface intact. However, the header generation invocation will overwrite the file, tricking the build system into thinking the interface has changed as well. As a consequence, the build results in cascaded unnecessary compilations. This can be addressed manually at the build system level, and indeed people have done so for years. However, the right way to go is address the problem at the source. The D compiler should NOT touch in any way a header file identical to the one it would generate with -H. The drawback is that next build will not figure that the header file has been generated and will generate it again; however, header generation is massively cheaper than recompiling transitive dependents. Note that this is distinct from https://issues.dlang.org/show_bug.cgi?id=21593; there, updating the timestamp is necessary because otherwise the next build will recompile the file, which is expensive.
Comment #1 by andrei — 2021-01-30T20:57:16Z
Comment #2 by robert.schadek — 2024-12-13T19:14:21Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19862 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB