1999-08-27 00:27 -0700 Zack Weinberg <zack@bitmover.com>
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 27 Aug 1999 07:47:17 +0000 (07:47 +0000)
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 27 Aug 1999 07:47:17 +0000 (07:47 +0000)
* errors.c: New file; defines functions error, warning, and
fatal, variables have_error and progname.
* errors.h: New file; prototypes and decls for stuff in errors.c.

* Makefile: Add rules to build errors.o and
$(HOST_PREFIX)errors.o.  Link genconfig, gencodes, genemit,
genopinit, genrecog, genextract, genpeep, genattr, and
genoutput with errors.o.  Add errors.h to deps of genconfig.o,
gencodes.o, genemit.o, genopinit.o, genrecog.o, genextract.o,
genpeep.o, genattr.o, and genoutput.o.

* genconfig.c, gencodes.c, genemit.c, genopinit.c, genrecog.c,
genextract.c, genpeep.c, genattr.c:  Include errors.h.  Don't
define or prototype fatal.  Set progname at beginning of main.
* genoutput.c:  Likewise, and don't define or prototype error
either.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@28925 138bc75d-0d04-0410-961f-82ee72b054a4

14 files changed:
gcc/Makefile.in
gcc/errors.c [new file with mode: 0644]
gcc/errors.h [new file with mode: 0644]
gcc/genattr.c
gcc/genattrtab.c
gcc/gencodes.c
gcc/genconfig.c
gcc/genemit.c
gcc/genextract.c
gcc/genflags.c
gcc/genopinit.c
gcc/genoutput.c
gcc/genpeep.c
gcc/genrecog.c

index 2fcffc2..7b6f100 100644 (file)
@@ -575,6 +575,7 @@ HOST_LIBS = $(USE_HOST_OBSTACK) $(USE_HOST_ALLOCA) $(USE_HOST_MALLOC)  \
 HOST_RTL = $(HOST_PREFIX)rtl.o $(HOST_PREFIX)bitmap.o
 HOST_RTLANAL = $(HOST_PREFIX)rtlanal.o
 HOST_PRINT = $(HOST_PREFIX)print-rtl.o
+HOST_ERRORS = $(HOST_PREFIX)errors.o
 
 # Specify the directories to be searched for header files.
 # Both . and srcdir are used, in that order,
@@ -1454,6 +1455,7 @@ rtl.o : rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h
 
 print-rtl.o : print-rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h basic-block.h
 rtlanal.o : rtlanal.c $(CONFIG_H) system.h $(RTL_H)
+errors.o : errors.c $(CONFIG_H) system.h errors.h
 
 varasm.o : varasm.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h \
    function.h defaults.h $(EXPR_H) hard-reg-set.h $(REGS_H) \
@@ -1760,81 +1762,81 @@ $(MD_FILE): $(MD_DEPS)
        $(MD_CPP) $(MD_CPPFLAGS) $(md_file) | sed 's/^# /; /g' > tmp-$@
        mv tmp-$@ $@
 
-genconfig : genconfig.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
+genconfig : genconfig.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
        $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
-         genconfig.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
+         genconfig.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
 
-genconfig.o : genconfig.c $(RTL_H) $(build_xm_file) system.h
+genconfig.o : genconfig.c $(RTL_H) $(build_xm_file) system.h errors.h
        $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genconfig.c
 
-genflags : genflags.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
+genflags : genflags.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
        $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
-        genflags.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
+        genflags.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
 
-genflags.o : genflags.c $(RTL_H) $(build_xm_file) system.h
+genflags.o : genflags.c $(RTL_H) $(build_xm_file) system.h errors.h
        $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genflags.c
 
-gencodes : gencodes.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
+gencodes : gencodes.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
        $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
-        gencodes.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
+        gencodes.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
 
-gencodes.o : gencodes.c $(RTL_H) $(build_xm_file) system.h
+gencodes.o : gencodes.c $(RTL_H) $(build_xm_file) system.h errors.h
        $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/gencodes.c
 
-genemit : genemit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
+genemit : genemit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
        $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
-        genemit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
+        genemit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
 
-genemit.o : genemit.c $(RTL_H) $(build_xm_file) system.h
+genemit.o : genemit.c $(RTL_H) $(build_xm_file) system.h errors.h
        $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genemit.c
 
