Bug 9948 – -deps dependency printing incorrect for templates

Status
REOPENED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-04-17T05:49:39Z
Last change time
2024-12-13T18:06:10Z
Assigned to
No Owner
Creator
jfanatiker
Moved to GitHub: dmd#18565 →

Comments

Comment #0 by jfanatiker — 2013-04-17T05:49:39Z
Currently the emitted dependencies are incorrect for templates: Dependencies are emitted for the module that references the dependency, even if this reference is within a template. This is incorrect, as only the code instantiating the template really depends on the template dependencies, there is no need to rebuild a module, if an import within a template changes. Consider this simplified example, which makes the issue most clear: ```D // module a void templateFunc(string myImport)() { mixin(myImport); // .... } // module b: void main() { templateFunc("import std.string;")(); } ``` It seems a bit artificial, but in fact it is not (consider Diet templates for example). In this example the dependencies for module "a" change, depending on what code it uses. The effect is not severe, it will just make build tools less efficient, because modules need to be compiled needlessly, it should nevertheless be fixed. I have a patch in the works already.
Comment #1 by jfanatiker — 2013-09-12T13:43:49Z
Also some linking errors, concerning incremental building seem to be related to this issue. (Templates are emitted into the wrong .o file)
Comment #2 by bugzilla — 2013-09-12T13:59:37Z
Comment #3 by github-bugzilla — 2013-09-13T23:21:34Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/7e0276e2a6ae7f7416dbdbeb473802d3092bb83a fix Issue 9948 - -deps dependency printing incorrect for templates This fix is based on the just merged pull request: https://github.com/D-Programming-Language/dmd/pull/2550 by Walter Bright. It made this fix trivial (at least the test case in the bug report is working correctly now). https://github.com/D-Programming-Language/dmd/commit/04e4f465e034d0dc4fd860d85ad6d5affb35c389 Merge pull request #2553 from eskimor/fix9948 fix Issue 9948 - -deps dependency printing incorrect for templates
Comment #4 by bugzilla — 2013-09-13T23:22:08Z
Fixed for D2.
Comment #5 by ag0aep6g — 2021-06-17T12:15:09Z
Unfortunately, the fix produced wrong results. So I reverted it in <https://github.com/dlang/dmd/pull/11723>. Reopening.
Comment #6 by robert.schadek — 2024-12-13T18:06:10Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18565 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB