www.digitalmars.com         C & C++   DMDScript  

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

reply Timothee Cour via Digitalmars-d <digitalmars-d puremagic.com> writes:
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.
Feb 20
parent Chris Wright <dhasenan gmail.com> writes:
On Mon, 20 Feb 2017 19:08:14 -0800, Timothee Cour via Digitalmars-d wrote:
 Could we have a `dmd -v=json` ?
Can you put together a sketch of what this would look like?
Feb 20