OSDN Git Service

92th Cygnus<->FSF quick merge
[pf3gnuchains/gcc-fork.git] / gcc / cp / errfn.c
index 335a304..b5ab8f7 100644 (file)
@@ -1,5 +1,5 @@
 /* Provide a call-back mechanism for handling error output.
-   Copyright (C) 1993 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
    Contributed by Jason Merrill (jason@cygnus.com)
 
    This file is part of GNU CC.
@@ -16,10 +16,12 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+the Free Software Foundation, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
    
 #include "config.h"
 #include "tree.h"
+#include <stdio.h>
 #include <ctype.h>
 
 /* cp_printer is the type of a function which converts an argument into
@@ -30,6 +32,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 typedef char* cp_printer PROTO((HOST_WIDE_INT, int));
 extern cp_printer * cp_printers[256];
 
+/* Whether or not we should try to be quiet for errors and warnings; this is
+   used to avoid being too talkative about problems with tentative choices
+   when we're computing the conversion costs for a method call.  */
+int cp_silent = 0;
+
 typedef void errorfn ();       /* deliberately vague */
 
 extern char* cp_file_of PROTO((tree));
@@ -37,11 +44,12 @@ extern int   cp_line_of PROTO((tree));
 
 #define STRDUP(f) (ap = (char *) alloca (strlen (f) +1), strcpy (ap, (f)), ap)
 
-#define NARGS 3
-#define arglist a1, a2, a3
-#define arglist_dcl HOST_WIDE_INT a1, a2, a3;
-#define ARGSINIT args[0] = a1; args[1] = a2; args[2] = a3;
-#define ARGSLIST args[0], args[1], args[2]
+#define NARGS 5
+#define arglist a1, a2, a3, a4, a5
+#define arglist_dcl HOST_WIDE_INT a1, a2, a3, a4, a5;
+#define ARGSINIT \
+  args[0] = a1; args[1] = a2; args[2] = a3; args[3] = a4; args[4] = a5;
+#define ARGSLIST args[0], args[1], args[2], args[3], args[4]
 
 static void
 cp_thing (errfn, atarg1, format, arglist)
@@ -112,7 +120,7 @@ cp_thing (errfn, atarg1, format, arglist)
       if (*f == 'l')
        ++f;
 
-      function = cp_printers[*f];
+      function = cp_printers[(int)*f];
 
       if (function)
        {
@@ -120,7 +128,7 @@ cp_thing (errfn, atarg1, format, arglist)
 
          if (arg >= NARGS) abort ();
          
-         if (maybe_here && atarg)
+         if (maybe_here && atarg1)
            atarg = args[arg];
 
          /* Must use a temporary to avoid calling *function twice */
@@ -150,7 +158,8 @@ cp_error (format, arglist)
      arglist_dcl
 {
   extern errorfn error;
-  cp_thing (error, 0, format, arglist);
+  if (! cp_silent)
+    cp_thing (error, 0, format, arglist);
 }
 
 void
@@ -159,7 +168,8 @@ cp_warning (format, arglist)
      arglist_dcl
 {
   extern errorfn warning;
-  cp_thing (warning, 0, format, arglist);
+  if (! cp_silent)
+    cp_thing (warning, 0, format, arglist);
 }
 
 void
@@ -168,7 +178,8 @@ cp_pedwarn (format, arglist)
      arglist_dcl
 {
   extern errorfn pedwarn;
-  cp_thing (pedwarn, 0, format, arglist);
+  if (! cp_silent)
+    cp_thing (pedwarn, 0, format, arglist);
 }
 
 void
@@ -177,7 +188,8 @@ cp_compiler_error (format, arglist)
      arglist_dcl
 {
   extern errorfn compiler_error;
-  cp_thing (compiler_error, 0, format, arglist);
+  if (! cp_silent)
+    cp_thing (compiler_error, 0, format, arglist);
 }
 
 void
@@ -185,8 +197,7 @@ cp_sprintf (format, arglist)
      char *format;
      arglist_dcl
 {
-  extern errorfn sprintf;
-  cp_thing (sprintf, 0, format, arglist);
+  cp_thing ((errorfn *) sprintf, 0, format, arglist);
 }
 
 void
@@ -195,7 +206,8 @@ cp_error_at (format, arglist)
      arglist_dcl
 {
   extern errorfn error_with_file_and_line;
-  cp_thing (error_with_file_and_line, 1, format, arglist);
+  if (! cp_silent)
+    cp_thing (error_with_file_and_line, 1, format, arglist);
 }
 
 void
@@ -204,7 +216,8 @@ cp_warning_at (format, arglist)
      arglist_dcl
 {
   extern errorfn warning_with_file_and_line;
-  cp_thing (warning_with_file_and_line, 1, format, arglist);
+  if (! cp_silent)
+    cp_thing (warning_with_file_and_line, 1, format, arglist);
 }
 
 void
@@ -213,5 +226,6 @@ cp_pedwarn_at (format, arglist)
      arglist_dcl
 {
   extern errorfn pedwarn_with_file_and_line;
-  cp_thing (pedwarn_with_file_and_line, 1, format, arglist);
+  if (! cp_silent)
+    cp_thing (pedwarn_with_file_and_line, 1, format, arglist);
 }