-genopinit : genopinit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
+genopinit : genopinit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
        $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
-        genopinit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
+        genopinit.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
 
-genopinit.o : genopinit.c $(RTL_H) $(build_xm_file) system.h
+genopinit.o : genopinit.c $(RTL_H) $(build_xm_file) system.h errors.h
        $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genopinit.c
 
-genrecog : genrecog.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
+genrecog : genrecog.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
        $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
-        genrecog.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
+        genrecog.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
 
-genrecog.o : genrecog.c $(RTL_H) $(build_xm_file) system.h
+genrecog.o : genrecog.c $(RTL_H) $(build_xm_file) system.h errors.h
        $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genrecog.c
 
-genextract : genextract.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
+genextract : genextract.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
        $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
-        genextract.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
+        genextract.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
 
-genextract.o : genextract.c $(RTL_H) $(build_xm_file) system.h insn-config.h
+genextract.o : genextract.c $(RTL_H) $(build_xm_file) system.h insn-config.h errors.h
        $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genextract.c
 
-genpeep : genpeep.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
+genpeep : genpeep.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
        $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
-        genpeep.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
+        genpeep.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
 
-genpeep.o : genpeep.c $(RTL_H) $(build_xm_file) system.h
+genpeep.o : genpeep.c $(RTL_H) $(build_xm_file) system.h errors.h
        $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genpeep.c
 
-genattr : genattr.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
+genattr : genattr.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
        $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
-        genattr.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
+        genattr.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
 
-genattr.o : genattr.c $(RTL_H) $(build_xm_file) system.h
+genattr.o : genattr.c $(RTL_H) $(build_xm_file) system.h errors.h
        $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattr.c
 
-genattrtab : genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBDEPS)
+genattrtab : genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_RTLANAL) $(HOST_LIBDEPS)
        $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
-        genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL) $(HOST_LIBS)
+        genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_RTLANAL) $(HOST_LIBS)
 
-genattrtab.o : genattrtab.c $(RTL_H)  $(build_xm_file) system.h insn-config.h
+genattrtab.o : genattrtab.c $(RTL_H)  $(build_xm_file) system.h insn-config.h errors.h
        $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genattrtab.c
 
-genoutput : genoutput.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBDEPS)
+genoutput : genoutput.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBDEPS)
        $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ \
-        genoutput.o $(HOST_RTL) $(HOST_PRINT) $(HOST_LIBS)
+        genoutput.o $(HOST_RTL) $(HOST_PRINT) $(HOST_ERRORS) $(HOST_LIBS)
 
-genoutput.o : genoutput.c $(RTL_H) $(build_xm_file) system.h
+genoutput.o : genoutput.c $(RTL_H) $(build_xm_file) system.h errors.h
        $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(srcdir)/genoutput.c
 
 gengenrtl : gengenrtl.o $(HOST_LIBDEPS)
@@ -1896,6 +1898,12 @@ $(HOST_PREFIX_1)malloc.o: malloc.c
        sed -e 's/config[.]h/hconfig.h/' $(srcdir)/malloc.c > $(HOST_PREFIX)malloc.c
        $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)malloc.c
 
+$(HOST_PREFIX_1)errors.o: errors.c
+       rm -f $(HOST_PREFIX)errors.c
+       sed -e 's/config[.]h/hconfig.h/' $(srcdir)/errors.c > $(HOST_PREFIX)errors.c
+       $(HOST_CC) -c $(HOST_CFLAGS) $(HOST_CPPFLAGS) $(INCLUDES) $(HOST_PREFIX)errors.c
+
+
 # This satisfies the dependency that we get if you cross-compile a compiler
 # that does not need to compile alloca, malloc or whatever.
 $(HOST_PREFIX_1): 
