What's the difference between DMD's `-preview` and `-transition`?

Seb seb at wilzba.ch
Tue Aug 20 07:09:56 UTC 2019


On Tuesday, 20 August 2019 at 05:33:44 UTC, Mike Franklin wrote:
> I'm planning a PR to fix 
> https://issues.dlang.org/show_bug.cgi?id=6952.
>
> The problem, as documented in issue report, is that DMD 
> currently prepends `-Xlinker` to any `-L` command-line 
> arguments (e.g `dmd -L-static` invokes gcc as `gcc -Xlinker 
> -static`).  This means that it is impossible to pass certain 
> gcc-specific arguments such as `-static`, `-nodefaultlibs`, 
> `-nostartfiles`, etc. directly to `gcc`. We need to be able to 
> invoke gcc as `gcc -static`, not `gcc -Xlinker - static`).
>
> By modifying the current behavior to no longer prepend 
> `-Xlinker` to `-L` command-line arguments, users will be able 
> pass arguments directly to gcc (e.g. `dmd -L-static`) or 
> simulate the current behavior by explicitly appending 
> `-Xlinker` themselves (e.g. `dmd -L-Xlinker -L-T=script.ld`).  
> Both classes of users will have what they need.
>
> Unfortunately, changing the current behavior could break build 
> scripts that rely on `-Xlinker` being prepended to any `-L` 
> command-line argument, so I need some way for users to opt-in 
> to the new behavior while allowing a path forward to, someday, 
> deprecate the current behavior.
>
> For the scenario described above, should I add a 
> `-preview=fixLinkerInvocation` or a 
> `-transition=fixLinkerInvocation` option?
>
> Thanks for the help.
>
> Mike


-preview: enable new features or deprecations

-transition: print _verbose_ debug info e.g. which code lines 
need to be fixed. Examples:
   - tls: list of all variables in TLS
   - vmarkdown: list of all instances of markdown replacement
   - field: list of all non-mutable fields in an object instance
...

tl;dr: go with -preview=fixLinkerInvocation


More information about the Digitalmars-d mailing list