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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 16 20:39:48 UTC 2020


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 at puremagic.com
          Reporter: schveiguy at 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.

--


More information about the Digitalmars-d-bugs mailing list