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

--- Comment #13 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
I'm experimenting with a new

  -fdiagnostics-add-output=<output-format-specifier>

with this rough grammar:

  <output-format-specifier>: <output-format-name>
                             <output-format-name> ":" key_value_pairs

  <output-format-name>: "text"
                      : "sarif"
                      (and others could be added by GCC plugins)

  <key-value-pairs>: <key-value-pair>
                   : <key-value-pair> "," <key-value-pairs>

  <key-value-pair>: <key> "=" <value>

  <key>: string without a '='
  <value>: string without a ','

i.e. an output format name followed by zero or more comma-separated key=value
pairs.

Some examples:
 -fdiagnostics-add-output=text:color=yes
 -fdiagnostics-add-output=sarif:file={output-filename}.sarif

where e.g. {output-filename} would be substituted with the output filename from
the gcc invocation.

More complicated examples:

Specifiying the SARIF version (see bug 116301):
 -fdiagnostics-add-output=sarif:version=2.1,file={output-filename}.2.1.sarif

-fdiagnostics-add-output=sarif:version=2.2-prerelease,file={output-filename}.2.2.sarif

Supporting experiments with hierarchical diagnostics (see bug 116253):

 -fdiagnostics-add-output=text:experimental-hierarchical-diagnostics=yes

and so forth.

Thoughts?

Reply via email to