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

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by David Malcolm
<dmalc...@gcc.gnu.org>:

https://gcc.gnu.org/g:b7a2697733d19a093cbdd0e200ffce069a4bc812

commit r13-8761-gb7a2697733d19a093cbdd0e200ffce069a4bc812
Author: David Malcolm <dmalc...@redhat.com>
Date:   Thu May 9 13:09:33 2024 -0400

    diagnostics: fix corrupt json/SARIF on stderr [PR114348]

    Various values of -fdiagnostics-format= request machine-readable output
    on stderr, using JSON, but in various places we use fnotice to write
    free-form text to stderr, such as "compilation terminated", leading to
    corrupt JSON.

    Fix by having fnotice skip the output for such cases.

    Backported from r14-9554-g0bf99b1b7eda2f (using a variable rather
    than a vfunc of class diagnostic_output_format, since the latter
    was added in gcc 14)

    gcc/ChangeLog:
            PR middle-end/114348
            * diagnostic.cc (output_format): New variable.
            (fnotice): Bail out if the user requested one of the
            machine-readable diagnostic output formats on stderr.
            (diagnostic_output_format_init): Set output_format.

    Signed-off-by: David Malcolm <dmalc...@redhat.com>
  • [Bug middle-end/114348] Corrupt... cvs-commit at gcc dot gnu.org via Gcc-bugs

Reply via email to