This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH]: One declaration of abort


Hi,
this patch unifies all the declarations of fancy_abort and abort's
overriding.

The comment in rtl.h & tree.h about system.h getting too much is resolved
by this patch.

booted & tested on i686-pc-linux-gnu, and building a powerpc-unknown-elf
cross compiler on same. ok?

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2004-08-20  Nathan Sidwell  <nathan@codesourcery.com>

	* Makefile.in (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.
	* 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 ../errors.o
	* java/jv-scan.c (fancy_abort): Add.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1354
diff -c -3 -p -r1.1354 Makefile.in
*** Makefile.in	19 Aug 2004 10:35:45 -0000	1.1354
--- Makefile.in	20 Aug 2004 08:20:09 -0000
*************** genautomata.o : genautomata.c $(RTL_BASE
*** 2537,2545 ****
  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)
  	$(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \
! 	 gengenrtl.o $(BUILD_LIBS)
  
  gengenrtl.o : gengenrtl.c $(BCONFIG_H) $(SYSTEM_H) rtl.def
  
--- 2537,2545 ----
  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_ERRORS) $(BUILD_LIBDEPS)
  	$(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ \
! 	 gengenrtl.o $(BUILD_ERRORS) $(BUILD_LIBS)
  
  gengenrtl.o : gengenrtl.c $(BCONFIG_H) $(SYSTEM_H) rtl.def
  
*************** gcov-dump.o: gcov-dump.c gcov-io.h gcov-
*** 2713,2722 ****
  
  # 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$(exeext): $(GCOV_OBJS) $(LIBDEPS)
  	$(CC) $(ALL_CFLAGS) $(LDFLAGS) $(GCOV_OBJS) $(LIBS) -o $@
! GCOV_DUMP_OBJS = gcov-dump.o version.o
  gcov-dump$(exeext): $(GCOV_DUMP_OBJS) $(LIBDEPS)
  	$(CC) $(ALL_CFLAGS) $(LDFLAGS) $(GCOV_DUMP_OBJS) $(LIBS) -o $@
  #
--- 2713,2722 ----
  
  # 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 errors.o
  gcov$(exeext): $(GCOV_OBJS) $(LIBDEPS)
  	$(CC) $(ALL_CFLAGS) $(LDFLAGS) $(GCOV_OBJS) $(LIBS) -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 $@
  #
*************** xsys-protos.h: $(GCC_PASSES) $(srcdir)/s
*** 2841,2851 ****
  # 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)
  	$(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o $@ fix-header.o \
! 	c-incpath.o cppdefault.o scan-decls.o prefix.o scan.o $(LIBS)
  
! fix-header.o: fix-header.c $(OBSTACK_H) scan.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)
--- 2841,2852 ----
  # 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 $(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 \
! 	  $(BUILD_ERRORS) $(LIBS)
  
! 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)
Index: collect2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/collect2.c,v
retrieving revision 1.164
diff -c -3 -p -r1.164 collect2.c
*** collect2.c	13 Jul 2004 17:19:12 -0000	1.164
--- collect2.c	20 Aug 2004 08:20:14 -0000
*************** error (const char * msgid, ...)
*** 401,409 ****
     provide a default entry.  */
  
  void
! fancy_abort (void)
  {
!   fatal ("internal error");
  }
  
  static void
--- 401,409 ----
     provide a default entry.  */
  
  void
! fancy_abort (const char *file, int line, const char *func)
  {
!   fatal ("internal gcc abort in %sm at %s:%d", func, file, line);
  }
  
  static void
Index: collect2.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/collect2.h,v
retrieving revision 1.8
diff -c -3 -p -r1.8 collect2.h
*** collect2.h	29 Jun 2003 12:07:06 -0000	1.8
--- collect2.h	20 Aug 2004 08:20:15 -0000
*************** extern struct obstack temporary_obstack;
*** 39,45 ****
  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;
--- 39,44 ----
Index: errors.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/errors.h,v
retrieving revision 1.11
diff -c -3 -p -r1.11 errors.h
*** errors.h	1 Jun 2003 15:59:08 -0000	1.11
--- errors.h	20 Aug 2004 08:20:15 -0000
*************** extern void error (const char *, ...);
*** 35,42 ****
  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;
--- 35,40 ----
Index: fix-header.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fix-header.c,v
retrieving revision 1.111
diff -c -3 -p -r1.111 fix-header.c
*** fix-header.c	22 May 2004 08:55:53 -0000	1.111
--- fix-header.c	20 Aug 2004 08:20:18 -0000
*************** Foundation, 59 Temple Place - Suite 330,
*** 79,88 ****
  #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;
  
  #ifdef TARGET_EXTRA_INCLUDES
  static void hook_void_int(int u ATTRIBUTE_UNUSED) { }
--- 79,85 ----
  #include "scan.h"
  #include "cpplib.h"
  #include "c-incpath.h"
! #include "errors.h"
  
  #ifdef TARGET_EXTRA_INCLUDES
  static void hook_void_int(int u ATTRIBUTE_UNUSED) { }
*************** lookup_std_proto (const char *name, int 
*** 407,413 ****
  
  char *inc_filename;
  int inc_filename_length;
- const char *progname = "fix-header";
  FILE *outf;
  sstring line;
  
--- 404,409 ----
*************** main (int argc, char **argv)
*** 1076,1081 ****
--- 1072,1078 ----
    long int inf_size;
    struct symbol_list *cur_symbols;
  
+   progname = "fix-header";
    if (argv[0] && argv[0][0])
      {
        char *p;
*************** main (int argc, char **argv)
*** 1301,1324 ****
  
    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);
- }
--- 1298,1300 ----
Index: gcc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
retrieving revision 1.428
diff -c -3 -p -r1.428 gcc.c
*** gcc.c	18 Aug 2004 01:58:13 -0000	1.428
--- gcc.c	20 Aug 2004 08:20:32 -0000
*************** pfatal_pexecute (const char *errmsg_fmt,
*** 6713,6721 ****
  /* Output an error message and exit.  */
  
  void
! fancy_abort (void)
  {
!   fatal ("internal gcc abort");
  }
  
  /* Output an error message and exit.  */
--- 6713,6721 ----
  /* Output an error message and exit.  */
  
  void
! fancy_abort (const char *file, int line, const char *func)
  {
!   fatal ("internal gcc abort in %sm at %s:%d", func, file, line);
  }
  
  /* Output an error message and exit.  */
Index: gcc.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.h,v
retrieving revision 1.16
diff -c -3 -p -r1.16 gcc.h
*** gcc.h	5 May 2004 12:20:18 -0000	1.16
--- gcc.h	20 Aug 2004 08:20:32 -0000
*************** struct spec_function
*** 56,62 ****
  /* 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;
--- 56,61 ----
Index: gcov.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcov.c,v
retrieving revision 1.82
diff -c -3 -p -r1.82 gcov.c
*** gcov.c	29 Jul 2004 08:58:58 -0000	1.82
--- gcov.c	20 Aug 2004 08:20:39 -0000
*************** fnotice (FILE *file, const char *msgid, 
*** 373,389 ****
    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.  */
--- 373,378 ----
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.505
diff -c -3 -p -r1.505 rtl.h
*** rtl.h	18 Aug 2004 22:31:02 -0000	1.505
--- rtl.h	20 Aug 2004 08:20:43 -0000
*************** extern rtx read_rtx (FILE *);
*** 2151,2166 ****
  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);
--- 2151,2156 ----
Index: system.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/system.h,v
retrieving revision 1.223
diff -c -3 -p -r1.223 system.h
*** system.h	25 Jul 2004 00:32:22 -0000	1.223
--- system.h	20 Aug 2004 08:20:45 -0000
*************** extern int snprintf (char *, size_t, con
*** 500,505 ****
--- 500,510 ----
  #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.  
Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.595
diff -c -3 -p -r1.595 tree.h
*** tree.h	19 Aug 2004 10:35:56 -0000	1.595
--- tree.h	20 Aug 2004 08:20:55 -0000
*************** extern const char *dump_flag_name (enum 
*** 3746,3761 ****
  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
--- 3746,3751 ----
Index: fixinc/Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fixinc/Makefile.in,v
retrieving revision 1.43
diff -c -3 -p -r1.43 Makefile.in
*** fixinc/Makefile.in	21 Apr 2004 22:06:06 -0000	1.43
--- fixinc/Makefile.in	20 Aug 2004 08:21:31 -0000
*************** INCLUDES = -I. -I.. -I$(srcdir) -I$(srcd
*** 68,74 ****
  LIBERTY = ../../libiberty/libiberty.a
  
  ALLOBJ = fixincl.o fixtests.o fixfixes.o server.o procopen.o \
!       fixlib.o
  
  TESTOBJ = fixincl.o fixlib.o fixtests.o
  FIXOBJ  = fixfixes.o fixlib.o
--- 68,74 ----
  LIBERTY = ../../libiberty/libiberty.a
  
  ALLOBJ = fixincl.o fixtests.o fixfixes.o server.o procopen.o \
!       fixlib.o ../errors.o
  
  TESTOBJ = fixincl.o fixlib.o fixtests.o
  FIXOBJ  = fixfixes.o fixlib.o
Index: java/jv-scan.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/jv-scan.c,v
retrieving revision 1.41
diff -c -3 -p -r1.41 jv-scan.c
*** java/jv-scan.c	10 Feb 2004 19:12:34 -0000	1.41
--- java/jv-scan.c	20 Aug 2004 08:21:34 -0000
*************** warning (const char *msgid, ...)
*** 261,263 ****
--- 261,269 ----
    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);
+ }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]