OSDN Git Service

* Makefile.in: Remove pointless setting of CXXFLAGS for dejagnu
[pf3gnuchains/gcc-fork.git] / gcc / diagnostic.c
index 89130cc..a192229 100644 (file)
@@ -27,6 +27,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #undef FLOAT /* This is for hpux. They should change hpux.  */
 #undef FFS  /* Some systems define this in param.h.  */
 #include "system.h"
+#include "coretypes.h"
+#include "tm.h"
 #include "tree.h"
 #include "tm_p.h"
 #include "flags.h"
@@ -37,14 +39,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "langhooks.h"
 #include "langhooks-def.h"
 
-#define output_formatted_integer(BUFFER, FORMAT, INTEGER)      \
-  do                                                           \
-    {                                                          \
-      sprintf ((BUFFER)->digit_buffer, FORMAT, INTEGER);       \
-      output_add_string (BUFFER, (BUFFER)->digit_buffer);      \
-    }                                                          \
-  while (0)
-
 #define output_text_length(BUFFER) (BUFFER)->line_length
 #define is_starting_newline(BUFFER) (output_text_length (BUFFER) == 0)
 #define line_wrap_cutoff(BUFFER) (BUFFER)->state.maximum_length
@@ -309,7 +303,7 @@ output_decimal (buffer, i)
      output_buffer *buffer;
      int i;
 {
-  output_formatted_integer (buffer, "%d", i);
+  output_formatted_scalar (buffer, "%d", i);
 }
 
 static void
@@ -317,7 +311,7 @@ output_long_decimal (buffer, i)
      output_buffer *buffer;
      long int i;
 {
-  output_formatted_integer (buffer, "%ld", i);
+  output_formatted_scalar (buffer, "%ld", i);
 }
 
 static void
@@ -325,7 +319,7 @@ output_unsigned_decimal (buffer, i)
      output_buffer *buffer;
      unsigned int i;
 {
-  output_formatted_integer (buffer, "%u", i);
+  output_formatted_scalar (buffer, "%u", i);
 }
 
 static void
@@ -333,7 +327,7 @@ output_long_unsigned_decimal (buffer, i)
      output_buffer *buffer;
      long unsigned int i;
 {
-  output_formatted_integer (buffer, "%lu", i);
+  output_formatted_scalar (buffer, "%lu", i);
 }
 
 static void
@@ -341,7 +335,7 @@ output_octal (buffer, i)
      output_buffer *buffer;
      unsigned int i;
 {
-  output_formatted_integer (buffer, "%o", i);
+  output_formatted_scalar (buffer, "%o", i);
 }
 
 static void
@@ -349,7 +343,7 @@ output_long_octal (buffer, i)
      output_buffer *buffer;
      unsigned long int i;
 {
-  output_formatted_integer (buffer, "%lo", i);
+  output_formatted_scalar (buffer, "%lo", i);
 }
 
 static void
@@ -357,7 +351,7 @@ output_hexadecimal (buffer, i)
      output_buffer *buffer;
      unsigned int i;
 {
-  output_formatted_integer (buffer, "%x", i);
+  output_formatted_scalar (buffer, "%x", i);
 }
 
 static void
@@ -365,7 +359,7 @@ output_long_hexadecimal (buffer, i)
      output_buffer *buffer;
      unsigned long int i;
 {
-  output_formatted_integer (buffer, "%lx", i);
+  output_formatted_scalar (buffer, "%lx", i);
 }
 
 /* Append to BUFFER a string specified by its STARTING character
@@ -471,6 +465,16 @@ output_add_string (buffer, str)
   maybe_wrap_text (buffer, str, str + (str ? strlen (str) : 0));
 }
 
+/* Append an identifier ID to BUFFER.  */
+void
+output_add_identifier (buffer, id)
+     output_buffer *buffer;
+     tree id;
+{
+  output_append (buffer, IDENTIFIER_POINTER (id),
+                IDENTIFIER_POINTER (id) + IDENTIFIER_LENGTH (id));
+}
+
 /* Flush the content of BUFFER onto the attached stream,
    and reinitialize.  */
 
@@ -640,7 +644,7 @@ build_message_string VPARAMS ((const char *msg, ...))
   return str;
 }
 
-/* Same as diagnsotic_build_prefix, but only the source FILE is given.  */
+/* Same as diagnostic_build_prefix, but only the source FILE is given.  */
 char *
 file_name_as_prefix (f)
      const char *f;
@@ -813,7 +817,7 @@ diagnostic_set_info (diagnostic, msgid, args, file, line, kind)
 {
   diagnostic->message.format_spec = msgid;
   diagnostic->message.args_ptr = args;
-  /* If the diagnostic message doesn't specify a loccation,
+  /* If the diagnostic message doesn't specify a location,
      use FILE and LINE.  */
   if (!text_specifies_location (&diagnostic->message, &diagnostic->location))
     {
@@ -1021,7 +1025,6 @@ sorry VPARAMS ((const char *msgid, ...))
 
   output_set_prefix
     (&global_dc->buffer, diagnostic_build_prefix (&diagnostic));
-  output_printf (&global_dc->buffer, "sorry, not implemented: ");
   output_format (&global_dc->buffer, &diagnostic.message);
   output_flush (&global_dc->buffer);
   VA_CLOSE (ap);
@@ -1192,7 +1195,7 @@ internal_error VPARAMS ((const char *msgid, ...))
   fnotice (stderr,
 "Please submit a full bug report,\n\
 with preprocessed source if appropriate.\n\
-See %s for instructions.\n", GCCBUGURL);
+See %s for instructions.\n", bug_report_url);
   exit (FATAL_EXIT_CODE);
 }
 
@@ -1300,7 +1303,7 @@ error_recursion (context)
   fnotice (stderr,
 "Please submit a full bug report,\n\
 with preprocessed source if appropriate.\n\
-See %s for instructions.\n", GCCBUGURL);
+See %s for instructions.\n", bug_report_url);
   exit (FATAL_EXIT_CODE);
 }
 
@@ -1358,8 +1361,7 @@ fancy_abort (file, line, function)
      int line;
      const char *function;
 {
-  internal_error ("Internal compiler error in %s, at %s:%d",
-                 function, trim_filename (file), line);
+  internal_error ("in %s, at %s:%d", function, trim_filename (file), line);
 }
 
 void
@@ -1407,6 +1409,20 @@ default_diagnostic_finalizer (context, diagnostic)
 }
 
 void
+inform VPARAMS ((const char *msgid, ...))
+{
+  diagnostic_info diagnostic;
+
+  VA_OPEN (ap, msgid);
+  VA_FIXEDARG (ap, const char *, msgid);
+
+  diagnostic_set_info (&diagnostic, msgid, &ap, input_filename, lineno,
+                       DK_NOTE);
+  report_diagnostic (&diagnostic);
+  VA_CLOSE (ap);
+}
+
+void
 warn_deprecated_use (node)
      tree node;
 {