On Mon, 2025-02-17 at 12:49 -0500, James K. Lowden wrote:
> On Sat, 15 Feb 2025 23:37:20 -0500
> David Malcolm <dmalc...@redhat.com> wrote:
> 
> > +const char *
> > +cobol_get_sarif_source_language(const char *)
> > +    {
> > +    return "cobol";
> > +    }
> > 
> > Out of curiosity, did you try the SARIF output?  This is a good
> > test
> > for whether you?re properly using the GCC diagnostics subsystem.
> 
> How do I do that?  I barely know the term; I have to look it up every
> time.  I don't find "sarif" anywhere in gcc.info or gccint.info.  

(caveat: SARIF is one of my particular interests and thus I'm biased
towards it; not a blocker for first release, but needs to eventually
work)

It's been in gcc.info since GCC 13, I believe (are you looking at the
generated gcc.info, or at one installed on the system from an earlier
release of gcc?).

In trunk, add
  -fdiagnostics-add-output=sarif,
to the command-line options.  With that, in addition to regular text
diagnostic output, you should get a .sarif file written out containing
the diagnostics (and other metadata) in machine-readable json form
(unless you've got code doing fprintf to stderr, that is, in which case
the resulting mixture might not be well-formed JSON, of course).

Alternatively:
  -fdiagnostics-format=sarif-stderr
will replace the regular textual output with the machine-readable
output.

Ideally all the diagnostics should show up in the machine-readable
form.

For reference, https://gcc.gnu.org/wiki/SARIF has for more info on
GCC's sarif support.

Hope this is helpful
Dave

Reply via email to