]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[PATCH] Diagnostic included-from loop
authorNathan Sidwell <nathan@acm.org>
Mon, 6 Aug 2018 16:52:38 +0000 (16:52 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Mon, 6 Aug 2018 16:52:38 +0000 (16:52 +0000)
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

gcc/ChangeLog
gcc/diagnostic.c

index b9a59d9e6b4b67fccc0d08424e858e13c27a550f..81a111652d9fe8ea70dc7f8291dcb40d2a334036 100644 (file)
@@ -1,3 +1,8 @@
+2018-08-06  Nathan Sidwell  <nathan@acm.org>
+
+       * diagnostic.c (diagnostic_report_current_module): Reroll
+       included-at loop.  Translate text.
+
 2018-08-06  David Malcolm  <dmalcolm@redhat.com>
 
        * function-tests.c (selftest::test_expansion_to_rtl): Call
index c61e0c4572ada0dcdb8da224ba2fdfeb349ce62e..5205944738a0e9ee8834d7d8a79ceebbfea3abb8 100644 (file)
@@ -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);
        }