diff --git a/gcc/errors.c b/gcc/errors.c
new file mode 100644 (file)
index 0000000..556e740
--- /dev/null
@@ -0,0 +1,106 @@
+/* Basic error reporting routines.
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+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, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+/* warning, error, and fatal.  These definitions are suitable for use
+   in the generator programs; eventually we would like to use them in
+   cc1 too, but that's a longer term project.  */
+
+#include "config.h"
+#include "system.h"
+#include "errors.h"
+
+/* Set this to argv[0] at the beginning of main.  */
+
+const char *progname;
+
+/* Starts out 0, set to 1 if error is called.  */
+
+int have_error = 0;
+
+/* Print a warning message - output produced, but there may be problems.  */
+
+void
+warning VPROTO ((const char *format, ...))
+{
+#ifndef ANSI_PROTOTYPES
+  const char *format;
+#endif
+  va_list ap;
+
+  VA_START (ap, format);
+
+#ifndef ANSI_PROTOTYPES
+  format = va_arg (ap, const char *);
+#endif
+
+  fprintf (stderr, "%s: warning: ", progname);
+  vfprintf (stderr, format, ap);
+  va_end (ap);
+  fputc('\n', stderr);
+}
+
+
+/* Print an error message - we keep going but the output is unusable.  */
+
+void
+error VPROTO ((const char *format, ...))
+{
+#ifndef ANSI_PROTOTYPES
+  const char *format;
+#endif
+  va_list ap;
+
+  VA_START (ap, format);
+
+#ifndef ANSI_PROTOTYPES
+  format = va_arg (ap, const char *);
+#endif
+
+  fprintf (stderr, "%s: ", progname);
+  vfprintf (stderr, format, ap);
+  va_end (ap);
+  fputc('\n', stderr);
+
+  have_error = 1;
+}
+
+
+/* Fatal error - terminate execution immediately.  Does not return.  */
+
+void
+fatal VPROTO ((const char *format, ...))
+{
+#ifndef ANSI_PROTOTYPES
+  const char *format;
+#endif
+  va_list ap;
+
+  VA_START (ap, format);
+
+#ifndef ANSI_PROTOTYPES
+  format = va_arg (ap, const char *);
+#endif
+
+  fprintf (stderr, "%s: ", progname);
+  vfprintf (stderr, format, ap);
+  va_end (ap);
+  fputc('\n', stderr);
+  exit (FATAL_EXIT_CODE);
+}
diff --git a/gcc/errors.h b/gcc/errors.h
new file mode 100644 (file)
index 0000000..cd9ebb1
--- /dev/null
@@ -0,0 +1,36 @@
+/* Basic error reporting routines.
+   Copyright (C) 1999 Free Software Foundation, Inc.
+
+This file is part of GNU CC.
+
+GNU CC is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU CC is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+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, 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+/* warning, error, and fatal.  These definitions are suitable for use
+   in the generator programs; eventually we would like to use them in
+   cc1 too, but that's a longer term project.  */
+
+#ifndef __GCC_ERRORS_H__
+#define __GCC_ERRORS_H__
+
+void warning PVPROTO ((const char *format, ...)) ATTRIBUTE_PRINTF_1;
+void error   PVPROTO ((const char *format, ...)) ATTRIBUTE_PRINTF_1;
+void fatal   PVPROTO ((const char *format, ...))
+    ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
+
+extern int have_error;
+extern const char *progname;
+    
+#endif
index cfa6c59..02e0be8 100644 (file)
@@ -24,6 +24,7 @@ Boston, MA 02111-1307, USA.  */
 #include "system.h"
 #include "rtl.h"
 #include "obstack.h"
+#include "errors.h"
 
 static struct obstack obstack;
 struct obstack *rtl_obstack = &obstack;
@@ -31,9 +32,6 @@ struct obstack *rtl_obstack = &obstack;
 #define obstack_chunk_alloc xmalloc
 #define obstack_chunk_free free
 
-void fatal PVPROTO ((const char *, ...))
-  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
-
 /* Define this so we can link with print-rtl.o to get debug_rtx function.  */
 char **insn_name_ptr = 0;
 
@@ -224,27 +222,6 @@ xrealloc (old, size)
   return ptr;
 }
 
-void
-fatal VPROTO ((const char *format, ...))
-{
-#ifndef ANSI_PROTOTYPES
-  const char *format;
-#endif
-  va_list ap;
-
-  VA_START (ap, format);
-
-#ifndef ANSI_PROTOTYPES
-  format = va_arg (ap, const char *);
-#endif
-
-  fprintf (stderr, "genattr: ");
-  vfprintf (stderr, format, ap);
-  va_end (ap);
-  fprintf (stderr, "\n");
-  exit (FATAL_EXIT_CODE);
-}
-
 int
 main (argc, argv)
      int argc;
