acconfig.h: Add _GLIBCXX_USE___CXA_ATEXIT.

2004-10-08  Benjamin Kosnik  <bkoz@redhat.com>

	* acconfig.h: Add _GLIBCXX_USE___CXA_ATEXIT.
	* acinclude.m4 (GLIBCXX_ENABLE_CXA_ATEXIT): New.
	* configure.ac: Call GLIBCXX_ENABLE_CXA_EXIT.
	* configure: Regenerate.
	* src/mt_allocator.cc (__pool::~__pool): Make conditional on
	_GLIBCXX_USE___CXA_ATEXIT macro.
	* docs/html/ext/mt_allocator.html: Add note about deallocation.
	* testsuite/ext/mt_allocator/deallocate_local-2.cc: Guard checks
	with _GLIBCXX_USE___CXA_ATEXIT.
	* testsuite/ext/mt_allocator/deallocate_global_thread-3.cc: Same.
	* testsuite/ext/mt_allocator/deallocate_global_thread-1.cc: Same.
	* testsuite/ext/mt_allocator/deallocate_global-4.cc: Same.
	* testsuite/ext/mt_allocator/deallocate_global-2.cc: Same.
	* testsuite/ext/mt_allocator/deallocate_local_thread-3.cc: Same.
	* testsuite/ext/mt_allocator/deallocate_local_thread-1.cc: Same.
	* testsuite/ext/mt_allocator/deallocate_local-4.cc: Same.

From-SVN: r88809
This commit is contained in:
Benjamin Kosnik 2004-10-09 02:30:10 +00:00 committed by Benjamin Kosnik
parent a5df984b5f
commit c3e7f18406
16 changed files with 108 additions and 10 deletions

View File

@ -1,3 +1,22 @@
2004-10-08 Benjamin Kosnik <bkoz@redhat.com>
* acconfig.h: Add _GLIBCXX_USE___CXA_ATEXIT.
* acinclude.m4 (GLIBCXX_ENABLE_CXA_ATEXIT): New.
* configure.ac: Call GLIBCXX_ENABLE_CXA_EXIT.
* configure: Regenerate.
* src/mt_allocator.cc (__pool::~__pool): Make conditional on
_GLIBCXX_USE___CXA_ATEXIT macro.
* docs/html/ext/mt_allocator.html: Add note about deallocation.
* testsuite/ext/mt_allocator/deallocate_local-2.cc: Guard checks
with _GLIBCXX_USE___CXA_ATEXIT.
* testsuite/ext/mt_allocator/deallocate_global_thread-3.cc: Same.
* testsuite/ext/mt_allocator/deallocate_global_thread-1.cc: Same.
* testsuite/ext/mt_allocator/deallocate_global-4.cc: Same.
* testsuite/ext/mt_allocator/deallocate_global-2.cc: Same.
* testsuite/ext/mt_allocator/deallocate_local_thread-3.cc: Same.
* testsuite/ext/mt_allocator/deallocate_local_thread-1.cc: Same.
* testsuite/ext/mt_allocator/deallocate_local-4.cc: Same.
2004-10-07 Phil Edwards <phil@codesourcery.com>
* testsuite/lib/libstdc++.exp: Update list of undefined functions.

View File

@ -28,6 +28,9 @@
// Define to use concept checking code from the boost libraries.
#undef _GLIBCXX_CONCEPT_CHECKS
// Define to use __cxa_atexit.
#undef _GLIBCXX_USE___CXA_ATEXIT
// Define to use symbol versioning in the shared library.
#undef _GLIBCXX_SYMVER

View File

