diff options
author | David Malcolm <dmalcolm@redhat.com> | 2018-11-15 14:32:41 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2018-11-15 14:32:41 +0000 |
commit | 478dd60ddcf17773ebd1af367c9dcaee2401f797 (patch) | |
tree | 9504f45599f1a9e4f54c7ffbbe41f73bc1c04e12 /gcc/jit | |
parent | ef190c93b07f04d61e28d70bb9a360fd2f3efbde (diff) | |
download | gcc-478dd60ddcf17773ebd1af367c9dcaee2401f797.zip gcc-478dd60ddcf17773ebd1af367c9dcaee2401f797.tar.gz gcc-478dd60ddcf17773ebd1af367c9dcaee2401f797.tar.bz2 |
Machine-readable diagnostic output (PR other/19165)
This patch implements a -fdiagnostics-format=json option which
converts the diagnostics to be output to stderr in a JSON format;
see the documentation in invoke.texi.
Logically-related diagnostics are nested at the JSON level, using
the auto_diagnostic_group mechanism.
gcc/ChangeLog:
PR other/19165
* Makefile.in (OBJS): Move json.o to...
(OBJS-libcommon): ...here and add diagnostic-format-json.o.
* common.opt (fdiagnostics-format=): New option.
(diagnostics_output_format): New enum.
* diagnostic-format-json.cc: New file.
* diagnostic.c (default_diagnostic_final_cb): New function, taken
from start of diagnostic_finish.
(diagnostic_initialize): Initialize final_cb to
default_diagnostic_final_cb.
(diagnostic_finish): Move "being treated as errors" messages to
default_diagnostic_final_cb. Call any final_cb.
(default_diagnostic_finalizer): Add diagnostic_t param.
(diagnostic_report_diagnostic): Pass "orig_diag_kind" to
diagnostic_finalizer callback.
* diagnostic.h (enum diagnostics_output_format): New enum.
(diagnostic_finalizer_fn): Reimplement, adding diagnostic_t param.
(struct diagnostic_context): Add "final_cb".
(default_diagnostic_finalizer): Add diagnostic_t param.
(diagnostic_output_format_init): New decl.
* doc/invoke.texi (-fdiagnostics-format): New option.
* dwarf2out.c (gen_producer_string): Ignore
OPT_fdiagnostics_format_.
* gcc.c (driver_handle_option): Handle OPT_fdiagnostics_format_.
* lto-wrapper.c (append_diag_options): Ignore it.
* opts.c (common_handle_option): Handle it.
gcc/c-family/ChangeLog:
PR other/19165
* c-opts.c (c_diagnostic_finalizer): Add diagnostic_t param.
gcc/fortran/ChangeLog:
PR other/19165
* error.c (gfc_diagnostic_finalizer): Add diagnostic_t param.
gcc/jit/ChangeLog:
PR other/19165
* dummy-frontend.c (jit_begin_diagnostic): Add diagnostic_t param.
gcc/testsuite/ChangeLog:
PR other/19165
* c-c++-common/diagnostic-format-json-1.c: New test.
* c-c++-common/diagnostic-format-json-2.c: New test.
* c-c++-common/diagnostic-format-json-3.c: New test.
* c-c++-common/diagnostic-format-json-4.c: New test.
* c-c++-common/diagnostic-format-json-5.c: New test.
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
(custom_diagnostic_finalizer): Add diagnostic_t param.
* gcc.dg/plugin/location_overflow_plugin.c
(verify_unpacked_ranges): Likewise.
(verify_no_columns): Likewise.
* gfortran.dg/diagnostic-format-json-1.F90: New test.
* gfortran.dg/diagnostic-format-json-2.F90: New test.
* gfortran.dg/diagnostic-format-json-3.F90: New test.
From-SVN: r266186
Diffstat (limited to 'gcc/jit')
-rw-r--r-- | gcc/jit/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/jit/dummy-frontend.c | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/jit/ChangeLog b/gcc/jit/ChangeLog index 8451fd5..4f8f737 100644 --- a/gcc/jit/ChangeLog +++ b/gcc/jit/ChangeLog @@ -1,3 +1,8 @@ +2018-11-15 David Malcolm <dmalcolm@redhat.com> + + PR other/19165 + * dummy-frontend.c (jit_begin_diagnostic): Add diagnostic_t param. + 2018-11-13 David Malcolm <dmalcolm@redhat.com> * jit-playback.c: Replace "source_location" with "location_t". diff --git a/gcc/jit/dummy-frontend.c b/gcc/jit/dummy-frontend.c index 4c7f960..ec91852 100644 --- a/gcc/jit/dummy-frontend.c +++ b/gcc/jit/dummy-frontend.c @@ -110,7 +110,8 @@ jit_begin_diagnostic (diagnostic_context */*context*/, static void jit_end_diagnostic (diagnostic_context *context, - diagnostic_info *diagnostic) + diagnostic_info *diagnostic, + diagnostic_t) { gcc_assert (gcc::jit::active_playback_ctxt); JIT_LOG_SCOPE (gcc::jit::active_playback_ctxt->get_logger ()); |