This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[c++] enable __cxa_atexit by default if found
- From: Benjamin Kosnik <bkoz at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, jakub at redhat dot com, hjl at lucon dot org
- Date: Tue, 6 Aug 2002 21:51:42 -0700
- Subject: [c++] enable __cxa_atexit by default if found
Adds what is considered sane behavior by default, if libc has __cxa_atexit.
2002-08-06 Benjamin Kosnik <bkoz@redhat.com>
* defaults.h (DEFAULT_USE_CXA_ATEXIT): Default to yes.
* configure.in: Test for __cxa_atexit, enable if __cxa_atexit if found.
* configure: Regenerate.
Index: defaults.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/defaults.h,v
retrieving revision 1.87
diff -c -p -r1.87 defaults.h
*** defaults.h 31 Jul 2002 02:10:04 -0000 1.87
--- defaults.h 7 Aug 2002 04:46:28 -0000
*************** You Lose! You must define PREFERRED_DEB
*** 587,593 ****
/* 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 */
--- 587,593 ----
/* 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 1
#endif
#endif /* ! GCC_DEFAULTS_H */
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/configure.in,v
retrieving revision 1.613
diff -c -p -r1.613 configure.in
*** configure.in 2 Aug 2002 15:57:09 -0000 1.613
--- configure.in 7 Aug 2002 04:46:34 -0000
*************** fi])
*** 268,274 ****
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.
--- 268,277 ----
AC_ARG_ENABLE(__cxa_atexit,
[ --enable-__cxa_atexit enable __cxa_atexit for C++],
[], [])
! # Check for __cxa_atexit in libc.
! AC_CHECK_FUNC(__cxa_atexit, ac_cxa_atexit=yes, ac_cxa_atexit=no)
! # Enable if it's found, and wanted.
! if test x$enable___cxa_atexit != xno && test x$ac_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.