jit: gcc diagnostics are jit errors
commitf33a295a8c7b8d1ce655e9d6b2e81c42aaca51ce
authordmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 May 2016 19:28:47 +0000 (17 19:28 +0000)
committerdmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 17 May 2016 19:28:47 +0000 (17 19:28 +0000)
treeff6f37c704f22faac7eab9e79f10232646b62933
parent65951fdcba5fb3f703e5261b037a3cf49e05fd78
jit: gcc diagnostics are jit errors

libgccjit performs numerous checks at the API boundary, but
if these succeed, it ignores errors and other diagnostics emitted
within the core of gcc, and treats the compile of a gcc_jit_context
as having succeeded.

This patch ensures that if any diagnostics are emitted, they
are visible from the libgccjit API, and that the the context is
flagged as having failed.

For now any kind of diagnostic is treated as a jit error,
so warnings and notes also count as errors.

gcc/jit/ChangeLog:
* dummy-frontend.c: Include diagnostic.h.
(jit_begin_diagnostic): New function.
(jit_end_diagnostic): New function.
(jit_langhook_init): Register jit_begin_diagnostic
and jit_end_diagnostic with the global_dc.
* jit-playback.c: Include diagnostic.h.
(gcc::jit::playback::context::add_diagnostic): New method.
* jit-playback.h (struct diagnostic_context): Add forward
declaration.
(gcc::jit::playback::context::add_diagnostic): New method.

gcc/testsuite/ChangeLog:
* jit.dg/test-error-array-bounds.c: New test case.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@236342 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/jit/ChangeLog
gcc/jit/dummy-frontend.c
gcc/jit/jit-playback.c
gcc/jit/jit-playback.h
gcc/testsuite/ChangeLog
gcc/testsuite/jit.dg/test-error-array-bounds.c [new file with mode: 0644]