]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
line-map.h (enum lc_reason): Reformat comments.
authorNathan Sidwell <nathan@acm.org>
Mon, 9 Jul 2018 20:27:45 +0000 (20:27 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Mon, 9 Jul 2018 20:27:45 +0000 (20:27 +0000)
libcpp/
* include/line-map.h (enum lc_reason): Reformat comments.
gcc/
* diagnostic.c (diagnostic_report_current_module): Reroll loop.
use array for prefix strings.

From-SVN: r262521

ChangeLog.name-lookup
gcc/diagnostic.c
libcpp/include/line-map.h

index 6b06b0e69f607de5ff362e624976b2bb83d89a53..96534395e4f55decbf6ff4944c58a2dc2a55ea21 100644 (file)
@@ -1,5 +1,11 @@
 2018-07-09  Nathan Sidwell  <nathan@acm.org>
 
+       libcpp/
+       * include/line-map.h (enum lc_reason): Reformat comments.
+       gcc/
+       * diagnostic.c (diagnostic_report_current_module): Reroll loop.
+       use array for prefix strings.
+
        Default allocator
        libcpp/
        * include/line-map.h (line_maps): Document default allocator.
index e22c17bc02cf8b105416eea60981d5b9e4f77f7c..3f118987b47664ae2db1481b2f7eff51053c1a39 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
+                                        ? LAST_SOURCE_COLUMN (map) : 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);
        }
index 80c3a1b5b1e5aba2575d5f8ed0bf3071714a7aaa..82ee5979de0059df6c590274d035ca6e23cf851a 100644 (file)
@@ -61,22 +61,16 @@ inline int compare (linenum_type lhs, linenum_type rhs)
   return 0;
 }
 
-/* Reason for creating a new line map with linemap_add.  LC_ENTER is
-   when including a new file, e.g. a #include directive in C.
-   LC_LEAVE is when reaching a file's end.  LC_RENAME is when a file
-   name or line number changes for neither of the above reasons
-   (e.g. a #line directive in C); LC_RENAME_VERBATIM is like LC_RENAME
-   but a filename of "" is not specially interpreted as standard
-   input. LC_ENTER_MACRO is when a macro expansion is about to start.  */
+/* Reason for creating a new line map with linemap_add.  */
 enum lc_reason
 {
-  LC_ENTER = 0,
-  LC_LEAVE,
-  LC_RENAME,
-  LC_RENAME_VERBATIM,
-  LC_ENTER_MACRO,
+  LC_ENTER = 0,                /* Begin #include.  */
+  LC_LEAVE,            /* Return to including file.  */
+  LC_RENAME,           /* Other reason for name change.  */
+  LC_RENAME_VERBATIM,  /* Likewise, but "" != stdin.  */
+  LC_ENTER_MACRO,      /* Begin macro expansion.  */
+  LC_HWM
   /* FIXME: add support for stringize and paste.  */
-  LC_HWM /* High Water Mark.  */
 };
 
 /* The typedef "source_location" is a key within the location database,