On Fri, 2019-11-15 at 20:22 -0500, David Malcolm wrote:
> diagnostic_show_locus adds a newline before doing anything (including
> the do-nothing-else case).
>
> This patch removes this initial newline, adding it to all callers
> of diagnostic_show_locus instead.
>
> Doing so makes diagnostic_show_locus more flexible, allowing it to be
> used later in this patch kit when printing diagnostic paths.
>
> gcc/c-family/ChangeLog:
> * c-format.c (test_type_mismatch_range_labels): Remove initial
> newline from expected outputs.
> * c-opts.c (c_diagnostic_finalizer): Add pp_newline call before
> call to diagnostic_show_locus.
>
> gcc/ChangeLog:
> * diagnostic-show-locus.c (diagnostic_show_locus): Remove
> initial
> newline.
> (selftest::test_diagnostic_show_locus_unknown_location): Remove
> initial newline from expected output.
> (selftest::test_one_liner_simple_caret): Likewise.
> (selftest::test_one_liner_caret_and_range): Likewise.
> (selftest::test_one_liner_multiple_carets_and_ranges):
> Likewise.
> (selftest::test_one_liner_fixit_insert_before): Likewise.
> (selftest::test_one_liner_fixit_insert_after): Likewise.
> (selftest::test_one_liner_fixit_remove): Likewise.
> (selftest::test_one_liner_fixit_replace): Likewise.
> (selftest::test_one_liner_fixit_replace_non_equal_range):
> Likewise.
> (selftest::test_one_liner_fixit_replace_equal_secondary_range):
> Likewise.
> (selftest::test_one_liner_fixit_validation_adhoc_locations):
> Likewise.
> (selftest::test_one_liner_many_fixits_1): Likewise.
> (selftest::test_one_liner_many_fixits_2): Likewise.
> (selftest::test_one_liner_labels): Likewise.
> (selftest::test_add_location_if_nearby): Likewise.
> (selftest::test_diagnostic_show_locus_fixit_lines): Likewise.
> (selftest::test_overlapped_fixit_printing): Likewise.
> (selftest::test_overlapped_fixit_printing_2): Likewise.
> (selftest::test_fixit_insert_containing_newline): Likewise.
> (selftest::test_fixit_insert_containing_newline_2): Likewise.
> (selftest::test_fixit_replace_containing_newline): Likewise.
> (selftest::test_fixit_deletion_affecting_newline): Likewise.
> (selftest::test_line_numbers_multiline_range): Likewise.
> * diagnostic.c (default_diagnostic_finalizer): Add pp_newline
> call
> before call to diagnostic_show_locus.
> (diagnostic_append_note): Likewise.
>
> gcc/fortran/ChangeLog:
> * error.c (gfc_diagnostic_starter): Add pp_newline call
> before call to diagnostic_show_locus.
>
> gcc/testsuite/ChangeLog:
> * gcc.dg/plugin/diagnostic_plugin_test_show_locus.c
> (custom_diagnostic_finalizer): Add pp_newline call before call
> to
> diagnostic_show_locus.
OK
jeff
>