Thread overview
[Issue 18271] `dmd -deps fun1.d fun2.d` produces very different results when order of source files changes
Jan 20, 2018
Timothee Cour
Jan 20, 2018
Timothee Cour
Jan 20, 2018
Jonathan Marler
January 20, 2018
https://issues.dlang.org/show_bug.cgi?id=18271

Timothee Cour <timothee.cour2@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timothee.cour2@gmail.com

--- Comment #1 from Timothee Cour <timothee.cour2@gmail.com> ---
likewise with -deps (instead of -deps=file)

--
January 20, 2018
https://issues.dlang.org/show_bug.cgi?id=18271

--- Comment #2 from Timothee Cour <timothee.cour2@gmail.com> ---
according to @marler8997 on https://github.com/dlang/tools/pull/291#issuecomment-359156301

> I think this may be by design. It only performs the full semantic analysis on modules imported by the first module given on the command line. I remember seeing the code do this and I thought it was odd but I assumed there was a reason for this.


> https://github.com/dlang/dmd/blob/f947c0881432988dcd8cd80d5abe71e4c0463867/src/dmd/mars.d#L822

> This is where the extra semantic analysis is done when the -deps flag is used. As you can see, only module[0].aimports is being scanned. This is either a bug or by design. If it's a bug, then the fix is likely to loop over Modules.modules instead of modules[0].aimports.


-----
* this is not documented in -deps (and also not in dmd changelog)
* what's a use case for doing it only on the 1st module?
here's a use case for doing it on all files passed on cmdline:

```
// main.d:
extern(C) void fun();
import other1;
void main(){fun();}

// mylib.d:
import other2;
extern(C) void fun(){}

// cmd line
dmd -deps main.d mylib.d
```

Would be nice to have as orthogonal features as possible;
could we have:
-i mean recurse on imports (while respecting -i=pattern)
-deps mean output dependencies (on whatever's being analyzed)

--
January 20, 2018
https://issues.dlang.org/show_bug.cgi?id=18271

Jonathan Marler <johnnymarler@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |johnnymarler@gmail.com

--- Comment #3 from Jonathan Marler <johnnymarler@gmail.com> ---
> Would be nice to have as orthogonal features as possible;
> could we have:
> -i mean recurse on imports (while respecting -i=pattern)
> -deps mean output dependencies (on whatever's being analyzed)

-i currently means, include imported modules into the compilation as if they were given on the command line.  this is orthogonal to "recurse on imports", so I'm confused why you would want to combine these?

--
December 13
https://issues.dlang.org/show_bug.cgi?id=18271

--- Comment #4 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/17833

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--