From 117115d04a7af610164600d6504f79bdaff36e40 Mon Sep 17 00:00:00 2001
From: nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Mon, 23 Aug 2004 11:57:02 +0000
Subject: [PATCH] 	* Makefile.in (BUILD_ERRORS): Set to build-errors. 
 (errors.o): New target for host. 	(build-errors.o): New target for
 build. 	(genobjs): Replace errors.o with build-errors. 
 (gengenrtl$(buildexeext)): Add $(BUILD_ERRORS). 	(GCOV_OBJS,
 GCOV_DUMP_OBJS): Add errors.o. 	(fix-headers$(build_exeext)): Add
 $(BUILD_ERRORS). 	(fix-header.o): Add errors.h 	* collect2.c
 (fancy_abort): Add parameters. 	* collect2.h (fancy_abort): Don't
 declare. 	* errors.h (fancy_abort): Don't declare. 	* errors.c:
 Include either bconfig.h or config.h. 	(fancy_abort): Trim filename. 	*
 fix-header.c (v_fatal, fatal): Remove. 	(progname): Remove definition.
 	(main): Set progname here. 	* gcc.c (fancy_abort): Add parameters.
 	* gcc.h (fancy_abort): Remove declaration. 	* gcov.c
 (fancy_abort): Remove. 	* rtl.h (fancy_abort): Don't declare. 
 (abort): Don't define. 	* tree.h (fancy_abort): Don't declare. 
 (abort): Don't define. 	* system.h (fancy_abort): Declare. 
 (abort): Define to fancy_abort. 	* fixinc/Makefile.in (ALLOBJ): Add
 ../build-errors.o 	* java/jv-scan.c (fancy_abort): Add.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86424 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog          | 29 ++++++++++++++++++++++++++++-
 gcc/Makefile.in        | 27 ++++++++++++++-------------
 gcc/collect2.c         |  4 ++--
 gcc/collect2.h         |  1 -
 gcc/errors.c           |  6 +++++-
 gcc/errors.h           |  2 --
 gcc/fix-header.c       | 28 ++--------------------------
 gcc/fixinc/Makefile.in |  2 +-
 gcc/gcc.c              |  4 ++--
 gcc/gcc.h              |  1 -
 gcc/gcov.c             | 11 -----------
 gcc/java/ChangeLog     |  6 +++++-
 gcc/java/jv-scan.c     |  6 ++++++
 gcc/rtl.h              | 10 ----------
 gcc/system.h           |  5 +++++
 gcc/tree.h             | 10 ----------
 16 files changed, 70 insertions(+), 82 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a673be7976b4..a9aee48f70f8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,32 @@
 2004-08-23  Nathan Sidwell  <nathan@codesourcery.com>
 
+	* Makefile.in (BUILD_ERRORS): Set to build-errors.
+	(errors.o): New target for host.
+	(build-errors.o): New target for build.
+	(genobjs): Replace errors.o with build-errors.
+	(gengenrtl$(buildexeext)): Add $(BUILD_ERRORS).
+	(GCOV_OBJS, GCOV_DUMP_OBJS): Add errors.o.
+	(fix-headers$(build_exeext)): Add $(BUILD_ERRORS).
+	(fix-header.o): Add errors.h
+	* collect2.c (fancy_abort): Add parameters.
+	* collect2.h (fancy_abort): Don't declare.
+	* errors.h (fancy_abort): Don't declare.
+	* errors.c: Include either bconfig.h or config.h.
+	(fancy_abort): Trim filename.
+	* fix-header.c (v_fatal, fatal): Remove.
+	(progname): Remove definition.
+	(main): Set progname here.
+	* gcc.c (fancy_abort): Add parameters.
+	* gcc.h (fancy_abort): Remove declaration.
+	* gcov.c (fancy_abort): Remove.
+	* rtl.h (fancy_abort): Don't declare.
+	(abort): Don't define.
+	* tree.h (fancy_abort): Don't declare.
+	(abort): Don't define.
+	* system.h (fancy_abort): Declare.
+	(abort): Define to fancy_abort.
+	* fixinc/Makefile.in (ALLOBJ): Add ../build-errors.o
+
 	* tree.h (enum size_type_kind): Remove USIZETYPE, UBITSIZETYPE.
 	(usize_type, ubitsizetype): Remove.
 	* stor-layout.c (set_sizetype): Don't initialize usizetype,
