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]

Re: PATCH: Add --enable-__cxa_atexit


On Thu, Jun 06, 2002 at 10:00:23AM -0700, Mark Mitchell wrote:
> 
> > FWIW, I put correctness over speed myself. Can I check in
> >
> > http://gcc.gnu.org/ml/gcc-patches/2002-06/msg00150.html
> 
> OK for mainline and branch.
> 

This is the patch I checked in.

Thanks.


H.J.
---
2002-06-07  H.J. Lu  (hjl@gnu.org)

	* configure.in: Add --enable-__cxa_atexit.
	* configure: Regenerated.
	* config.in: Likewise.

	* defaults.h (DEFAULT_USE_CXA_ATEXIT): New. Defined to be 0 if
	not defined.

2002-06-07  H.J. Lu  (hjl@gnu.org)

	* decl2.c (flag_use_cxa_atexit): Set to DEFAULT_USE_CXA_ATEXIT.

Index: gcc/config.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config.in,v
retrieving revision 1.133.4.2
diff -u -p -r1.133.4.2 config.in
--- gcc/config.in	17 Apr 2002 01:36:03 -0000	1.133.4.2
+++ gcc/config.in	7 Jun 2002 17:09:19 -0000
@@ -296,6 +296,12 @@
    every opportunity.  This is extremely expensive. */
 #undef ENABLE_GC_ALWAYS_COLLECT
 
+/* Define if you want to use __cxa_atexit, rather than atexit, to
+   register C++ destructors for local statics and global objects.
+   This is essential for fully standards-compliant handling of
+   destructors, but requires __cxa_atexit in libc. */
+#undef DEFAULT_USE_CXA_ATEXIT
+
 /* Define if you want the C and C++ compilers to support multibyte
    character sets for source code. */
 #undef MULTIBYTE_CHARS
Index: gcc/configure.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.in,v
retrieving revision 1.576.4.15
diff -u -p -r1.576.4.15 configure.in
--- gcc/configure.in	23 May 2002 08:01:58 -0000	1.576.4.15
+++ gcc/configure.in	7 Jun 2002 17:09:22 -0000
@@ -259,6 +259,18 @@ elif test x$withval != xno; then
   cpp_install_dir=$withval
 fi])
 
+# Enable __cxa_atexit for C++.
+AC_ARG_ENABLE(__cxa_atexit,
+[  --enable-__cxa_atexit   enable __cxa_atexit for C++],
+[], [])
+if test x$enable___cxa_atexit = xyes; then
+  AC_DEFINE(DEFAULT_USE_CXA_ATEXIT, 1,
+  [Define if you want to use __cxa_atexit, rather than atexit, to
+   register C++ destructors for local statics and global objects.
+   This is essential for fully standards-compliant handling of
+   destructors, but requires __cxa_atexit in libc.])
+fi
+  
 # Enable Multibyte Characters for C/C++
 AC_ARG_ENABLE(c-mbchar,
 [  --enable-c-mbchar       enable multibyte characters for C and C++],
Index: gcc/defaults.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/defaults.h,v
retrieving revision 1.64.6.2
diff -u -p -r1.64.6.2 defaults.h
--- gcc/defaults.h	3 May 2002 12:07:04 -0000	1.64.6.2
+++ gcc/defaults.h	7 Jun 2002 17:09:22 -0000
@@ -462,4 +462,10 @@ You Lose!  You must define PREFERRED_DEB
 #define MODE_BASE_REG_CLASS(MODE) BASE_REG_CLASS
 #endif
 
+/* Determine whether __cxa_atexit, rather than atexit, is used to
+   register C++ destructors for local statics and global objects. */
+#ifndef DEFAULT_USE_CXA_ATEXIT
+#define DEFAULT_USE_CXA_ATEXIT 0
+#endif
+
 #endif  /* ! GCC_DEFAULTS_H */
Index: gcc/cp/decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.520.2.5
diff -u -p -r1.520.2.5 decl2.c
--- gcc/cp/decl2.c	17 Apr 2002 17:13:39 -0000	1.520.2.5
+++ gcc/cp/decl2.c	7 Jun 2002 17:09:27 -0000
@@ -376,7 +376,7 @@ int flag_weak = 1;
 /* Nonzero to use __cxa_atexit, rather than atexit, to register
    destructors for local statics and global objects.  */
 
-int flag_use_cxa_atexit;
+int flag_use_cxa_atexit = DEFAULT_USE_CXA_ATEXIT;
 
 /* Maximum template instantiation depth.  This limit is rather
    arbitrary, but it exists to limit the time it takes to notice


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