@ -611,6 +611,21 @@ AC_DEFUN([GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING], [
fi
])
dnl
dnl Check for --enable-__cxa_atexit
dnl
dnl --enable-__cxa_atexit defines _GLIBCXX_USE___CXA_ATEXIT
dnl --disable-__cxa_atexit doesn't define _GLIBCXX_USE___CXA_ATEXIT
dnl + Usage: GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING[(DEFAULT)]
dnl Where DEFAULT is either `yes' or `no'.
dnl
AC_DEFUN([GLIBCXX_ENABLE_CXA_ATEXIT], [
GLIBCXX_ENABLE(__cxa_atexit,$1,,
[Define if __cxa_atexit is to be used instead of atexit.])
if test $enable___cxa_atexit = yes; then
AC_DEFINE(_GLIBCXX_USE___CXA_ATEXIT)
fi
])
dnl
dnl Does any necessary configuration of the testsuite directory. Generates

View File

@ -29,6 +29,9 @@
// Define to use concept checking code from the boost libraries.
#undef _GLIBCXX_CONCEPT_CHECKS
// Define to use __cxa_atexit.
#undef _GLIBCXX_USE___CXA_ATEXIT
// Define to use symbol versioning in the shared library.
#undef _GLIBCXX_SYMVER

View File

@ -856,6 +856,8 @@ Optional Features:
--enable-sjlj-exceptions
force use of builtin_setjmp for exceptions
[default=auto]
--enable-__cxa_atexit Define if __cxa_atexit is to be used instead of
atexit. [default=no]
--enable-libstdcxx-pch build pre-compiled libstdc++ headers
[default=$is_hosted]
--enable-cstdio=PACKAGE use target-specific I/O package
@ -4397,7 +4399,7 @@ test x"$pic_mode" = xno && libtool_flags="$libtool_flags --prefer-non-pic"
case $host in
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 4400 "configure"' > conftest.$ac_ext
echo '#line 4402 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@ -5018,7 +5020,7 @@ fi;
#
# Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style.
cat > conftest.$ac_ext << EOF
#line 5021 "configure"
#line 5023 "configure"
struct S { ~S(); };
void bar();
void foo()
@ -5074,6 +5076,29 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
echo "${ECHO_T}$ac_exception_model_name" >&6
# Check whether --enable-__cxa_atexit or --disable-__cxa_atexit was given.
if test "${enable___cxa_atexit+set}" = set; then
enableval="$enable___cxa_atexit"
case "$enableval" in
yes|no) ;;
*) { { echo "$as_me:$LINENO: error: Argument to enable/disable __cxa_atexit must be yes or no" >&5
echo "$as_me: error: Argument to enable/disable __cxa_atexit must be yes or no" >&2;}
{ (exit 1); exit 1; }; } ;;
esac
else
enable___cxa_atexit=no
fi;
if test $enable___cxa_atexit = yes; then
cat >>confdefs.h <<\_ACEOF
#define _GLIBCXX_USE___CXA_ATEXIT 1
_ACEOF
fi
echo "$as_me:$LINENO: checking for enabled PCH" >&5
echo $ECHO_N "checking for enabled PCH... $ECHO_C" >&6
# Check whether --enable-libstdcxx-pch or --disable-libstdcxx-pch was given.

View File

@ -78,6 +78,7 @@ GLIBCXX_ENABLE_HOSTED
# Check for support bits and g++ features that don't require linking.
GLIBCXX_ENABLE_SJLJ_EXCEPTIONS
GLIBCXX_ENABLE_CXA_ATEXIT([no])
GLIBCXX_ENABLE_PCH($is_hosted)
# Enable all the variable C++ runtime options.

View File