@@ -3223,7 +3250,7 @@
 	* config/i386/xmmintrin.h: Include <mm_malloc.h>.
 
 2004-08-03  H.J. Lu  <hongjiu.lu@intel.com>
-	    Tanguy Fautrà <tfautre@pandora.be>
+	    Tanguy Fautrà <tfautre@pandora.be>
 
 	* config/i386/pmm_malloc.h: New file.
 
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index a71558bf3e47..14de81e2b072 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -771,7 +771,7 @@ BUILD_SUPPORT = gensupport.o insn-conditions.o
 BUILD_EARLY_SUPPORT = gensupport.o dummy-conditions.o
 
 BUILD_PRINT = build-print-rtl.o
-BUILD_ERRORS = errors.o
+BUILD_ERRORS = build-errors.o
 BUILD_VARRAY = build-varray.o
 
 # Specify the directories to be searched for header files.
@@ -2137,6 +2137,7 @@ lambda-mat.o : lambda-mat.c lambda.h $(GGC_H) $(SYSTEM_H) $(CONFIG_H) $(TM_H)
 params.o : params.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(PARAMS_H) toplev.h
 hooks.o: hooks.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(HOOKS_H)
 pretty-print.o: $(CONFIG_H) $(SYSTEM_H) pretty-print.c $(PRETTY_PRINT_H)
+errors.o : errors.c $(CONFIG_H) $(SYSTEM_H) errors.h
 
 $(out_object_file): $(out_file) $(CONFIG_H) coretypes.h $(TM_H) $(TREE_H) $(GGC_H) \
    $(RTL_H) $(REGS_H) hard-reg-set.h real.h insn-config.h conditions.h \
@@ -2464,8 +2465,9 @@ genprogs=$(genprognames:%=%$(build_exeext))
 genobjs=$(genprognames:%=%.o) read-rtl.o gensupport.o genattrtab.o \
         genautomata.o gengenrtl.o genmodes.o genpreds.o gengtype.o \
 	genconstants.o gen-protos.o scan.o fix-header.o scan-decls.o \
-	gencheck.o dummy-conditions.o genconditions.o errors.o ggc-none.o \
-	min-insn-modes.o build-rtl.o build-print-rtl.o build-varray.o
+	gencheck.o dummy-conditions.o genconditions.o build-errors.o \
+	ggc-none.o min-insn-modes.o build-rtl.o build-print-rtl.o \
+	build-varray.o
 
 $(genprogs): %$(build_exeext): %.o  $(BUILD_RTL) $(BUILD_SUPPORT) \
 			       $(BUILD_PRINT) $(BUILD_ERRORS) \
@@ -2537,9 +2539,9 @@ genautomata.o : genautomata.c $(RTL_BASE_H) $(OBSTACK_H) $(BCONFIG_H) \
 genoutput.o : genoutput.c $(RTL_BASE_H) $(BCONFIG_H) \
   $(SYSTEM_H) coretypes.h $(GTM_H) errors.h gensupport.h
 
-gengenrtl$(build_exeext) : gengenrtl.o $(BUILD_LIBDEPS)
+gengenrtl$(build_exeext) : gengenrtl.o $(BUILD_ERRORS) $(BUILD_LIBDEPS)
 	$(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \
-	 gengenrtl.o $(BUILD_LIBS)
+	 gengenrtl.o $(BUILD_ERRORS) $(BUILD_LIBS)
 
 gengenrtl.o : gengenrtl.c $(BCONFIG_H) $(SYSTEM_H) rtl.def
 
@@ -2592,7 +2594,7 @@ genconditions$(build_exeext) : genconditions.o $(BUILD_EARLY_SUPPORT) \
 genconditions.o : genconditions.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H) \
 	coretypes.h $(GTM_H) errors.h
 
-errors.o : errors.c $(BCONFIG_H) $(SYSTEM_H) errors.h
+build-errors.o : errors.c $(BCONFIG_H) $(SYSTEM_H) errors.h
 ggc-none.o : ggc-none.c $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GGC_H)
 min-insn-modes.o : min-insn-modes.c $(BCONFIG_H) system.h $(MACHMODE_H)
 build-rtl.o: rtl.c $(BCONFIG_H) coretypes.h $(GTM_H) $(SYSTEM_H) $(RTL_H) \
