dmd -v=json for machine readable output (and parsing dmd.conf)

Timothee Cour via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 20 19:08:14 PST 2017


Could we have a `dmd -v=json` ?

Related:

would be nice to also show (in json output) fields including dflags
and lflags to avoid having to do the work that the compiler already
did:

`dmd | grep 'Config file'`
Config file: path/to/etc/dmd.conf

followed py parsing the contents of `dmd.conf` which could look like this:

```
[Environment32]
DFLAGS=-I%@P%/../../src/phobos -I%@P%/../../src/druntime/import
-L-L%@P%/../lib32 -L--export-dynamic

[Environment64]
DFLAGS=-I%@P%/../../src/phobos -I%@P%/../../src/druntime/import
-L-L%@P%/../lib64 -L--export-dynamic -fPIC
```

and then selecting the appropriate environment, and interpretting the
@P, then parsing the corresponding entries into lflags and dflags.

This is a lot of work, it makes no sense not to expose it.


More information about the Digitalmars-d mailing list