@@ -268,6 +245,7 @@ main (argc, argv)
   init_range (&all_issue_delay);
   init_range (&all_blockage);
 
+  progname = "genattr";
   obstack_init (rtl_obstack);
 
   if (argc <= 1)
index 83b3780..4b36275 100644 (file)
@@ -107,6 +107,7 @@ Boston, MA 02111-1307, USA.  */
 /* We must include obstack.h after <sys/time.h>, to avoid lossage with
    /usr/include/sys/stdtypes.h on Sun OS 4.x.  */
 #include "obstack.h"
+#include "errors.h"
 
 static struct obstack obstack, obstack1, obstack2;
 struct obstack *rtl_obstack = &obstack;
@@ -119,9 +120,6 @@ struct obstack *temp_obstack = &obstack2;
 /* Define this so we can link with print-rtl.o to get debug_rtx function.  */
 char **insn_name_ptr = 0;
 
-void fatal PVPROTO ((const char *, ...))
-  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
-
 /* enough space to reserve for printing out ints */
 #define MAX_DIGITS (HOST_BITS_PER_INT * 3 / 10 + 3)
 
@@ -5906,27 +5904,6 @@ copy_rtx_unchanging (orig)
 #endif
 }
 
-void
-fatal VPROTO ((const char *format, ...))
-{
-#ifndef ANSI_PROTOTYPES
-  const char *format;
-#endif
-  va_list ap;
-
-  VA_START (ap, format);
-
-#ifndef ANSI_PROTOTYPES
-  format = va_arg (ap, const char *);
-#endif
-
-  fprintf (stderr, "genattrtab: ");
-  vfprintf (stderr, format, ap);
-  va_end (ap);
-  fprintf (stderr, "\n");
-  exit (FATAL_EXIT_CODE);
-}
-
 /* Determine if an insn has a constant number of delay slots, i.e., the
    number of delay slots is not a function of the length of the insn.  */
 
@@ -5990,6 +5967,7 @@ main (argc, argv)
   }
 #endif
 
+  progname = "genattrtab";
   obstack_init (rtl_obstack);
   obstack_init (hash_obstack);
   obstack_init (temp_obstack);
index 385dae1..1fa8700 100644 (file)
@@ -26,6 +26,7 @@ Boston, MA 02111-1307, USA.  */
 #include "system.h"
 #include "rtl.h"
 #include "obstack.h"
+#include "errors.h"
 
 static struct obstack obstack;
 struct obstack *rtl_obstack = &obstack;
@@ -33,9 +34,6 @@ struct obstack *rtl_obstack = &obstack;
 #define obstack_chunk_alloc xmalloc
 #define obstack_chunk_free free
 
-void fatal PVPROTO ((const char *, ...))
-  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
-
 /* Define this so we can link with print-rtl.o to get debug_rtx function.  */
 char **insn_name_ptr = 0;
 
@@ -81,27 +79,6 @@ xrealloc (old, size)
   return ptr;
 }
 
-void
-fatal VPROTO ((const char *format, ...))
-{
-#ifndef ANSI_PROTOTYPES
-  const char *format;
-#endif
-  va_list ap;
-
-  VA_START (ap, format);
-
-#ifndef ANSI_PROTOTYPES
-  format = va_arg (ap, const char *);
-#endif
-
-  fprintf (stderr, "gencodes: ");
-  vfprintf (stderr, format, ap);
-  va_end (ap);
-  fprintf (stderr, "\n");
-  exit (FATAL_EXIT_CODE);
-}
-
 int
 main (argc, argv)
      int argc;
@@ -111,6 +88,7 @@ main (argc, argv)
   FILE *infile;
   register int c;
 
+  progname = "gencodes";
   obstack_init (rtl_obstack);
 
   if (argc <= 1)
index 10bf89c..bbe707c 100644 (file)
@@ -24,6 +24,7 @@ Boston, MA 02111-1307, USA.  */
 #include "system.h"
 #include "rtl.h"
 #include "obstack.h"
+#include "errors.h"
 
 static struct obstack obstack;
 struct obstack *rtl_obstack = &obstack;
@@ -49,9 +50,6 @@ static int max_insns_per_split = 1;
 static int clobbers_seen_this_insn;
 static int dup_operands_seen_this_insn;
 