@@ -2711,12 +2713,10 @@ s-iov: gcov-iov$(build_exeext)
 gcov.o: gcov.c gcov-io.h gcov-io.c gcov-iov.h intl.h $(SYSTEM_H) coretypes.h $(TM_H) $(CONFIG_H)
 gcov-dump.o: gcov-dump.c gcov-io.h gcov-io.c gcov-iov.h $(SYSTEM_H) coretypes.h $(TM_H) $(CONFIG_H)
 
-# Only one of 'gcov' or 'gcov.exe' is actually built, depending
-# upon whether $(exeext) is empty or not.
-GCOV_OBJS = gcov.o intl.o version.o
+GCOV_OBJS = gcov.o intl.o version.o errors.o
 gcov$(exeext): $(GCOV_OBJS) $(LIBDEPS)
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) $(GCOV_OBJS) $(LIBS) -o $@
-GCOV_DUMP_OBJS = gcov-dump.o version.o
+GCOV_DUMP_OBJS = gcov-dump.o version.o errors.o
 gcov-dump$(exeext): $(GCOV_DUMP_OBJS) $(LIBDEPS)
 	$(CC) $(ALL_CFLAGS) $(LDFLAGS) $(GCOV_DUMP_OBJS) $(LIBS) -o $@
 #
@@ -2841,11 +2841,12 @@ xsys-protos.h: $(GCC_PASSES) $(srcdir)/sys-protos.h deduced.h gen-protos$(build_
 # This is nominally a 'build' program, but it's run only when host==build,
 # so we can (indeed, must) use $(LIBDEPS) and $(LIBS).
 fix-header$(build_exeext): fix-header.o scan-decls.o scan.o xsys-protos.h \
-           c-incpath.o cppdefault.o prefix.o $(LIBDEPS)
+           c-incpath.o cppdefault.o prefix.o $(BUILD_ERRORS) $(LIBDEPS)
 	$(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ fix-header.o \
-	c-incpath.o cppdefault.o scan-decls.o prefix.o scan.o $(LIBS)
+	  c-incpath.o cppdefault.o scan-decls.o prefix.o scan.o \
+	  $(BUILD_ERRORS) $(LIBS)
 
-fix-header.o: fix-header.c $(OBSTACK_H) scan.h \
+fix-header.o: fix-header.c $(OBSTACK_H) scan.h errors.h \
 	xsys-protos.h $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H) $(CPPLIB_H)
 
 scan-decls.o: scan-decls.c scan.h $(CPPLIB_H) $(BCONFIG_H) $(SYSTEM_H) coretypes.h $(GTM_H)
diff --git a/gcc/collect2.c b/gcc/collect2.c
index 2edbea84b0ea..0b398f74b982 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -401,9 +401,9 @@ error (const char * msgid, ...)
    provide a default entry.  */
 
 void
-fancy_abort (void)
+fancy_abort (const char *file, int line, const char *func)
 {
-  fatal ("internal error");
+  fatal ("internal gcc abort in %s, at %s:%d", func, file, line);
 }
 
 static void
diff --git a/gcc/collect2.h b/gcc/collect2.h
index 2434f169be5f..710e19ab28ff 100644
--- a/gcc/collect2.h
+++ b/gcc/collect2.h
@@ -39,7 +39,6 @@ extern struct obstack temporary_obstack;
 extern char *temporary_firstobj;
 extern int vflag, debug;
 
-extern void fancy_abort (void) ATTRIBUTE_NORETURN;
 extern void error (const char *, ...) ATTRIBUTE_PRINTF_1;
 extern void notice (const char *, ...) ATTRIBUTE_PRINTF_1;
 extern void fatal (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
diff --git a/gcc/errors.c b/gcc/errors.c
index 13288a8ced49..6889c736efd0 100644
--- a/gcc/errors.c
+++ b/gcc/errors.c
@@ -23,7 +23,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
    in the generator programs; the compiler has a more elaborate suite
    of diagnostic printers, found in diagnostic.c.  */
 
+#ifdef GENERATOR_FILE
 #include "bconfig.h"
+#else
+#include "config.h"
+#endif
 #include "system.h"
 #include "errors.h"
 
@@ -126,5 +130,5 @@ trim_filename (const char *name)
 void
 fancy_abort (const char *file, int line, const char *func)
 {
-  internal_error ("abort in %s, at %s:%d", func, file, line);
+  internal_error ("abort in %s, at %s:%d", func, trim_filename (file), line);
 }
diff --git a/gcc/errors.h b/gcc/errors.h
index 9e0bf1e8e01e..df5d8d870b5b 100644
--- a/gcc/errors.h
+++ b/gcc/errors.h
@@ -35,8 +35,6 @@ extern void error (const char *, ...);
 extern void fatal (const char *, ...) ATTRIBUTE_NORETURN;
 extern void internal_error (const char *, ...) ATTRIBUTE_NORETURN;
 extern const char *trim_filename (const char *);
-extern void fancy_abort (const char *, int, const char *)
-    ATTRIBUTE_NORETURN;
 
 extern int have_error;
 extern const char *progname;
diff --git a/gcc/fix-header.c b/gcc/fix-header.c
index 5e2e7bb3ed72..0212cf77ca4e 100644
--- a/gcc/fix-header.c
+++ b/gcc/fix-header.c
@@ -79,10 +79,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "scan.h"
 #include "cpplib.h"
 #include "c-incpath.h"
-
-static void v_fatal (const char *, va_list)
-     ATTRIBUTE_PRINTF (1,0) ATTRIBUTE_NORETURN;
-static void fatal (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
+#include "errors.h"
 
 #ifdef TARGET_EXTRA_INCLUDES
 static void hook_void_int(int u ATTRIBUTE_UNUSED) { }
@@ -407,7 +404,6 @@ lookup_std_proto (const char *name, int name_length)
 
 char *inc_filename;
 int inc_filename_length;
-const char *progname = "fix-header";
 FILE *outf;
 sstring line;
 
@@ -1076,6 +1072,7 @@ main (int argc, char **argv)
   long int inf_size;
   struct symbol_list *cur_symbols;
 
+  progname = "fix-header";
   if (argv[0] && argv[0][0])
     {
       char *p;
@@ -1301,24 +1298,3 @@ main (int argc, char **argv)
 
   return 0;
 }
-
-
-static void
-v_fatal (const char *str, va_list ap)
-{
-  fprintf (stderr, "%s: %s: ", progname, inc_filename);
-  vfprintf (stderr, str, ap);
-  fprintf (stderr, "\n");
-
-  exit (FATAL_EXIT_CODE);
-}
-
-static void
-fatal (const char *str, ...)
-{
-  va_list ap;
-
-  va_start (ap, str);
-  v_fatal (str, ap);
-  va_end (ap);
-}
diff --git a/gcc/fixinc/Makefile.in b/gcc/fixinc/Makefile.in
index 22ea44ff9f28..ae410e143866 100644
--- a/gcc/fixinc/Makefile.in
+++ b/gcc/fixinc/Makefile.in
@@ -68,7 +68,7 @@ INCLUDES = -I. -I.. -I$(srcdir) -I$(srcdir)/.. \
 LIBERTY = ../../libiberty/libiberty.a
 
 ALLOBJ = fixincl.o fixtests.o fixfixes.o server.o procopen.o \
-      fixlib.o
+      fixlib.o ../build-errors.o
 
 TESTOBJ = fixincl.o fixlib.o fixtests.o
 FIXOBJ  = fixfixes.o fixlib.o
diff --git a/gcc/gcc.c b/gcc/gcc.c
index d56a3958e7a5..7685274cc5f5 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -6724,9 +6724,9 @@ pfatal_pexecute (const char *errmsg_fmt, const char *errmsg_arg)
 /* Output an error message and exit.  */
 
 void
-fancy_abort (void)
+fancy_abort (const char *file, int line, const char *func)
 {
-  fatal ("internal gcc abort");
+  fatal ("internal gcc abort in %s, at %s:%d", func, file, line);
 }
 
 /* Output an error message and exit.  */
diff --git a/gcc/gcc.h b/gcc/gcc.h
index f5a04d3a1366..772dfb8ede44 100644
--- a/gcc/gcc.h
+++ b/gcc/gcc.h
@@ -56,7 +56,6 @@ struct spec_function
 /* These are exported by gcc.c.  */
 extern int do_spec (const char *);
 extern void record_temp_file (const char *, int, int);
-extern void fancy_abort (void) ATTRIBUTE_NORETURN;
 extern void fatal (const char *, ...) ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
 extern void error (const char *, ...) ATTRIBUTE_PRINTF_1;
 extern void pfatal_with_name (const char *) ATTRIBUTE_NORETURN;
diff --git a/gcc/gcov.c b/gcc/gcov.c
index c988730e38a7..0e6a6f8de494 100644
--- a/gcc/gcov.c
+++ b/gcc/gcov.c
@@ -373,17 +373,6 @@ fnotice (FILE *file, const char *msgid, ...)
   vfprintf (file, _(msgid), ap);
   va_end (ap);
 }
-
-/* More 'friendly' abort that prints the line and file.
-   config.h can #define abort fancy_abort if you like that sort of thing.  */
-extern void fancy_abort (void) ATTRIBUTE_NORETURN;
-
-void
-fancy_abort (void)
-{
-  fnotice (stderr, "Internal gcov abort.\n");
-  exit (FATAL_EXIT_CODE);
-}
 
 /* Print a usage message and exit.  If ERROR_P is nonzero, this is an error,
    otherwise the output of --help.  */
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 5af0be7ecec0..0e7bb8b4b0a8 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,7 @@
+2004-08-23  Nathan Sidwell  <nathan@codesourcery.com>
+
+	* jv-scan.c (fancy_abort): Add.
+
 2004-08-20  Nathan Sidwell  <nathan@codesourcery.com>
 
 	* expr.c (build_java_arrayaccess): Use convert to change
@@ -8592,7 +8596,7 @@
 	properly initialize `finished_label'. Don't emit gotos for empty
 	try statements.
 
-2000-03-19  Martin v. Löwis  <loewis@informatik.hu-berlin.de>
+2000-03-19  Martin v. Löwis  <loewis@informatik.hu-berlin.de>
 
 	* except.c (emit_handlers): Clear catch_clauses_last.
 
diff --git a/gcc/java/jv-scan.c b/gcc/java/jv-scan.c
index 1e9490b0aa0f..77320e606c3d 100644
--- a/gcc/java/jv-scan.c
+++ b/gcc/java/jv-scan.c
@@ -261,3 +261,9 @@ warning (const char *msgid, ...)
   fputc ('\n', stderr);
   va_end (ap);
 }
+
+void
+fancy_abort (const char *file, int line, const char *func)
+{
+  fatal_error ("abort in %s, at %s:%d", func, file, line);
+}
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 120e79443736..6af321ed0bb6 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2151,16 +2151,6 @@ extern rtx read_rtx (FILE *);
 extern const char *read_rtx_filename;
 extern int read_rtx_lineno;
 
-/* Redefine abort to report an internal error w/o coredump, and
-   reporting the location of the error in the source file.  This logic
-   is duplicated in rtl.h and tree.h because every file that needs the
-   special abort includes one or both.  toplev.h gets too few files,
-   system.h gets too many.  */
-
-extern void fancy_abort (const char *, int, const char *)
-    ATTRIBUTE_NORETURN;
-#define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)
-
 /* In alias.c */
 extern void clear_reg_alias_info (rtx);
 extern rtx canon_rtx (rtx);
diff --git a/gcc/system.h b/gcc/system.h
index 3411fc434913..ccb3d4b381e9 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -500,6 +500,11 @@ extern int snprintf (char *, size_t, const char *, ...);
 #define __builtin_expect(a, b) (a)
 #endif
 
+/* Redefine abort to report an internal error w/o coredump, and
+   reporting the location of the error in the source file.  */
+extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
+#define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)
+
 /* Provide a fake boolean type.  We make no attempt to use the
    C99 _Bool, as it may not be available in the bootstrap compiler,
    and even if it is, it is liable to be buggy.  
diff --git a/gcc/tree.h b/gcc/tree.h
index 920abe7efd65..e0df473f32bf 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -3746,16 +3746,6 @@ extern const char *dump_flag_name (enum tree_dump_index);
 extern void set_decl_rtl (tree, rtx);
 extern void set_decl_incoming_rtl (tree, rtx);
 
-/* Redefine abort to report an internal error w/o coredump, and
-   reporting the location of the error in the source file.  This logic
-   is duplicated in rtl.h and tree.h because every file that needs the
-   special abort includes one or both.  toplev.h gets too few files,
-   system.h gets too many.  */
-
-extern void fancy_abort (const char *, int, const char *)
-    ATTRIBUTE_NORETURN;
-#define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__)
-
 /* Enum and arrays used for tree allocation stats.
    Keep in sync with tree.c:tree_node_kind_names.  */
 typedef enum
-- 
GitLab