public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/107941] New: json diagnostics format does not include header stack info
@ 2022-11-30 20:47 pinskia at gcc dot gnu.org
  2022-11-30 20:48 ` [Bug middle-end/107941] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-30 20:47 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/107941] json diagnostics format does not include header stack info
  2022-11-30 20:47 [Bug middle-end/107941] New: json diagnostics format does not include header stack info pinskia at gcc dot gnu.org
@ 2022-11-30 20:48 ` pinskia at gcc dot gnu.org
  2022-12-01 14:33 ` marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-30 20:48 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=65448

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I should note I found this while looking into PR 65448 as suggesting using json
as an alternative form to parse by program and noticed that is missing (PR
65448 is requesting the include header stack to be easier parsable).

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/107941] json diagnostics format does not include header stack info
  2022-11-30 20:47 [Bug middle-end/107941] New: json diagnostics format does not include header stack info pinskia at gcc dot gnu.org
  2022-11-30 20:48 ` [Bug middle-end/107941] " pinskia at gcc dot gnu.org
@ 2022-12-01 14:33 ` marxin at gcc dot gnu.org
  2022-12-01 15:41 ` dmalcolm at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-12-01 14:33 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-12-01
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
                 CC|                            |dmalcolm at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/107941] json diagnostics format does not include header stack info
  2022-11-30 20:47 [Bug middle-end/107941] New: json diagnostics format does not include header stack info pinskia at gcc dot gnu.org
  2022-11-30 20:48 ` [Bug middle-end/107941] " pinskia at gcc dot gnu.org
  2022-12-01 14:33 ` marxin at gcc dot gnu.org
@ 2022-12-01 15:41 ` dmalcolm at gcc dot gnu.org
  2022-12-01 15:49 ` pinskia at gcc dot gnu.org
  2022-12-01 15:54 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2022-12-01 15:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Does the SARIF output format contain the information you need?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/107941] json diagnostics format does not include header stack info
  2022-11-30 20:47 [Bug middle-end/107941] New: json diagnostics format does not include header stack info pinskia at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-12-01 15:41 ` dmalcolm at gcc dot gnu.org
@ 2022-12-01 15:49 ` pinskia at gcc dot gnu.org
  2022-12-01 15:54 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-01 15:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to David Malcolm from comment #2)
> Does the SARIF output format contain the information you need?

No it does not:
{"$schema":
"https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json",
"runs": [{"results": [{"level": "error", "ruleId": "error", "locations":
[{"physicalLocation": {"contextRegion": {"startLine": 1, "snippet": {"text":
"int asdfg dsfg;\n"}}, "artifactLocation": {"uri": "t.h", "uriBaseId": "PWD"},
"region": {"startLine": 1, "endColumn": 15, "startColumn": 11}}}], "message":
{"text": "expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘dsfg’"}}],
"artifacts": [{"location": {"uri": "t.h", "uriBaseId": "PWD"},
"sourceLanguage": "c", "contents": {"text": "int asdfg dsfg;\n"}}], "tool":
{"driver": {"fullName": "GNU C17 (GCC) version 13.0.0 20221130 (experimental)
[master c382832afd5] (x86_64-pc-linux-gnu)", "name": "GNU C17", "rules": [],
"informationUri": "https://gcc.gnu.org/gcc-13/", "version": "13.0.0 20221130
(experimental) [master c382832afd5]"}}, "originalUriBaseIds": {"PWD": {"uri":
"file:///home/apinski/src/upstream-gcc/"}}}], "version": "2.1.0"}

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug middle-end/107941] json diagnostics format does not include header stack info
  2022-11-30 20:47 [Bug middle-end/107941] New: json diagnostics format does not include header stack info pinskia at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-12-01 15:49 ` pinskia at gcc dot gnu.org
@ 2022-12-01 15:54 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-01 15:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
diagnostic_report_current_module in diagnostic.cc is what outputs the include
stack for the text output case.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-12-01 15:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-30 20:47 [Bug middle-end/107941] New: json diagnostics format does not include header stack info pinskia at gcc dot gnu.org
2022-11-30 20:48 ` [Bug middle-end/107941] " pinskia at gcc dot gnu.org
2022-12-01 14:33 ` marxin at gcc dot gnu.org
2022-12-01 15:41 ` dmalcolm at gcc dot gnu.org
2022-12-01 15:49 ` pinskia at gcc dot gnu.org
2022-12-01 15:54 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).