-void fatal PVPROTO ((const char *, ...))
-  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
-
 static void walk_insn_part PROTO((rtx, int, int));
 static void gen_insn PROTO((rtx));
 static void gen_expand PROTO((rtx));
@@ -270,27 +268,6 @@ xrealloc (old, size)
   return ptr;
 }
 
-void
-fatal VPROTO ((const char *format, ...))
-{
-#ifndef ANSI_PROTOTYPES
-  const char *format;
-#endif
-  va_list ap;
-
-  VA_START (ap, format);
-
-#ifndef ANSI_PROTOTYPES
-  format = va_arg (ap, const char *);
-#endif
-
-  fprintf (stderr, "genconfig: ");
-  vfprintf (stderr, format, ap);
-  va_end (ap);
-  fprintf (stderr, "\n");
-  exit (FATAL_EXIT_CODE);
-}
-
 int
 main (argc, argv)
      int argc;
@@ -300,6 +277,7 @@ main (argc, argv)
   FILE *infile;
   register int c;
 
+  progname = "genconfig";
   obstack_init (rtl_obstack);
 
   if (argc <= 1)
index 0443ea6..161aeff 100644 (file)
@@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA.  */
 #include "system.h"
 #include "rtl.h"
 #include "obstack.h"
+#include "errors.h"
 
 static struct obstack obstack;
 struct obstack *rtl_obstack = &obstack;
@@ -30,9 +31,6 @@ struct obstack *rtl_obstack = &obstack;
 #define obstack_chunk_alloc xmalloc
 #define obstack_chunk_free free
 
-void fatal PVPROTO ((const char *, ...))
-  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
-
 /* Define this so we can link with print-rtl.o to get debug_rtx function.  */
 char **insn_name_ptr = 0;
 
@@ -706,27 +704,6 @@ xrealloc (old, size)
   return ptr;
 }
 
-void
-fatal VPROTO ((const char *format, ...))
-{
-#ifndef ANSI_PROTOTYPES
-  const char *format;
-#endif
-  va_list ap;
-
-  VA_START (ap, format);
-
-#ifndef ANSI_PROTOTYPES
-  format = va_arg (ap, const char *);
-#endif
-
-  fprintf (stderr, "genemit: ");
-  vfprintf (stderr, format, ap);
-  va_end (ap);
-  fprintf (stderr, "\n");
-  exit (FATAL_EXIT_CODE);
-}
-
 int
 main (argc, argv)
      int argc;
@@ -736,6 +713,7 @@ main (argc, argv)
   FILE *infile;
   register int c;
 
+  progname = "genemit";
   obstack_init (rtl_obstack);
 
   if (argc <= 1)
index 174d56e..2f791a3 100644 (file)
@@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA.  */
 #include "system.h"
 #include "rtl.h"
 #include "obstack.h"
+#include "errors.h"
 #include "insn-config.h"
 
 static struct obstack obstack;
@@ -98,9 +99,7 @@ static struct code_ptr *peepholes;
 static void gen_insn PROTO ((rtx));
 static void walk_rtx PROTO ((rtx, const char *));
 static void print_path PROTO ((char *));
-void fatal PVPROTO ((const char *, ...))
-  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
-\f
+
 static void
 gen_insn (insn)
      rtx insn;
@@ -369,27 +368,6 @@ xrealloc (old, size)
   return ptr;
 }
 
-void
-fatal VPROTO ((const char *format, ...))
-{
-#ifndef ANSI_PROTOTYPES
-  const char *format;
-#endif
-  va_list ap;
-
-  VA_START (ap, format);
-
-#ifndef ANSI_PROTOTYPES
-  format = va_arg (ap, const char *);
-#endif
-
-  fprintf (stderr, "genextract: ");
-  vfprintf (stderr, format, ap);
-  va_end (ap);
-  fprintf (stderr, "\n");
-  exit (FATAL_EXIT_CODE);
-}
-
 char *
 xstrdup (input)
   const char *input;
@@ -411,6 +389,7 @@ main (argc, argv)
   struct extraction *p;
   struct code_ptr *link;
 
+  progname = "genextract";
   obstack_init (rtl_obstack);
 
   if (argc <= 1)
index 7d521a4..4602ea4 100644 (file)
@@ -26,6 +26,7 @@ Boston, MA 02111-1307, USA.  */
 #include "system.h"
 #include "rtl.h"
 #include "obstack.h"
