summaryrefslogtreecommitdiffstats
path: root/gcc/fix-header.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fix-header.c')
-rw-r--r--gcc/fix-header.c98
1 files changed, 78 insertions, 20 deletions
diff --git a/gcc/fix-header.c b/gcc/fix-header.c
index 74c251a48e0..8ba79ff6590 100644
--- a/gcc/fix-header.c
+++ b/gcc/fix-header.c
@@ -71,17 +71,19 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
Written by Per Bothner <bothner@cygnus.com>, July 1993. */
#include "hconfig.h"
+#ifdef __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
#include "system.h"
+#include "gansidecl.h"
#include "obstack.h"
#include "scan.h"
#include "cpplib.h"
-#include "gansidecl.h"
+#include "cpphash.h"
-extern void cpp_fatal ();
-
-#if !__STDC__ && !defined(const)
-#define const /* nothing */
-#endif
+void fatal PVPROTO ((const char *, ...)) ATTRIBUTE_PRINTF_1;
sstring buf;
@@ -1327,7 +1329,8 @@ main (argc, argv)
because we want to suppress error messages. */
void
-cpp_file_line_for_message (filename, line, column)
+cpp_file_line_for_message (pfile, filename, line, column)
+ cpp_reader * pfile;
char *filename;
int line, column;
{
@@ -1347,11 +1350,12 @@ cpp_print_containing_files (pfile)
/* IS_ERROR is 2 for fatal error, 1 for error, 0 for warning */
-void cpp_message (pfile, is_error, msg, arg1, arg2, arg3)
- int is_error;
+void
+v_cpp_message (pfile, is_error, msg, ap)
cpp_reader *pfile;
- char *msg;
- char *arg1, *arg2, *arg3;
+ int is_error;
+ const char *msg;
+ va_list ap;
{
if (is_error == 1)
pfile->errors++;
@@ -1361,32 +1365,86 @@ void cpp_message (pfile, is_error, msg, arg1, arg2, arg3)
return;
if (!is_error)
fprintf (stderr, "warning: ");
- fprintf (stderr, msg, arg1, arg2, arg3);
+ vfprintf (stderr, msg, ap);
fprintf (stderr, "\n");
}
void
-fatal (str, arg)
- char *str, *arg;
+cpp_message VPROTO ((cpp_reader *pfile, int is_error, const char *msg, ...))
+{
+#ifndef __STDC__
+ cpp_reader *pfile;
+ int is_error;
+ const char *msg;
+#endif
+ va_list ap;
+
+ VA_START (ap, msg);
+
+#ifndef __STDC__
+ pfile = va_arg (ap, cpp_reader *);
+ is_error = va_arg (ap, const int);
+ msg = va_arg (ap, const char *);
+#endif
+
+ v_cpp_message(pfile, is_error, msg, ap);
+ va_end(ap);
+}
+
+static void
+v_fatal (str, ap)
+ const char * str;
+ va_list ap;
{
fprintf (stderr, "%s: %s: ", progname, inc_filename);
- fprintf (stderr, str, arg);
+ vfprintf (stderr, str, ap);
fprintf (stderr, "\n");
+
exit (FATAL_EXIT_CODE);
}
void
-cpp_fatal (pfile, str, arg)
- cpp_reader *pfile ATTRIBUTE_UNUSED;
- char *str, *arg;
+fatal VPROTO ((const char *str, ...))
{
- fatal (str, arg);
+#ifndef __STDC__
+ const char *str;
+#endif
+ va_list ap;
+
+ VA_START(ap, str);
+
+#ifndef __STDC__
+ str = va_arg (ap, const char *);
+#endif
+
+ v_fatal(str, ap);
+ va_end(ap);
+}
+
+void
+cpp_fatal VPROTO ((cpp_reader * pfile, const char *str, ...))
+{
+#ifndef __STDC__
+ cpp_reader * pfile;
+ const char *str;
+#endif
+ va_list ap;
+
+ VA_START(ap, str);
+
+#ifndef __STDC__
+ pfile = va_arg (ap, cpp_reader *);
+ str = va_arg (ap, const char *);
+#endif
+
+ v_fatal(str, ap);
+ va_end(ap);
}
void
cpp_pfatal_with_name (pfile, name)
cpp_reader *pfile;
- char *name;
+ const char *name;
{
cpp_perror_with_name (pfile, name);
exit (FATAL_EXIT_CODE);
OpenPOWER on IntegriCloud