www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20742] New: dmd -X (JSON output) includes uncompiled symbols

https://issues.dlang.org/show_bug.cgi?id=20742

          Issue ID: 20742
           Summary: dmd -X (JSON output) includes uncompiled symbols
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: ddoc, json
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: schveiguy yahoo.com

--- a.d
version(Showme) private struct X {}
version(none) struct Y {}
---

dmd -X -c a.d
cat a.json

[
 {
  "kind" : "module",
  "file" : "a.d",
  "members" : [
   {
    "name" : "X",
    "kind" : "struct",
    "line" : 1,
    "char" : 25,
    "members" : []
   },
   {
    "name" : "Y",
    "kind" : "struct",
    "line" : 2,
    "char" : 15,
    "members" : []
   }
  ]
 }
]

-----

dmd -c -X -version=Showme a.d

cat a.json
[
 {
  "kind" : "module",
  "file" : "a.d",
  "members" : [
   {
    "name" : "X",
    "kind" : "struct",
    "protection" : "private",
    "line" : 1,
    "char" : 25,
    "members" : []
   },
   {
    "name" : "X",
    "kind" : "struct",
    "protection" : "private",
    "line" : 1,
    "char" : 25,
    "members" : []
   },
   {
    "name" : "Y",
    "kind" : "struct",
    "line" : 2,
    "char" : 15,
    "members" : []
   }
  ]
 }
]
----

Note a few things here:

1. The "private" is not shown for X unless the struct is included, which makes
it doubly bad.
2. The when the version is selected, it comes out twice
3. There is no way to turn on version(none).

This is wreaking havoc with ddox-like tools that depend on the json file (yes,
versioned out documentation comes through too).

I don't know the regression version, but at least 2.077.1 does not do this.

--
Apr 16