+#include "errors.h"
 
 static struct obstack obstack;
 struct obstack *rtl_obstack = &obstack;
@@ -33,9 +34,6 @@ struct obstack *rtl_obstack = &obstack;
 #define obstack_chunk_alloc xmalloc
 #define obstack_chunk_free free
 
-void fatal PVPROTO ((const char *, ...))
-  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
-
 /* Names for patterns.  Need to allow linking with print-rtl.  */
 char **insn_name_ptr;
 
@@ -201,27 +199,6 @@ xrealloc (old, size)
   return ptr;
 }
 
-void
-fatal VPROTO ((const char *format, ...))
-{
-#ifndef ANSI_PROTOTYPES
-  const char *format;
-#endif
-  va_list ap;
-
-  VA_START (ap, format);
-
-#ifndef ANSI_PROTOTYPES
-  format = va_arg (ap, const char *);
-#endif
-
-  fprintf (stderr, "genflags: ");
-  vfprintf (stderr, format, ap);
-  va_end (ap);
-  fprintf (stderr, "\n");
-  exit (FATAL_EXIT_CODE);
-}
-
 int
 main (argc, argv)
      int argc;
@@ -235,6 +212,7 @@ main (argc, argv)
   FILE *infile;
   register int c;
 
+  progname = "genflags";
   obstack_init (rtl_obstack);
   obstack_init (&call_obstack);
   obstack_init (&normal_obstack);
index ef9f3c7..a68c27b 100644 (file)
@@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA.  */
 #include "system.h"
 #include "rtl.h"
 #include "obstack.h"
+#include "errors.h"
 
 static struct obstack obstack;
 struct obstack *rtl_obstack = &obstack;
@@ -30,9 +31,6 @@ struct obstack *rtl_obstack = &obstack;
 #define obstack_chunk_alloc xmalloc
 #define obstack_chunk_free free
 
-void fatal PVPROTO ((const char *, ...))
-  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
-
 /* Many parts of GCC use arrays that are indexed by machine mode and
    contain the insn codes for pattern in the MD file that perform a given
    operation on operands of that mode.
@@ -306,27 +304,6 @@ xrealloc (old, size)
   return ptr;
 }
 
-void
-fatal VPROTO ((const char *format, ...))
-{
-#ifndef ANSI_PROTOTYPES
-  const char *format;
-#endif
-  va_list ap;
-
-  VA_START (ap, format);
-
-#ifndef ANSI_PROTOTYPES
-  format = va_arg (ap, const char *);
-#endif
-
-  fprintf (stderr, "genopinit: ");
-  vfprintf (stderr, format, ap);
-  va_end (ap);
-  fprintf (stderr, "\n");
-  exit (FATAL_EXIT_CODE);
-}
-
 int
 main (argc, argv)
      int argc;
@@ -336,6 +313,7 @@ main (argc, argv)
   FILE *infile;
   register int c;
 
+  progname = "genopinit";
   obstack_init (rtl_obstack);
 
   if (argc <= 1)
index 095b67c..ecdc304 100644 (file)
@@ -94,6 +94,7 @@ given in the entry is a constant (it does not start with `*').  */
 #include "system.h"
 #include "rtl.h"
 #include "obstack.h"
+#include "errors.h"
 
 /* No instruction can have more operands than this.
    Sorry for this arbitrary limit, but what machine will
@@ -107,9 +108,6 @@ struct obstack *rtl_obstack = &obstack;
 #define obstack_chunk_alloc xmalloc
 #define obstack_chunk_free free
 
-void fatal PVPROTO ((const char *, ...))
-  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
-static void error PVPROTO ((const char *, ...)) ATTRIBUTE_PRINTF_1;
 static int n_occurrences PROTO((int, char *));
 
 /* Define this so we can link with print-rtl.o to get debug_rtx function.  */
@@ -931,49 +929,6 @@ xrealloc (old, size)
   return ptr;
 }
 