@ -265,14 +265,26 @@ The _S_initialize() function:
I.e. _S_bin[ n ].free[ n ] = 0;
</p>
<p>
- Initialize the mutex of each bin_record:
The bin_record-&gt;mutex is used to protect the global freelist. This concept
of a global freelist is explained in more detail in the section
"A multi threaded example", but basically this mutex is locked whenever
a block of memory is retrieved or returned to the global freelist for this
specific bin. This only occurs when a number of blocks are grabbed from the
global list to a thread specific list or when a thread decides to return
some blocks to the global freelist.
- Initialize the mutex of each bin_record: The bin_record-&gt;mutex
is used to protect the global freelist. This concept of a global
freelist is explained in more detail in the section "A multi
threaded example", but basically this mutex is locked whenever a
block of memory is retrieved or returned to the global freelist
for this specific bin. This only occurs when a number of blocks
are grabbed from the global list to a thread specific list or when
a thread decides to return some blocks to the global freelist.
</p>
<p> Notes about deallocation. On systems with the function
<code>__cxa_atexit</code>, the allocator will free all memory
allocated before program termination. However, because this relies on
the precise and exactly-conforming ordering of static destructors,
including those of a static local <code>__pool</code> object, it is
not available on systems that don't have the necessary underlying
support. On those systems, memory debugging programs like valgrind or
purify may notice leaks: sorry about this inconvenience. However, most
operating systems actually reclaim this memory at program termination
anyway.
</p>
<h3 class="left">

View File

@ -48,6 +48,7 @@ namespace __gnu_cxx
{
__pool<false>::~__pool()
{
#ifdef _GLIBCXX_USE___CXA_ATEXIT
if (_M_init && !_M_options._M_force_new)
{
for (size_t __n = 0; __n < _M_bin_size; ++__n)
@ -65,6 +66,7 @@ namespace __gnu_cxx
delete _M_bin;
delete _M_binmap;
}
#endif
}
void
@ -174,6 +176,7 @@ namespace __gnu_cxx
#ifdef __GTHREADS
__pool<true>::~__pool()
{
#ifdef _GLIBCXX_USE___CXA_ATEXIT
if (_M_init && !_M_options._M_force_new)
{
if (__gthread_active_p())
@ -213,6 +216,7 @@ namespace __gnu_cxx
delete _M_bin;
delete _M_binmap;
}
#endif
}
void

View File

@ -31,8 +31,10 @@ struct count_check
count_check() {}
~count_check()
{
#ifdef _GLIBCXX_USE___CXA_ATEXIT
if (count != 0)
throw std::exception();
#endif
}
};

View File

@ -31,8 +31,10 @@ struct count_check
count_check() {}
~count_check()
{
#ifdef _GLIBCXX_USE___CXA_ATEXIT
if (count != 0)
throw std::runtime_error("count isn't zero");
#endif
}
};

View File

@ -31,8 +31,10 @@ struct count_check
count_check() {}
~count_check()
{
#ifdef _GLIBCXX_USE___CXA_ATEXIT
if (count != 0)
throw std::runtime_error("count isn't zero");
#endif
}
};

View File

@ -31,8 +31,10 @@ struct count_check
count_check() {}
~count_check()
{
#ifdef _GLIBCXX_USE___CXA_ATEXIT
if (count != 0)
throw std::runtime_error("count isn't zero");
#endif
}
};

View File

@ -31,8 +31,10 @@ struct count_check
count_check() {}
~count_check()
{
#ifdef _GLIBCXX_USE___CXA_ATEXIT
if (count != 0)
throw std::runtime_error("count isn't zero");
#endif
}
};

View File

@ -31,8 +31,10 @@ struct count_check
count_check() {}
~count_check()
{
#ifdef _GLIBCXX_USE___CXA_ATEXIT
if (count != 0)
throw std::runtime_error("count isn't zero");
#endif
}
};

View File

@ -31,8 +31,10 @@ struct count_check
count_check() {}
~count_check()
{
#ifdef _GLIBCXX_USE___CXA_ATEXIT
if (count != 0)
throw std::runtime_error("count isn't zero");
#endif
}
};

View File

@ -31,8 +31,10 @@ struct count_check
count_check() {}
~count_check()
{
#ifdef _GLIBCXX_USE___CXA_ATEXIT
if (count != 0)
throw std::runtime_error("count isn't zero");
#endif
}
};