https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107941

            Bug ID: 107941
           Summary: json diagnostics format does not include header stack
                    info
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: enhancement
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take t.c:
```
#include "t.h"
```
t.h:
```
int asdfg dsfg;
```

Without -fdiagnostics-format=json, we get:
In file included from t.c:1:
t.h:1:11: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘dsfg’
    1 | int asdfg dsfg;
      |           ^~~~

But with -fdiagnostics-format=json, there is no mention that the error came via
an include:
[{"kind": "error", "column-origin": 1, "children": [], "escape-source": false,
"locations": [{"finish": {"byte-column": 14, "display-column": 14, "line": 1,
"file": "t.h", "column": 14}, "caret": {"byte-column": 11, "display-column":
11, "line": 1, "file": "t.h", "column": 11}}], "message": "expected ‘=’, ‘,’,
‘;’, ‘asm’ or ‘__attribute__’ before ‘dsfg’"}]

I would have expected the include stack be included in the json file format.

Reply via email to