https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116632
Bug ID: 116632 Summary: d_diagnostic_report_diagnostic and non-textual diagnostic output formats (e.g. SARIF) Product: gcc Version: unknown Status: UNCONFIRMED Keywords: SARIF Severity: normal Priority: P3 Component: d Assignee: ibuclaw at gdcproject dot org Reporter: dmalcolm at gcc dot gnu.org Blocks: 116613 Target Milestone: --- I notice that d_diagnostic_report_diagnostic has: if (loc.filename () || !verbatim) { // Trimmed for quoting here, but uses diagnostic_report_diagnostic } else { /* Write verbatim messages with no location direct to stream. */ text_info text (expand_d_format (format), &argp, errno, nullptr); pp_format_verbatim (global_dc->printer, &text); pp_newline_and_flush (global_dc->printer); } What should that "else" clause do for non-textual output formats, such as SARIF? The output format code assumes all diagnostics goes through diagnostic_report_diagnostic. I have a feeling that they're going to go straight into the SARIF output as plain text, leading to malformed JSON. How do I trigger these, and what's the motivation/intent of the "else" clause here? Thanks! Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116613 [Bug 116613] RFE: support outputting diagnostics in *multiple* formats