2002-09-18 Andrew Cagney <ac131313@redhat.com>
[deliverable/binutils-gdb.git] / gdb / complaints.c
index ee877fbafaeb76cd7a529655faeb9fbb599d3001..04e49a2397990cdf03af4be9b901513f3bfd7d67 100644 (file)
@@ -1,5 +1,6 @@
 /* Support for complaint handling during symbol reading in GDB.
-   Copyright (C) 1990, 1991, 1992  Free Software Foundation, Inc.
+   Copyright 1990, 1991, 1992, 1993, 1995, 1998, 1999, 2000
+   Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -50,9 +51,6 @@ static unsigned int stop_whining = 0;
 
 static int complaint_series = 0;
 
-/* External variables and functions referenced. */
-
-extern int info_verbose;
 \f
 
 /* Functions to handle complaints during symbol reading.  */
@@ -83,30 +81,45 @@ complain (struct complaint *complaint,...)
 
       /* Isolated messages, must be self-explanatory.  */
     case 0:
-      begin_line ();
-      fputs_filtered ("During symbol reading, ", gdb_stderr);
-      wrap_here ("");
-      vfprintf_filtered (gdb_stderr, complaint->message, args);
-      fputs_filtered (".\n", gdb_stderr);
+      if (warning_hook)
+        (*warning_hook) (complaint->message, args);
+      else
+        {
+          begin_line ();
+          fputs_filtered ("During symbol reading, ", gdb_stderr);
+          wrap_here ("");
+          vfprintf_filtered (gdb_stderr, complaint->message, args);
+          fputs_filtered (".\n", gdb_stderr);
+        }
       break;
 
       /* First of a series, without `set verbose'.  */
     case 1:
-      begin_line ();
-      fputs_filtered ("During symbol reading...", gdb_stderr);
-      vfprintf_filtered (gdb_stderr, complaint->message, args);
-      fputs_filtered ("...", gdb_stderr);
-      wrap_here ("");
-      complaint_series++;
+      if (warning_hook)
+        (*warning_hook) (complaint->message, args);
+      else
+        {
+          begin_line ();
+          fputs_filtered ("During symbol reading...", gdb_stderr);
+          vfprintf_filtered (gdb_stderr, complaint->message, args);
+          fputs_filtered ("...", gdb_stderr);
+          wrap_here ("");
+          complaint_series++;
+        }
       break;
 
       /* Subsequent messages of a series, or messages under `set verbose'.
          (We'll already have produced a "Reading in symbols for XXX..."
          message and will clean up at the end with a newline.)  */
     default:
-      vfprintf_filtered (gdb_stderr, complaint->message, args);
-      fputs_filtered ("...", gdb_stderr);
-      wrap_here ("");
+      if (warning_hook)
+        (*warning_hook) (complaint->message, args);
+      else
+        {
+          vfprintf_filtered (gdb_stderr, complaint->message, args);
+          fputs_filtered ("...", gdb_stderr);
+          wrap_here ("");
+        }
     }
   /* If GDB dumps core, we'd like to see the complaints first.  Presumably
      GDB will not be sending so many complaints that this becomes a
@@ -124,9 +137,7 @@ complain (struct complaint *complaint,...)
    context for the user to figure it out.  */
 
 void
-clear_complaints (sym_reading, noisy)
-     int sym_reading;
-     int noisy;
+clear_complaints (int sym_reading, int noisy)
 {
   struct complaint *p;
 
@@ -135,7 +146,7 @@ clear_complaints (sym_reading, noisy)
       p->counter = 0;
     }
 
-  if (!sym_reading && !noisy && complaint_series > 1)
+  if (!sym_reading && !noisy && complaint_series > 1 && !warning_hook)
     {
       /* Terminate previous series, since caller won't.  */
       puts_filtered ("\n");
@@ -145,7 +156,7 @@ clear_complaints (sym_reading, noisy)
 }
 
 void
-_initialize_complaints ()
+_initialize_complaints (void)
 {
   add_show_from_set
     (add_set_cmd ("complaints", class_support, var_zinteger,
This page took 0.025834 seconds and 4 git commands to generate.