Skip to content
Snippets Groups Projects
Commit 77f36e80 authored by David Malcolm's avatar David Malcolm
Browse files

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: default avatarDavid Malcolm <dmalcolm@redhat.com>
parent a50916a6
No related branches found
No related tags found
Loading
Showing with 152 additions and 6 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment