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]

[Janitor] Remove EXIT_BODY, NEED_ATEXIT, ON_EXIT


The macros EXIT_BODY, NEED_ATEXIT, ON_EXIT are not defined anywhere, I
removed their usage.

The L_exit case is now really small, L_exit is needed only by
config/avr/t-avr, config/ip2k/t-ip2k and config/m68hc11/t-m68hc11-gas
(all implemented in assembler).  Do we still need this?

Bootstrapped/regtested on i686-linux-gnu.

Ok to commit?

Andreas

2003-06-07  Andreas Jaeger  <aj@suse.de>

	* gbl-ctors.h: Remove declarations dependend on NEED_ATEXIT.

	* libgcc2.c (exit): Remove code dependend on NEED_ATEXIT, ON_EXIT,
	EXIT_BODY.

	* system.h: Poison NEED_ATEXIT, ON_EXIT, EXIT_BODY.

	* doc/tm.texi (Misc): Remove NEED_ATEXIT, ON_EXIT, EXIT_BODY.

============================================================
Index: gcc/gbl-ctors.h
--- gcc/gbl-ctors.h	22 Apr 2003 17:21:04 -0000	1.11
+++ gcc/gbl-ctors.h	7 Jun 2003 11:53:05 -0000
@@ -2,7 +2,7 @@
    for getting g++ file-scope static objects constructed.  This file
    will get included either by libgcc2.c (for systems that don't support
    a .init section) or by crtstuff.c (for those that do).
-   Copyright (C) 1991, 1995, 1996, 1998, 1999, 2000
+   Copyright (C) 1991, 1995, 1996, 1998, 1999, 2000, 2003
    Free Software Foundation, Inc.
    Contributed by Ron Guilmette (rfg@segfault.us.com)
 
@@ -37,10 +37,6 @@ Software Foundation, 59 Temple Place - S
 
 	Note that this file should only be compiled with GCC.
 */
-
-#ifdef NEED_ATEXIT
-extern int atexit (void (*) (void));
-#endif
 
 /*  Declare a pointer to void function type.  */
 
============================================================
Index: gcc/libgcc2.c
--- gcc/libgcc2.c	4 Jun 2003 05:21:38 -0000	1.165
+++ gcc/libgcc2.c	7 Jun 2003 11:53:05 -0000
@@ -1673,74 +1673,4 @@ func_ptr __DTOR_LIST__[2];
 
 #include "gbl-ctors.h"
 
-#ifdef NEED_ATEXIT
-
-#ifndef ON_EXIT
-
-# include <errno.h>
-
-static func_ptr *atexit_chain = 0;
-static long atexit_chain_length = 0;
-static volatile long last_atexit_chain_slot = -1;
-
-int
-atexit (func_ptr func)
-{
-  if (++last_atexit_chain_slot == atexit_chain_length)
-    {
-      atexit_chain_length += 32;
-      if (atexit_chain)
-	atexit_chain = (func_ptr *) realloc (atexit_chain, atexit_chain_length
-					     * sizeof (func_ptr));
-      else
-	atexit_chain = (func_ptr *) malloc (atexit_chain_length
-					    * sizeof (func_ptr));
-      if (! atexit_chain)
-	{
-	  atexit_chain_length = 0;
-	  last_atexit_chain_slot = -1;
-	  errno = ENOMEM;
-	  return (-1);
-	}
-    }
-  atexit_chain[last_atexit_chain_slot] = func;
-  return (0);
-}
-
-extern void _cleanup (void);
-extern void _exit (int) __attribute__ ((__noreturn__));
-
-void
-exit (int status)
-{
-  if (atexit_chain)
-    {
-      for ( ; last_atexit_chain_slot-- >= 0; )
-	{
-	  (*atexit_chain[last_atexit_chain_slot + 1]) ();
-	  atexit_chain[last_atexit_chain_slot + 1] = 0;
-	}
-      free (atexit_chain);
-      atexit_chain = 0;
-    }
-#ifdef EXIT_BODY
-  EXIT_BODY;
-#else
-  _cleanup ();
-#endif
-  _exit (status);
-}
-
-#else /* ON_EXIT */
-
-/* Simple; we just need a wrapper for ON_EXIT.  */
-int
-atexit (func_ptr func)
-{
-  return ON_EXIT (func);
-}
-
-#endif /* ON_EXIT */
-#endif /* NEED_ATEXIT */
-
 #endif /* L_exit */
============================================================
Index: gcc/system.h
--- gcc/system.h	4 Jun 2003 11:35:09 -0000	1.151
+++ gcc/system.h	7 Jun 2003 11:53:05 -0000
@@ -645,7 +645,7 @@ typedef char _Bool;
 	ROUND_TYPE_SIZE_UNIT CONST_SECTION_ASM_OP CRT_GET_RFIB_TEXT	   \
 	DBX_LBRAC_FIRST DBX_OUTPUT_ENUM DBX_OUTPUT_SOURCE_FILENAME	   \
 	DBX_WORKING_DIRECTORY INSN_CACHE_DEPTH INSN_CACHE_SIZE		   \
-	INSN_CACHE_LINE_WIDTH
+	INSN_CACHE_LINE_WIDTH NEED_ATEXIT ON_EXIT EXIT_BODY
 
 /* Hooks that are no longer used.  */
  #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE	\
============================================================
Index: gcc/doc/tm.texi
--- doc/tm.texi	4 Jun 2003 17:50:44 -0000	1.228
+++ doc/tm.texi	7 Jun 2003 11:53:05 -0000
@@ -9011,30 +9011,6 @@ The definition should be a C statement (
 appropriate rtl instructions.  It is used only when compiling the end of
 @code{main}.
 
-@item NEED_ATEXIT
-@findex NEED_ATEXIT
-Define this if the target system lacks the function @code{atexit}
-from the ISO C standard.  If this macro is defined, a default definition
-will be provided to support C++.  If @code{ON_EXIT} is not defined,
-a default @code{exit} function will also be provided.
-
-@item ON_EXIT
-@findex ON_EXIT
-Define this macro if the target has another way to implement atexit
-functionality without replacing @code{exit}.  For instance, SunOS 4 has
-a similar @code{on_exit} library function.
-
-The definition should be a functional macro which can be used just like
-the @code{atexit} function.
-
-@item EXIT_BODY
-@findex EXIT_BODY
-Define this if your @code{exit} function needs to do something
-besides calling an external function @code{_cleanup} before
-terminating with @code{_exit}.  The @code{EXIT_BODY} macro is
-only needed if @code{NEED_ATEXIT} is defined and @code{ON_EXIT} is not
-defined.
-
 @findex INSN_SETS_ARE_DELAYED
 @item INSN_SETS_ARE_DELAYED (@var{insn})
 Define this macro as a C expression that is nonzero if it is safe for the

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

Attachment: pgp00000.pgp
Description: PGP signature


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