diagnostic.c (diagnostic_build_prefix): If USE_MAPPED_LOCATION and we have a non...
authorPer Bothner <per@bothner.com>
Tue, 1 Mar 2005 16:37:45 +0000 (08:37 -0800)
committerPer Bothner <bothner@gcc.gnu.org>
Tue, 1 Mar 2005 16:37:45 +0000 (08:37 -0800)
* diagnostic.c (diagnostic_build_prefix): If USE_MAPPED_LOCATION
and we have a non-zero column-number, add it to the message.
Also factor out the diagnostic_kind_text.

From-SVN: r95746

gcc/ChangeLog
gcc/diagnostic.c

index 120114c173eb3187b6ee1070e282cb1da59df4ec..a28f1bf7c4045d1b552ff15060158840c20bb517 100644 (file)
@@ -1,3 +1,9 @@
+2005-03-01  Per Bothner  <per@bothner.com>
+
+       * diagnostic.c (diagnostic_build_prefix): If USE_MAPPED_LOCATION
+       and we have a non-zero column-number, add it to the message.
+       Also factor out the diagnostic_kind_text.
+
 2005-03-01  Zdenek Dvorak  <dvorakz@suse.cz>
 
        * cfgloop.c (flow_loop_entry_edges_find, flow_loop_exit_edges_find,
index b047167bc492086e752660a801384c5114af3e78..39b46fc7aefec49c4440b503961b0862a5f9955c 100644 (file)
@@ -133,15 +133,18 @@ diagnostic_build_prefix (diagnostic_info *diagnostic)
 #undef DEFINE_DIAGNOSTIC_KIND
     "must-not-happen"
   };
+  const char *text = _(diagnostic_kind_text[diagnostic->kind]);
   expanded_location s = expand_location (diagnostic->location);
   gcc_assert (diagnostic->kind < DK_LAST_DIAGNOSTIC_KIND);
 
-  return s.file
-    ? build_message_string ("%s:%d: %s",
-                            s.file, s.line,
-                            _(diagnostic_kind_text[diagnostic->kind]))
-    : build_message_string ("%s: %s", progname,
-                            _(diagnostic_kind_text[diagnostic->kind]));
+  return
+    (s.file == NULL
+     ? build_message_string ("%s: %s", progname, text)
+#ifdef USE_MAPPED_LOCATION
+     : s.column != 0
+     ? build_message_string ("%s:%d:%d: %s", s.file, s.line, s.column, text)
+#endif
+     : build_message_string ("%s:%d: %s", s.file, s.line, text));
 }
 
 /* Count a diagnostic.  Return true if the message should be printed.  */