aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/errfn.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/errfn.c')
-rw-r--r--gcc/cp/errfn.c132
1 files changed, 100 insertions, 32 deletions
diff --git a/gcc/cp/errfn.c b/gcc/cp/errfn.c
index a43bcf3f0e1..7d6e66dffac 100644
--- a/gcc/cp/errfn.c
+++ b/gcc/cp/errfn.c
@@ -1,5 +1,5 @@
/* Provide a call-back mechanism for handling error output.
- Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1993, 94-98, 1999 Free Software Foundation, Inc.
Contributed by Jason Merrill (jason@cygnus.com)
This file is part of GNU CC.
@@ -22,6 +22,7 @@ Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
#include "tree.h"
+#include "cp-tree.h"
#include "toplev.h"
/* cp_printer is the type of a function which converts an argument into
@@ -39,6 +40,7 @@ int cp_silent = 0;
typedef void errorfn (); /* deliberately vague */
+static void cp_thing PROTO ((errorfn *, int, const char *, va_list));
extern char* cp_file_of PROTO((tree));
extern int cp_line_of PROTO((tree));
@@ -47,17 +49,12 @@ extern int cp_line_of PROTO((tree));
/* This function supports only `%s', `%d', `%%', and the C++ print
codes. */
-#ifdef __STDC__
-static void
-cp_thing (errorfn *errfn, int atarg1, const char *format, va_list ap)
-#else
static void
cp_thing (errfn, atarg1, format, ap)
errorfn *errfn;
int atarg1;
const char *format;
va_list ap;
-#endif
{
static char *buf;
static long buflen;
@@ -194,81 +191,152 @@ cp_thing (errfn, atarg1, format, ap)
}
-#ifdef __STDC__
-#define DECLARE(name) void name (const char *format, ...)
-#define INIT va_start (ap, format)
-#else
-#define DECLARE(name) void name (format, va_alist) char *format; va_dcl
-#define INIT va_start (ap)
-#endif
-
-DECLARE (cp_error)
+void
+cp_error VPROTO((const char *format, ...))
{
+#ifndef ANSI_PROTOTYPES
+ char *format;
+#endif
va_list ap;
- INIT;
+
+ VA_START (ap, format);
+
+#ifndef ANSI_PROTOTYPES
+ format = va_arg (ap, char *);
+#endif
+
if (! cp_silent)
cp_thing ((errorfn *) error, 0, format, ap);
va_end (ap);
}
-DECLARE (cp_warning)
+void
+cp_warning VPROTO((const char *format, ...))
{
+#ifndef ANSI_PROTOTYPES
+ char *format;
+#endif
va_list ap;
- INIT;
+
+ VA_START (ap, format);
+
+#ifndef ANSI_PROTOTYPES
+ format = va_arg (ap, char *);
+#endif
+
if (! cp_silent)
cp_thing ((errorfn *) warning, 0, format, ap);
va_end (ap);
}
-DECLARE (cp_pedwarn)
+void
+cp_pedwarn VPROTO((const char *format, ...))
{
+#ifndef ANSI_PROTOTYPES
+ char *format;
+#endif
va_list ap;
- INIT;
+
+ VA_START (ap, format);
+
+#ifndef ANSI_PROTOTYPES
+ format = va_arg (ap, char *);
+#endif
+
if (! cp_silent)
cp_thing ((errorfn *) pedwarn, 0, format, ap);
va_end (ap);
}
-DECLARE (cp_compiler_error)
+void
+cp_compiler_error VPROTO((const char *format, ...))
{
- extern errorfn compiler_error;
+#ifndef ANSI_PROTOTYPES
+ char *format;
+#endif
va_list ap;
- INIT;
+
+ VA_START (ap, format);
+
+#ifndef ANSI_PROTOTYPES
+ format = va_arg (ap, char *);
+#endif
+
if (! cp_silent)
- cp_thing (compiler_error, 0, format, ap);
+ cp_thing ((errorfn *) compiler_error, 0, format, ap);
va_end (ap);
}
-DECLARE (cp_sprintf)
+void
+cp_sprintf VPROTO((const char *format, ...))
{
+#ifndef ANSI_PROTOTYPES
+ char *format;
+#endif
va_list ap;
- INIT;
+
+ VA_START (ap, format);
+
+#ifndef ANSI_PROTOTYPES
+ format = va_arg (ap, char *);
+#endif
+
cp_thing ((errorfn *) sprintf, 0, format, ap);
va_end (ap);
}
-DECLARE (cp_error_at)
+void
+cp_error_at VPROTO((const char *format, ...))
{
+#ifndef ANSI_PROTOTYPES
+ char *format;
+#endif
va_list ap;
- INIT;
+
+ VA_START (ap, format);
+
+#ifndef ANSI_PROTOTYPES
+ format = va_arg (ap, char *);
+#endif
+
if (! cp_silent)
cp_thing ((errorfn *) error_with_file_and_line, 1, format, ap);
va_end (ap);
}
-DECLARE (cp_warning_at)
+void
+cp_warning_at VPROTO((const char *format, ...))
{
+#ifndef ANSI_PROTOTYPES
+ char *format;
+#endif
va_list ap;
- INIT;
+
+ VA_START (ap, format);
+
+#ifndef ANSI_PROTOTYPES
+ format = va_arg (ap, char *);
+#endif
+
if (! cp_silent)
cp_thing ((errorfn *) warning_with_file_and_line, 1, format, ap);
va_end (ap);
}
-DECLARE (cp_pedwarn_at)
+void
+cp_pedwarn_at VPROTO((const char *format, ...))
{
+#ifndef ANSI_PROTOTYPES
+ char *format;
+#endif
va_list ap;
- INIT;
+
+ VA_START (ap, format);
+
+#ifndef ANSI_PROTOTYPES
+ format = va_arg (ap, char *);
+#endif
+
if (! cp_silent)
cp_thing ((errorfn *) pedwarn_with_file_and_line, 1, format, ap);
va_end (ap);