www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9948] New: -deps dependency printing incorrect for templates

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9948

           Summary: -deps dependency printing incorrect for templates
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: jfanatiker gmx.at



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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 17 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9948




Also some linking errors, concerning incremental building seem to be related to
this issue. (Templates are emitted into the wrong .o file)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 12 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9948


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com
            Version|unspecified                 |D1 & D2



13:59:37 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2550 may be relevant to
this.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 12 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9948




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


fix Issue 9948 - -deps dependency printing incorrect for templates

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 13 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9948




23:22:08 PDT ---
Fixed for D2.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 13 2013