From: Nathan Sidwell Date: Mon, 6 Aug 2018 16:52:38 +0000 (+0000) Subject: [PATCH] Diagnostic included-from loop X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9e525f085b65ffc07217a86935cf357e3154accf;p=gcc.git [PATCH] Diagnostic included-from loop https://gcc.gnu.org/ml/gcc-patches/2018-08/msg00416.html * diagnostic.c (diagnostic_report_current_module): Reroll included-at loop. Translate text. From-SVN: r263341 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b9a59d9e6b4..81a111652d9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-08-06 Nathan Sidwell + + * diagnostic.c (diagnostic_report_current_module): Reroll + included-at loop. Translate text. + 2018-08-06 David Malcolm * function-tests.c (selftest::test_expansion_to_rtl): Call diff --git a/gcc/diagnostic.c b/gcc/diagnostic.c index c61e0c4572a..5205944738a 100644 --- a/gcc/diagnostic.c +++ b/gcc/diagnostic.c @@ -587,22 +587,26 @@ diagnostic_report_current_module (diagnostic_context *context, location_t where) set_last_module (context, map); if (! MAIN_FILE_P (map)) { - map = INCLUDED_FROM (line_table, map); - const char *line_col - = maybe_line_and_column (LAST_SOURCE_LINE (map), - context->show_column - ? LAST_SOURCE_COLUMN (map) : 0); - pp_verbatim (context->printer, - "In file included from %r%s%s%R", "locus", - LINEMAP_FILE (map), line_col); - while (! MAIN_FILE_P (map)) + bool first = true; + do { map = INCLUDED_FROM (line_table, map); - line_col = maybe_line_and_column (LAST_SOURCE_LINE (map), 0); - pp_verbatim (context->printer, - ",\n from %r%s%s%R", "locus", - LINEMAP_FILE (map), line_col); + const char *line_col + = maybe_line_and_column (LAST_SOURCE_LINE (map), + first && context->show_column + ? SOURCE_COLUMN (map, where) : 0); + static const char *const msgs[] = + { + N_("In file included from"), + N_(" from"), + }; + unsigned index = !first; + pp_verbatim (context->printer, "%s%s %r%s%s%R", + first ? "" : ",\n", _(msgs[index]), + "locus", LINEMAP_FILE (map), line_col); + first = false; } + while (! MAIN_FILE_P (map)); pp_verbatim (context->printer, ":"); pp_newline (context->printer); }