This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: Add --enable-__cxa_atexit
- From: "H . J . Lu" <hjl at lucon dot org>
- To: Jack Howarth <howarth at nitro dot msbb dot uc dot edu>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 31 May 2002 10:43:11 -0700
- Subject: PATCH: Add --enable-__cxa_atexit
- References: <200205310627.CAA13821@nitro.msbb.uc.edu> <200205311604.MAA14609@nitro.msbb.uc.edu>
On Fri, May 31, 2002 at 12:04:24PM -0400, Jack Howarth wrote:
> HJ,
> That is a patch one of the debian gcc packagers added in to
> their current gcc-3.1 source package. The reason for it is unclear.
> I noticed that Mark Mitchell is the person checking in code
> related to the use of __cxa_atexit in that manner so I just emailed
> him to ask about the rationality of that patch. My instinct is that
> this is toggling on code that has not been throughly tested in
> gcc 3.1 since it doesn't exist as a configure --enable- type option.
> I'll pass your comments back to them.
Here is a patch.
H.J.
---
2002-05-31 H.J. Lu (hjl@gnu.org)
* configure.in: Add --enable-__cxa_atexit.
* configure: Regenerated.
* config.in: Likewise.
2002-05-31 H.J. Lu (hjl@gnu.org)
* decl2.c (flag_use_cxa_atexit): Set to 1 if ENABLE_CXA_ATEXIT
is defined.
--- gcc/config.in.atexit Mon May 27 20:24:25 2002
+++ gcc/config.in Fri May 31 10:26:20 2002
@@ -307,6 +307,10 @@
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. */
+#undef ENABLE_CXA_ATEXIT
+
/* Define if you want the C and C++ compilers to support multibyte
character sets for source code. */
#undef MULTIBYTE_CHARS
--- gcc/configure.in.atexit Fri May 31 10:26:20 2002
+++ gcc/configure.in Fri May 31 10:39:32 2002
@@ -269,6 +269,16 @@ 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++],
+[], [enable___cxa_atexit=no])
+if test x$enable___cxa_atexit != xno; then
+ AC_DEFINE(ENABLE_CXA_ATEXIT, 1,
+ [Define if you want to use __cxa_atexit, rather than, atexit to
+ register C++ destructors for local statics and global objects.])
+fi
+
# Enable Multibyte Characters for C/C++
AC_ARG_ENABLE(c-mbchar,
[ --enable-c-mbchar enable multibyte characters for C and C++],
--- gcc/cp/decl2.c.atexit Sun May 26 21:02:04 2002
+++ gcc/cp/decl2.c Fri May 31 10:26:20 2002
@@ -362,7 +362,11 @@ int flag_weak = 1;
/* Nonzero to use __cxa_atexit, rather than atexit, to register
destructors for local statics and global objects. */
+#ifdef ENABLE_CXA_ATEXIT
+int flag_use_cxa_atexit = 1;
+#else
int flag_use_cxa_atexit;
+#endif
/* Maximum template instantiation depth. This limit is rather
arbitrary, but it exists to limit the time it takes to notice