diff options
author | David Malcolm <dmalcolm@redhat.com> | 2016-08-18 19:12:54 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2016-08-18 19:12:54 +0000 |
commit | cc015f3abebcfe84c64a38d1198ad4601e36893c (patch) | |
tree | a7f2af441e7947ebe123aaf89cf1d965ee9c7728 /gcc/fortran | |
parent | cb18fd07f2962779c2651adc970541210d4ad98f (diff) | |
download | gcc-cc015f3abebcfe84c64a38d1198ad4601e36893c.zip gcc-cc015f3abebcfe84c64a38d1198ad4601e36893c.tar.gz gcc-cc015f3abebcfe84c64a38d1198ad4601e36893c.tar.bz2 |
Allow calling diagnostic_show_locus without a diagnostic_info
Much of diagnostic-show-locus.c currently expects a diagnostic_info *,
but it only uses the rich_location and the diagnostic_t.
Change the signature of diagnostic_show_locus from:
void
diagnostic_show_locus (diagnostic_context *,
const diagnostic_info *);
to:
void
diagnostic_show_locus (diagnostic_context *,
rich_location *richloc,
diagnostic_t diagnostic_kind);
so that it can be used for things other than diagnostics.
Use this flexibility to add selftests for diagnostic_show_locus.
gcc/c-family/ChangeLog:
* c-opts.c (c_diagnostic_finalizer): Update for change to
diagnostic_show_locus.
gcc/ChangeLog:
* diagnostic-show-locus.c (colorizer::colorizer): Replace diagnostic
param with diagnostic_kind.
(class colorizer): Similarly replace field m_diagnostic with
m_diagnostic_kind.
(colorizer::colorizer): Replace diagnostic
param with diagnostic_kind.
(colorizer::begin_state): Update for above field change.
(layout::layout): Replace diagnostic param with rich_location *
and diagnostic_kind.
(diagnostic_show_locus): Replace diagnostic param with richloc
and diagnostic_kind.
(class selftest::test_diagnostic_context): New class.
(selftest::test_diagnostic_show_locus_unknown_location): New
function.
(selftest::test_one_liner_simple_caret): New function.
(selftest::test_one_liner_caret_and_range): New function.
(selftest::test_one_liner_multiple_carets_and_ranges): New
function.
(selftest::test_one_liner_fixit_remove): New function.
(selftest::test_one_liner_fixit_replace): New function.
(selftest::test_diagnostic_show_locus_one_liner): New function.
(selftest::diagnostic_show_locus_c_tests): Call the new test
functions.
* diagnostic.c (diagnostic_initialize): Initialize
colorize_source_p, show_ruler_p and parseable_fixits_p.
(default_diagnostic_finalizer): Update for change to
diagnostic_show_locus.
(diagnostic_append_note): Likewise.
* diagnostic.h (diagnostic_show_locus): Replace
const diagnostic_info * param with location * and diagnostic_t.
gcc/fortran/ChangeLog:
* error.c (gfc_diagnostic_starter): Update for change to
diagnostic_show_locus.
gcc/testsuite/ChangeLog:
* gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
(custom_diagnostic_finalizer): Update for change to
diagnostic_show_locus.
From-SVN: r239586
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fortran/error.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 53c1704..4d1c2ad 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2016-08-18 David Malcolm <dmalcolm@redhat.com> + + * error.c (gfc_diagnostic_starter): Update for change to + diagnostic_show_locus. + 2016-08-17 Jakub Jelinek <jakub@redhat.com> PR fortran/67496 diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c index acba1c8..fe91419 100644 --- a/gcc/fortran/error.c +++ b/gcc/fortran/error.c @@ -1093,7 +1093,7 @@ gfc_diagnostic_starter (diagnostic_context *context, free (locus_prefix); /* Fortran uses an empty line between locus and caret line. */ pp_newline (context->printer); - diagnostic_show_locus (context, diagnostic); + diagnostic_show_locus (context, diagnostic->richloc, diagnostic->kind); /* If the caret line was shown, the prefix does not contain the locus. */ pp_set_prefix (context->printer, kind_prefix); |