https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116177
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by David Malcolm <dmalc...@gcc.gnu.org>: https://gcc.gnu.org/g:77f36e8016e11c051aa8264f3c43ab2c27aece55 commit r15-2769-g77f36e8016e11c051aa8264f3c43ab2c27aece55 Author: David Malcolm <dmalc...@redhat.com> Date: Tue Aug 6 18:24:45 2024 -0400 diagnostics: SARIF output: fix "executionSuccessful" §3.20.14 [PR116177] Previously the invocation's "executionSuccessful" property (§3.20.14) was only false if there was an ICE. Update it so that it will also be false if we will exit with a non-zero exit code (due to errors, Werror, and "sorry"). gcc/ChangeLog: PR other/116177 * diagnostic-format-sarif.cc (sarif_invocation::prepare_to_flush): If the diagnostics would lead to us exiting with a failure code, then emit "executionSuccessful": False (SARIF v2.1.0 section §3.20.14). * diagnostic.cc (diagnostic_context::execution_failed_p): New. * diagnostic.h (diagnostic_context::execution_failed_p): New decl. * toplev.cc (toplev::main): Use it for determining returned value. gcc/testsuite/ChangeLog: PR other/116177 * gcc.dg/sarif-output/include-chain-2.c: Remove pruning of "exit status is 1", as we expect this to exit with 0. * gcc.dg/sarif-output/no-diagnostics.c: New test. * gcc.dg/sarif-output/test-include-chain-1.py (test_execution_unsuccessful): Add. * gcc.dg/sarif-output/test-include-chain-2.py (test_execution_successful): Add. * gcc.dg/sarif-output/test-missing-semicolon.py (test_execution_unsuccessful): Add. * gcc.dg/sarif-output/test-no-diagnostics.py: New test. * gcc.dg/sarif-output/test-werror.py: New test. * gcc.dg/sarif-output/werror.c: New test. Signed-off-by: David Malcolm <dmalc...@redhat.com>