acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Remove size-specific macros.
2011-11-30 Benjamin Kosnik <bkoz@redhat.com> * acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Remove size-specific macros. _GLIBCXX_ATOMIC_BUILTINS_1, _GLIBCXX_ATOMIC_BUILTINS_2, _GLIBCXX_ATOMIC_BUILTINS_4, _GLIBCXX_ATOMIC_BUILTINS_8. Use _GLIBCXX_ATOMIC_BUILTINS to indicate use of C++11 atomic builtins. * config.h.in: Regenerate. * configure: Regenerate. * include/Makefile.am (bits_sup_headers): Add atomic_lockfree_defines.h. * include/Makefile.in: Regenerate. * libsupc++/Makefile.am: Compile C++11 support with -std=gnu++0x. * libsupc++/Makefile.in: Regenerate. * include/bits/atomic_base.h: Move lock-free property macros... * libsupc++/atomic_lockfree_defines.h: ...here. * include/std/future: Use C++11 macros. * libsupc++/eh_ptr.cc: Same. * libsupc++/eh_throw.cc: Same. * libsupc++/exception: Same. * libsupc++/exception_ptr.h: Same. * libsupc++/guard.cc: Same. * libsupc++/nested_exception.cc: Same. * libsupc++/nested_exception.h: Same. * src/future.cc: Same. * include/ext/atomicity.h: Use _GLIBCXX_ATOMIC_BUILTINS. * doc/doxygen/user.cfg.in * doc/xml/manual/concurrency_extensions.xml * testsuite/18_support/exception_ptr/lifespan.cc * testsuite/lib/libstdc++.exp From-SVN: r181869
This commit is contained in:
parent
de21ce7fa8
commit
a152e96f01
24 changed files with 200 additions and 140 deletions
|
@ -1,3 +1,37 @@
|
|||
2011-11-30 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* acinclude.m4 (GLIBCXX_ENABLE_ATOMIC_BUILTINS): Remove
|
||||
size-specific macros. _GLIBCXX_ATOMIC_BUILTINS_1,
|
||||
_GLIBCXX_ATOMIC_BUILTINS_2, _GLIBCXX_ATOMIC_BUILTINS_4,
|
||||
_GLIBCXX_ATOMIC_BUILTINS_8. Use _GLIBCXX_ATOMIC_BUILTINS to
|
||||
indicate use of C++11 atomic builtins.
|
||||
* config.h.in: Regenerate.
|
||||
* configure: Regenerate.
|
||||
* include/Makefile.am (bits_sup_headers): Add atomic_lockfree_defines.h.
|
||||
* include/Makefile.in: Regenerate.
|
||||
* libsupc++/Makefile.am: Compile C++11 support with -std=gnu++0x.
|
||||
* libsupc++/Makefile.in: Regenerate.
|
||||
|
||||
* include/bits/atomic_base.h: Move lock-free property macros...
|
||||
* libsupc++/atomic_lockfree_defines.h: ...here.
|
||||
* include/std/future: Use C++11 macros.
|
||||
* libsupc++/eh_ptr.cc: Same.
|
||||
* libsupc++/eh_throw.cc: Same.
|
||||
* libsupc++/exception: Same.
|
||||
* libsupc++/exception_ptr.h: Same.
|
||||
* libsupc++/guard.cc: Same.
|
||||
* libsupc++/nested_exception.cc: Same.
|
||||
* libsupc++/nested_exception.h: Same.
|
||||
* src/future.cc: Same.
|
||||
|
||||
* include/ext/atomicity.h: Use _GLIBCXX_ATOMIC_BUILTINS.
|
||||
|
||||
* doc/doxygen/user.cfg.in
|
||||
* doc/xml/manual/concurrency_extensions.xml
|
||||
|
||||
* testsuite/18_support/exception_ptr/lifespan.cc
|
||||
* testsuite/lib/libstdc++.exp
|
||||
|
||||
2011-11-29 François Dumont <fdumont@gcc.gnu.org>
|
||||
|
||||
* include/bits/hashtable.h (_Hashtable<>::_M_rehash): Remove code
|
||||
|
|
|
@ -2683,12 +2683,6 @@ dnl
|
|||
dnl Note:
|
||||
dnl libgomp and libgfortran use a link test, see CHECK_SYNC_FETCH_AND_ADD.
|
||||
dnl
|
||||
dnl Defines:
|
||||
dnl _GLIBCXX_ATOMIC_BUILTINS_1
|
||||
dnl _GLIBCXX_ATOMIC_BUILTINS_2
|
||||
dnl _GLIBCXX_ATOMIC_BUILTINS_4
|
||||
dnl _GLIBCXX_ATOMIC_BUILTINS_8
|
||||
dnl
|
||||
AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
|
@ -2729,10 +2723,6 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
|
|||
[glibcxx_cv_atomic_bool=yes],
|
||||
[glibcxx_cv_atomic_bool=no])
|
||||
])
|
||||
if test $glibcxx_cv_atomic_bool = yes; then
|
||||
AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
|
||||
[Define if builtin atomic operations for bool are supported on this host.])
|
||||
fi
|
||||
AC_MSG_RESULT($glibcxx_cv_atomic_bool)
|
||||
|
||||
AC_MSG_CHECKING([for atomic builtins for short])
|
||||
|
@ -2751,10 +2741,6 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
|
|||
[glibcxx_cv_atomic_short=yes],
|
||||
[glibcxx_cv_atomic_short=no])
|
||||
])
|
||||
if test $glibcxx_cv_atomic_short = yes; then
|
||||
AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
|
||||
[Define if builtin atomic operations for short are supported on this host.])
|
||||
fi
|
||||
AC_MSG_RESULT($glibcxx_cv_atomic_short)
|
||||
|
||||
AC_MSG_CHECKING([for atomic builtins for int])
|
||||
|
@ -2773,10 +2759,6 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
|
|||
[glibcxx_cv_atomic_int=yes],
|
||||
[glibcxx_cv_atomic_int=no])
|
||||
])
|
||||
if test $glibcxx_cv_atomic_int = yes; then
|
||||
AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1,
|
||||
[Define if builtin atomic operations for int are supported on this host.])
|
||||
fi
|
||||
AC_MSG_RESULT($glibcxx_cv_atomic_int)
|
||||
|
||||
AC_MSG_CHECKING([for atomic builtins for long long])
|
||||
|
@ -2795,10 +2777,6 @@ AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
|
|||
[glibcxx_cv_atomic_long_long=yes],
|
||||
[glibcxx_cv_atomic_long_long=no])
|
||||
])
|
||||
if test $glibcxx_cv_atomic_long_long = yes; then
|
||||
AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
|
||||
[Define if builtin atomic operations for long long are supported on this host.])
|
||||
fi
|
||||
AC_MSG_RESULT($glibcxx_cv_atomic_long_long)
|
||||
|
||||
else
|
||||
|
@ -2832,8 +2810,6 @@ EOF
|
|||
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
|
||||
glibcxx_cv_atomic_bool=no
|
||||
else
|
||||
AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
|
||||
[Define if builtin atomic operations for bool are supported on this host.])
|
||||
glibcxx_cv_atomic_bool=yes
|
||||
fi
|
||||
fi
|
||||
|
@ -2862,8 +2838,6 @@ EOF
|
|||
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
|
||||
glibcxx_cv_atomic_short=no
|
||||
else
|
||||
AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
|
||||
[Define if builtin atomic operations for short are supported on this host.])
|
||||
glibcxx_cv_atomic_short=yes
|
||||
fi
|
||||
fi
|
||||
|
@ -2893,8 +2867,6 @@ EOF
|
|||
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
|
||||
glibcxx_cv_atomic_int=no
|
||||
else
|
||||
AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1,
|
||||
[Define if builtin atomic operations for int are supported on this host.])
|
||||
glibcxx_cv_atomic_int=yes
|
||||
fi
|
||||
fi
|
||||
|
@ -2923,8 +2895,6 @@ EOF
|
|||
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
|
||||
glibcxx_cv_atomic_long_long=no
|
||||
else
|
||||
AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
|
||||
[Define if builtin atomic operations for long long are supported on this host.])
|
||||
glibcxx_cv_atomic_long_long=yes
|
||||
fi
|
||||
fi
|
||||
|
@ -2938,6 +2908,8 @@ EOF
|
|||
|
||||
# Set atomicity_dir to builtins if either of above tests pass.
|
||||
if test $glibcxx_cv_atomic_int = yes || test $glibcxx_cv_atomic_bool = yes ; then
|
||||
AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS, 1,
|
||||
[Define if the compiler supports C++11 atomics.])
|
||||
atomicity_dir=cpu/generic/atomicity_builtins
|
||||
fi
|
||||
|
||||
|
|
|
@ -689,19 +689,8 @@
|
|||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define if builtin atomic operations for bool are supported on this host. */
|
||||
#undef _GLIBCXX_ATOMIC_BUILTINS_1
|
||||
|
||||
/* Define if builtin atomic operations for short are supported on this host.
|
||||
*/
|
||||
#undef _GLIBCXX_ATOMIC_BUILTINS_2
|
||||
|
||||
/* Define if builtin atomic operations for int are supported on this host. */
|
||||
#undef _GLIBCXX_ATOMIC_BUILTINS_4
|
||||
|
||||
/* Define if builtin atomic operations for long long are supported on this
|
||||
host. */
|
||||
#undef _GLIBCXX_ATOMIC_BUILTINS_8
|
||||
/* Define if the compiler supports C++11 atomics. */
|
||||
#undef _GLIBCXX_ATOMIC_BUILTINS
|
||||
|
||||
/* Define to use concept checking code from the boost libraries. */
|
||||
#undef _GLIBCXX_CONCEPT_CHECKS
|
||||
|
|
49
libstdc++-v3/configure
vendored
49
libstdc++-v3/configure
vendored
|
@ -15147,11 +15147,6 @@ rm -f core conftest.err conftest.$ac_objext \
|
|||
|
||||
fi
|
||||
|
||||
if test $glibcxx_cv_atomic_bool = yes; then
|
||||
|
||||
$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_1 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_atomic_bool" >&5
|
||||
$as_echo "$glibcxx_cv_atomic_bool" >&6; }
|
||||
|
||||
|
@ -15193,11 +15188,6 @@ rm -f core conftest.err conftest.$ac_objext \
|
|||
|
||||
fi
|
||||
|
||||
if test $glibcxx_cv_atomic_short = yes; then
|
||||
|
||||
$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_2 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_atomic_short" >&5
|
||||
$as_echo "$glibcxx_cv_atomic_short" >&6; }
|
||||
|
||||
|
@ -15239,11 +15229,6 @@ rm -f core conftest.err conftest.$ac_objext \
|
|||
|
||||
fi
|
||||
|
||||
if test $glibcxx_cv_atomic_int = yes; then
|
||||
|
||||
$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_4 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_atomic_int" >&5
|
||||
$as_echo "$glibcxx_cv_atomic_int" >&6; }
|
||||
|
||||
|
@ -15285,11 +15270,6 @@ rm -f core conftest.err conftest.$ac_objext \
|
|||
|
||||
fi
|
||||
|
||||
if test $glibcxx_cv_atomic_long_long = yes; then
|
||||
|
||||
$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_8 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_atomic_long_long" >&5
|
||||
$as_echo "$glibcxx_cv_atomic_long_long" >&6; }
|
||||
|
||||
|
@ -15303,7 +15283,7 @@ $as_echo "$glibcxx_cv_atomic_long_long" >&6; }
|
|||
# Fake what AC_TRY_COMPILE does.
|
||||
|
||||
cat > conftest.$ac_ext << EOF
|
||||
#line 15306 "configure"
|
||||
#line 15286 "configure"
|
||||
int main()
|
||||
{
|
||||
typedef bool atomic_type;
|
||||
|
@ -15329,9 +15309,6 @@ $as_echo_n "checking for atomic builtins for bool... " >&6; }
|
|||
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
|
||||
glibcxx_cv_atomic_bool=no
|
||||
else
|
||||
|
||||
$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_1 1" >>confdefs.h
|
||||
|
||||
glibcxx_cv_atomic_bool=yes
|
||||
fi
|
||||
fi
|
||||
|
@ -15340,7 +15317,7 @@ $as_echo "$glibcxx_cv_atomic_bool" >&6; }
|
|||
rm -f conftest*
|
||||
|
||||
cat > conftest.$ac_ext << EOF
|
||||
#line 15343 "configure"
|
||||
#line 15320 "configure"
|
||||
int main()
|
||||
{
|
||||
typedef short atomic_type;
|
||||
|
@ -15366,9 +15343,6 @@ $as_echo_n "checking for atomic builtins for short... " >&6; }
|
|||
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
|
||||
glibcxx_cv_atomic_short=no
|
||||
else
|
||||
|
||||
$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_2 1" >>confdefs.h
|
||||
|
||||
glibcxx_cv_atomic_short=yes
|
||||
fi
|
||||
fi
|
||||
|
@ -15377,7 +15351,7 @@ $as_echo "$glibcxx_cv_atomic_short" >&6; }
|
|||
rm -f conftest*
|
||||
|
||||
cat > conftest.$ac_ext << EOF
|
||||
#line 15380 "configure"
|
||||
#line 15354 "configure"
|
||||
int main()
|
||||
{
|
||||
// NB: _Atomic_word not necessarily int.
|
||||
|
@ -15404,9 +15378,6 @@ $as_echo_n "checking for atomic builtins for int... " >&6; }
|
|||
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
|
||||
glibcxx_cv_atomic_int=no
|
||||
else
|
||||
|
||||
$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_4 1" >>confdefs.h
|
||||
|
||||
glibcxx_cv_atomic_int=yes
|
||||
fi
|
||||
fi
|
||||
|
@ -15415,7 +15386,7 @@ $as_echo "$glibcxx_cv_atomic_int" >&6; }
|
|||
rm -f conftest*
|
||||
|
||||
cat > conftest.$ac_ext << EOF
|
||||
#line 15418 "configure"
|
||||
#line 15389 "configure"
|
||||
int main()
|
||||
{
|
||||
typedef long long atomic_type;
|
||||
|
@ -15441,9 +15412,6 @@ $as_echo_n "checking for atomic builtins for long long... " >&6; }
|
|||
if grep __sync_ conftest.s >/dev/null 2>&1 ; then
|
||||
glibcxx_cv_atomic_long_long=no
|
||||
else
|
||||
|
||||
$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS_8 1" >>confdefs.h
|
||||
|
||||
glibcxx_cv_atomic_long_long=yes
|
||||
fi
|
||||
fi
|
||||
|
@ -15463,6 +15431,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
|||
|
||||
# Set atomicity_dir to builtins if either of above tests pass.
|
||||
if test $glibcxx_cv_atomic_int = yes || test $glibcxx_cv_atomic_bool = yes ; then
|
||||
|
||||
$as_echo "#define _GLIBCXX_ATOMIC_BUILTINS 1" >>confdefs.h
|
||||
|
||||
atomicity_dir=cpu/generic/atomicity_builtins
|
||||
fi
|
||||
|
||||
|
@ -15491,7 +15462,7 @@ $as_echo "$as_me: WARNING: Performance of certain classes will degrade as a resu
|
|||
# unnecessary for this test.
|
||||
|
||||
cat > conftest.$ac_ext << EOF
|
||||
#line 15494 "configure"
|
||||
#line 15465 "configure"
|
||||
int main()
|
||||
{
|
||||
_Decimal32 d1;
|
||||
|
@ -15533,7 +15504,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
|||
# unnecessary for this test.
|
||||
|
||||
cat > conftest.$ac_ext << EOF
|
||||
#line 15536 "configure"
|
||||
#line 15507 "configure"
|
||||
template<typename T1, typename T2>
|
||||
struct same
|
||||
{ typedef T2 type; };
|
||||
|
@ -15567,7 +15538,7 @@ $as_echo "$enable_int128" >&6; }
|
|||
rm -f conftest*
|
||||
|
||||
cat > conftest.$ac_ext << EOF
|
||||
#line 15570 "configure"
|
||||
#line 15541 "configure"
|
||||
template<typename T1, typename T2>
|
||||
struct same
|
||||
{ typedef T2 type; };
|
||||
|
|
|
@ -1645,10 +1645,6 @@ PREDEFINED = __cplusplus \
|
|||
_GLIBCXX_USE_WCHAR_T \
|
||||
_GLIBCXX_USE_LONG_LONG \
|
||||
_GLIBCXX_USE_C99_STDINT_TR1 \
|
||||
_GLIBCXX_ATOMIC_BUILTINS_1 \
|
||||
_GLIBCXX_ATOMIC_BUILTINS_2 \
|
||||
_GLIBCXX_ATOMIC_BUILTINS_4 \
|
||||
_GLIBCXX_ATOMIC_BUILTINS_8 \
|
||||
_GLIBCXX_USE_SCHED_YIELD \
|
||||
_GLIBCXX_USE_NANOSLEEP \
|
||||
PB_DS_DATA_TRUE_INDICATOR \
|
||||
|
|
|
@ -210,11 +210,19 @@ usage vary depending on the target hardware and the flags used during
|
|||
compile.
|
||||
</para>
|
||||
|
||||
|
||||
|
||||
<para>
|
||||
<remark>
|
||||
Incomplete/inconsistent. This is only C++11.
|
||||
</remark>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If builtins are possible for bool-sized integral types,
|
||||
<code>_GLIBCXX_ATOMIC_BUILTINS_1</code> will be defined.
|
||||
<code>ATOMIC_BOOL_LOCK_FREE</code> will be defined.
|
||||
If builtins are possible for int-sized integral types,
|
||||
<code>_GLIBCXX_ATOMIC_BUILTINS_4</code> will be defined.
|
||||
<code>ATOMIC_INT_LOCK_FREE</code> will be defined.
|
||||
</para>
|
||||
|
||||
|
||||
|
|
|
@ -177,6 +177,7 @@ bits_headers = \
|
|||
|
||||
bits_sup_srcdir = ${glibcxx_srcdir}/libsupc++
|
||||
bits_sup_headers = \
|
||||
${bits_sup_srcdir}/atomic_lockfree_defines.h \
|
||||
${bits_sup_srcdir}/cxxabi_forced.h \
|
||||
${bits_sup_srcdir}/exception_defines.h \
|
||||
${bits_sup_srcdir}/exception_ptr.h \
|
||||
|
|
|
@ -429,6 +429,7 @@ bits_headers = \
|
|||
|
||||
bits_sup_srcdir = ${glibcxx_srcdir}/libsupc++
|
||||
bits_sup_headers = \
|
||||
${bits_sup_srcdir}/atomic_lockfree_defines.h \
|
||||
${bits_sup_srcdir}/cxxabi_forced.h \
|
||||
${bits_sup_srcdir}/exception_defines.h \
|
||||
${bits_sup_srcdir}/exception_ptr.h \
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <bits/c++config.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <bits/atomic_lockfree_defines.h>
|
||||
|
||||
namespace std _GLIBCXX_VISIBILITY(default)
|
||||
{
|
||||
|
@ -70,15 +71,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
|
||||
inline void
|
||||
atomic_thread_fence(memory_order __m) noexcept
|
||||
{
|
||||
__atomic_thread_fence (__m);
|
||||
}
|
||||
{ __atomic_thread_fence(__m); }
|
||||
|
||||
inline void
|
||||
atomic_signal_fence(memory_order __m) noexcept
|
||||
{
|
||||
__atomic_thread_fence (__m);
|
||||
}
|
||||
{ __atomic_thread_fence(__m); }
|
||||
|
||||
/// kill_dependency
|
||||
template<typename _Tp>
|
||||
|
@ -89,19 +86,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
return __ret;
|
||||
}
|
||||
|
||||
/// Lock-free Property
|
||||
|
||||
|
||||
#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
|
||||
#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
|
||||
#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE
|
||||
#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
|
||||
#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE
|
||||
#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE
|
||||
#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE
|
||||
#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE
|
||||
#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
|
||||
#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
|
||||
|
||||
// Base types for atomics.
|
||||
template<typename _IntTp>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// Support for atomic operations -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010
|
||||
// Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011
|
||||
// Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
|
@ -42,7 +42,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
// To abstract locking primitives across all thread policies, use:
|
||||
// __exchange_and_add_dispatch
|
||||
// __atomic_add_dispatch
|
||||
#ifdef _GLIBCXX_ATOMIC_BUILTINS_4
|
||||
#ifdef _GLIBCXX_ATOMIC_BUILTINS
|
||||
static inline _Atomic_word
|
||||
__exchange_and_add(volatile _Atomic_word* __mem, int __val)
|
||||
{ return __sync_fetch_and_add(__mem, __val); }
|
||||
|
|
|
@ -187,7 +187,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
async(_Fn&& __fn, _Args&&... __args);
|
||||
|
||||
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
|
||||
&& defined(_GLIBCXX_ATOMIC_BUILTINS_4)
|
||||
&& (ATOMIC_INT_LOCK_FREE > 1)
|
||||
|
||||
/// Base class and enclosing scope.
|
||||
struct __future_base
|
||||
|
@ -1493,7 +1493,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
}
|
||||
|
||||
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
|
||||
// && _GLIBCXX_ATOMIC_BUILTINS_4
|
||||
// && ATOMIC_INT_LOCK_FREE
|
||||
|
||||
// @} group futures
|
||||
_GLIBCXX_END_NAMESPACE_VERSION
|
||||
|
|
|
@ -35,8 +35,8 @@ std_HEADERS = \
|
|||
cxxabi.h exception initializer_list new typeinfo
|
||||
|
||||
bits_HEADERS = \
|
||||
cxxabi_forced.h hash_bytes.h \
|
||||
exception_defines.h exception_ptr.h nested_exception.h
|
||||
atomic_lockfree_defines.h cxxabi_forced.h \
|
||||
exception_defines.h exception_ptr.h hash_bytes.h nested_exception.h
|
||||
|
||||
headers = $(std_HEADERS) $(bits_HEADERS)
|
||||
|
||||
|
@ -136,6 +136,22 @@ cp-demangle.o: cp-demangle.c
|
|||
$(C_COMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
|
||||
|
||||
|
||||
# Use special rules for the C++0x sources so that the proper flags are passed.
|
||||
eh_ptr.lo: eh_ptr.cc
|
||||
$(LTCXXCOMPILE) -std=gnu++0x -c $<
|
||||
eh_ptr.o: eh_ptr.cc
|
||||
$(CXXCOMPILE) -std=gnu++0x -c $<
|
||||
|
||||
eh_throw.lo: eh_throw.cc
|
||||
$(LTCXXCOMPILE) -std=gnu++0x -c $<
|
||||
eh_throw.o: eh_throw.cc
|
||||
$(CXXCOMPILE) -std=gnu++0x -c $<
|
||||
|
||||
guard.lo: guard.cc
|
||||
$(LTCXXCOMPILE) -std=gnu++0x -c $<
|
||||
guard.o: guard.cc
|
||||
$(CXXCOMPILE) -std=gnu++0x -c $<
|
||||
|
||||
nested_exception.lo: nested_exception.cc
|
||||
$(LTCXXCOMPILE) -std=gnu++0x -c $<
|
||||
nested_exception.o: nested_exception.cc
|
||||
|
|
|
@ -346,8 +346,8 @@ std_HEADERS = \
|
|||
cxxabi.h exception initializer_list new typeinfo
|
||||
|
||||
bits_HEADERS = \
|
||||
cxxabi_forced.h hash_bytes.h \
|
||||
exception_defines.h exception_ptr.h nested_exception.h
|
||||
atomic_lockfree_defines.h cxxabi_forced.h \
|
||||
exception_defines.h exception_ptr.h hash_bytes.h nested_exception.h
|
||||
|
||||
headers = $(std_HEADERS) $(bits_HEADERS)
|
||||
@GLIBCXX_HOSTED_TRUE@c_sources = \
|
||||
|
@ -770,6 +770,22 @@ cp-demangle.lo: cp-demangle.c
|
|||
cp-demangle.o: cp-demangle.c
|
||||
$(C_COMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
|
||||
|
||||
# Use special rules for the C++0x sources so that the proper flags are passed.
|
||||
eh_ptr.lo: eh_ptr.cc
|
||||
$(LTCXXCOMPILE) -std=gnu++0x -c $<
|
||||
eh_ptr.o: eh_ptr.cc
|
||||
$(CXXCOMPILE) -std=gnu++0x -c $<
|
||||
|
||||
eh_throw.lo: eh_throw.cc
|
||||
$(LTCXXCOMPILE) -std=gnu++0x -c $<
|
||||
eh_throw.o: eh_throw.cc
|
||||
$(CXXCOMPILE) -std=gnu++0x -c $<
|
||||
|
||||
guard.lo: guard.cc
|
||||
$(LTCXXCOMPILE) -std=gnu++0x -c $<
|
||||
guard.o: guard.cc
|
||||
$(CXXCOMPILE) -std=gnu++0x -c $<
|
||||
|
||||
nested_exception.lo: nested_exception.cc
|
||||
$(LTCXXCOMPILE) -std=gnu++0x -c $<
|
||||
nested_exception.o: nested_exception.cc
|
||||
|
|
63
libstdc++-v3/libsupc++/atomic_lockfree_defines.h
Normal file
63
libstdc++-v3/libsupc++/atomic_lockfree_defines.h
Normal file
|
@ -0,0 +1,63 @@
|
|||
// -*- C++ -*- header.
|
||||
|
||||
// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of the GNU ISO C++ Library. This library is free
|
||||
// software; you can redistribute it and/or modify it under the
|
||||
// terms of the GNU General Public License as published by the
|
||||
// Free Software Foundation; either version 3, or (at your option)
|
||||
// any later version.
|
||||
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// Under Section 7 of GPL version 3, you are granted additional
|
||||
// permissions described in the GCC Runtime Library Exception, version
|
||||
// 3.1, as published by the Free Software Foundation.
|
||||
|
||||
// You should have received a copy of the GNU General Public License and
|
||||
// a copy of the GCC Runtime Library Exception along with this program;
|
||||
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
||||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
/** @file bits/atomic_lockfree_defines.h
|
||||
* This is an internal header file, included by other library headers.
|
||||
* Do not attempt to use it directly. @headername{atomic}
|
||||
*/
|
||||
|
||||
#ifndef _GLIBCXX_ATOMIC_LOCK_FREE_H
|
||||
#define _GLIBCXX_ATOMIC_LOCK_FREE_H 1
|
||||
|
||||
#pragma GCC system_header
|
||||
|
||||
/**
|
||||
* @addtogroup atomics
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Lock-free property.
|
||||
*
|
||||
* 0 indicates that the types are never lock-free.
|
||||
* 1 indicates that the types are sometimes lock-free.
|
||||
* 2 indicates that the types are always lock-free.
|
||||
*/
|
||||
|
||||
#ifdef __GXX_EXPERIMENTAL_CXX0X__
|
||||
#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
|
||||
#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
|
||||
#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE
|
||||
#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
|
||||
#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE
|
||||
#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE
|
||||
#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE
|
||||
#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE
|
||||
#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
|
||||
#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
|
||||
#endif
|
||||
|
||||
// @} group atomics
|
||||
|
||||
#endif
|
|
@ -1,5 +1,5 @@
|
|||
// -*- C++ -*- Implement the members of exception_ptr.
|
||||
// Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
|
||||
// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
//
|
||||
// This file is part of GCC.
|
||||
//
|
||||
|
@ -23,8 +23,9 @@
|
|||
// <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include <bits/c++config.h>
|
||||
#include <bits/atomic_lockfree_defines.h>
|
||||
|
||||
#ifdef _GLIBCXX_ATOMIC_BUILTINS_4
|
||||
#if ATOMIC_INT_LOCK_FREE > 1
|
||||
|
||||
#define _GLIBCXX_EH_PTR_COMPAT
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ __gxx_exception_cleanup (_Unwind_Reason_Code code, _Unwind_Exception *exc)
|
|||
if (code != _URC_FOREIGN_EXCEPTION_CAUGHT && code != _URC_NO_REASON)
|
||||
__terminate (header->exc.terminateHandler);
|
||||
|
||||
#ifdef _GLIBCXX_ATOMIC_BUILTINS_4
|
||||
#if ATOMIC_INT_LOCK_FREE > 1
|
||||
if (__sync_sub_and_fetch (&header->referenceCount, 1) == 0)
|
||||
{
|
||||
#endif
|
||||
|
@ -51,7 +51,7 @@ __gxx_exception_cleanup (_Unwind_Reason_Code code, _Unwind_Exception *exc)
|
|||
header->exc.exceptionDestructor (header + 1);
|
||||
|
||||
__cxa_free_exception (header + 1);
|
||||
#ifdef _GLIBCXX_ATOMIC_BUILTINS_4
|
||||
#if ATOMIC_INT_LOCK_FREE > 1
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#pragma GCC visibility push(default)
|
||||
|
||||
#include <bits/c++config.h>
|
||||
#include <bits/atomic_lockfree_defines.h>
|
||||
|
||||
extern "C++" {
|
||||
|
||||
|
@ -149,8 +150,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
|
|||
|
||||
#pragma GCC visibility pop
|
||||
|
||||
#if (defined(__GXX_EXPERIMENTAL_CXX0X__) \
|
||||
&& defined(_GLIBCXX_ATOMIC_BUILTINS_4))
|
||||
#if defined(__GXX_EXPERIMENTAL_CXX0X__) && (ATOMIC_INT_LOCK_FREE > 1)
|
||||
#include <bits/exception_ptr.h>
|
||||
#include <bits/nested_exception.h>
|
||||
#endif
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
#include <bits/c++config.h>
|
||||
#include <bits/exception_defines.h>
|
||||
|
||||
#if !defined(_GLIBCXX_ATOMIC_BUILTINS_4)
|
||||
#if ATOMIC_INT_LOCK_FREE < 2
|
||||
# error This platform does not support exception propagation.
|
||||
#endif
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <ext/atomicity.h>
|
||||
#include <ext/concurrence.h>
|
||||
#if defined(__GTHREADS) && defined(__GTHREAD_HAS_COND) \
|
||||
&& defined(_GLIBCXX_ATOMIC_BUILTINS_4) && defined(_GLIBCXX_HAVE_LINUX_FUTEX)
|
||||
&& (ATOMIC_INT_LOCK_FREE > 1) && defined(_GLIBCXX_HAVE_LINUX_FUTEX)
|
||||
# include <climits>
|
||||
# include <syscall.h>
|
||||
# include <unistd.h>
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
namespace std
|
||||
{
|
||||
#ifdef _GLIBCXX_ATOMIC_BUILTINS_4
|
||||
#if ATOMIC_INT_LOCK_FREE > 1
|
||||
nested_exception::~nested_exception() = default;
|
||||
#endif
|
||||
} // namespace std
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
|
||||
#include <bits/c++config.h>
|
||||
|
||||
#if !defined(_GLIBCXX_ATOMIC_BUILTINS_4)
|
||||
#if ATOMIC_INT_LOCK_FREE < 2
|
||||
# error This platform does not support exception propagation.
|
||||
#endif
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
future_error::what() const noexcept { return _M_code.message().c_str(); }
|
||||
|
||||
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
|
||||
&& defined(_GLIBCXX_ATOMIC_BUILTINS_4)
|
||||
&& (ATOMIC_INT_LOCK_FREE > 1)
|
||||
__future_base::_Result_base::_Result_base() = default;
|
||||
|
||||
__future_base::_Result_base::~_Result_base() = default;
|
||||
|
|
|
@ -150,11 +150,14 @@ void test06()
|
|||
|
||||
may_destruct = false;
|
||||
|
||||
try {
|
||||
test06_helper();
|
||||
} catch(...) {
|
||||
may_destruct = true;
|
||||
}
|
||||
try
|
||||
{
|
||||
test06_helper();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
may_destruct = true;
|
||||
}
|
||||
may_destruct = false;
|
||||
}
|
||||
|
||||
|
@ -167,11 +170,14 @@ void test99()
|
|||
|
||||
may_destruct = false;
|
||||
|
||||
try {
|
||||
throw destructing();
|
||||
} catch(...) {
|
||||
gep = current_exception();
|
||||
}
|
||||
try
|
||||
{
|
||||
throw destructing();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
gep = current_exception();
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
|
|
|
@ -1219,14 +1219,16 @@ proc check_v3_target_atomic_builtins { } {
|
|||
set src atomic_builtins[pid].cc
|
||||
|
||||
set f [open $src "w"]
|
||||
puts $f "#include <bits/c++config.h>"
|
||||
puts $f "#ifndef _GLIBCXX_ATOMIC_BUILTINS_4"
|
||||
puts $f "# error No atomic builtins"
|
||||
puts $f "#if __GCC_ATOMIC_BOOL_LOCK_FREE < 2"
|
||||
puts $f "# error No atomic bool"
|
||||
puts $f "#endif"
|
||||
puts $f "#if __GCC_ATOMIC_INT_LOCK_FREE < 2"
|
||||
puts $f "# error No atomic int"
|
||||
puts $f "#endif"
|
||||
close $f
|
||||
|
||||
set cxxflags_saved $cxxflags
|
||||
set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
|
||||
set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror -std=gnu++0x"
|
||||
|
||||
set lines [v3_target_compile $src /dev/null preprocess ""]
|
||||
set cxxflags $cxxflags_saved
|
||||
|
|
Loading…
Add table
Reference in a new issue