-void
-fatal VPROTO ((const char *format, ...))
-{
-#ifndef ANSI_PROTOTYPES
-  const char *format;
-#endif
-  va_list ap;
-
-  VA_START (ap, format);
-
-#ifndef ANSI_PROTOTYPES
-  format = va_arg (ap, const char *);
-#endif
-
-  fprintf (stderr, "genoutput: ");
-  vfprintf (stderr, format, ap);
-  va_end (ap);
-  fprintf (stderr, "\n");
-  exit (FATAL_EXIT_CODE);
-}
-
-static void
-error VPROTO ((const char *format, ...))
-{
-#ifndef ANSI_PROTOTYPES
-  const char *format;
-#endif
-  va_list ap;
-
-  VA_START (ap, format);
-
-#ifndef ANSI_PROTOTYPES
-  format = va_arg (ap, const char *);
-#endif
-
-  fprintf (stderr, "genoutput: ");
-  vfprintf (stderr, format, ap);
-  va_end (ap);
-  fprintf (stderr, "\n");
-
-  have_error = 1;
-}
-\f
 int
 main (argc, argv)
      int argc;
@@ -983,6 +938,7 @@ main (argc, argv)
   FILE *infile;
   register int c;
 
+  progname = "genoutput";
   obstack_init (rtl_obstack);
 
   if (argc <= 1)
index 7b02160..9b6c492 100644 (file)
@@ -23,6 +23,7 @@ Boston, MA 02111-1307, USA.  */
 #include "system.h"
 #include "rtl.h"
 #include "obstack.h"
+#include "errors.h"
 
 static struct obstack obstack;
 struct obstack *rtl_obstack = &obstack;
@@ -46,9 +47,6 @@ struct link
   int vecelt;
 };
 
-void fatal PVPROTO ((const char *, ...))
-  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
-
 static int max_opno;
 
 /* Number of operands used in current peephole definition.  */
@@ -409,27 +407,6 @@ xrealloc (old, size)
   return ptr;
 }
 
-void
-fatal VPROTO ((const char *format, ...))
-{
-#ifndef ANSI_PROTOTYPES
-  const char *format;
-#endif
-  va_list ap;
-
-  VA_START (ap, format);
-
-#ifndef ANSI_PROTOTYPES
-  format = va_arg (ap, const char *);
-#endif
-
-  fprintf (stderr, "genpeep: ");
-  vfprintf (stderr, format, ap);
-  va_end (ap);
-  fprintf (stderr, "\n");
-  exit (FATAL_EXIT_CODE);
-}
-
 int
 main (argc, argv)
      int argc;
@@ -441,6 +418,7 @@ main (argc, argv)
 
   max_opno = -1;
 
+  progname = "genpeep";
   obstack_init (rtl_obstack);
 
   if (argc <= 1)
index 748c2a1..d8bd74a 100644 (file)
@@ -50,6 +50,7 @@ Boston, MA 02111-1307, USA.  */
 #include "system.h"
 #include "rtl.h"
 #include "obstack.h"
+#include "errors.h"
 
 #define OUTPUT_LABEL(INDENT_STRING, LABEL_NUMBER) \
   printf("%sL%d: ATTRIBUTE_UNUSED_LABEL\n", (INDENT_STRING), (LABEL_NUMBER))
@@ -193,9 +194,7 @@ static void write_tree              PROTO((struct decision *, const char *,
                                       struct decision *, int,
                                       enum routine_type));
 static void change_state       PROTO((const char *, const char *, int));
-void fatal             PVPROTO((const char *, ...))
-  ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
-\f
+
 /* Construct and return a sequence of decisions
    that will recognize INSN.
 
@@ -1709,28 +1708,6 @@ xmalloc (size)
   return val;
 }
 
-void
-fatal VPROTO ((const char *format, ...))
-{
-#ifndef ANSI_PROTOTYPES
-  const char *format;
-#endif
-  va_list ap;
-
-  VA_START (ap, format);
-
-#ifndef ANSI_PROTOTYPES
-  format = va_arg (ap, const char *);
-#endif
-
-  fprintf (stderr, "genrecog: ");
-  vfprintf (stderr, format, ap);
-  va_end (ap);
-  fprintf (stderr, "\n");
-  fprintf (stderr, "after %d definitions\n", next_index);
-  exit (FATAL_EXIT_CODE);
-}
-
 int
 main (argc, argv)
      int argc;
@@ -1742,6 +1719,7 @@ main (argc, argv)
   FILE *infile;
   register int c;
 
+  progname = "genrecog";
   obstack_init (rtl_obstack);
   recog_tree.first = recog_tree.last = split_tree.first = split_tree.last = 0;