re PR libstdc++/53270 (Error when bootstrapping gcc on hppa2.0-unknown-linux-gcc)

PR libstdc++/53270
	* include/ext/concurrence.h (__mutex, __recursive_mutex, __cond): Use
	NSDMI in C++11 mode.
	* include/ext/rope (_Refcount_Base): Likewise. Destroy mutex in
	destructor when initialized by function.

From-SVN: r188637
This commit is contained in:
Jonathan Wakely 2012-06-14 22:20:52 +00:00 committed by Jonathan Wakely
parent 5c8dd62a1b
commit 01f83b7d26
3 changed files with 40 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2012-06-14 Jonathan Wakely <jwakely.gcc@gmail.com>
PR libstdc++/53270
* include/ext/concurrence.h (__mutex, __recursive_mutex, __cond): Use
NSDMI in C++11 mode.
* include/ext/rope (_Refcount_Base): Likewise. Destroy mutex in
destructor when initialized by function.
2012-06-14 Jonathan Wakely <jwakely.gcc@gmail.com> 2012-06-14 Jonathan Wakely <jwakely.gcc@gmail.com>
PR libstdc++/53648 PR libstdc++/53648

View File

@ -143,7 +143,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class __mutex class __mutex
{ {
private: private:
#if __GTHREADS && defined __GTHREAD_MUTEX_INIT \
&& defined __GXX_EXPERIMENTAL_CXX0X__
__gthread_mutex_t _M_mutex = __GTHREAD_MUTEX_INIT;
#else
__gthread_mutex_t _M_mutex; __gthread_mutex_t _M_mutex;
#endif
__mutex(const __mutex&); __mutex(const __mutex&);
__mutex& operator=(const __mutex&); __mutex& operator=(const __mutex&);
@ -155,8 +160,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__gthread_active_p()) if (__gthread_active_p())
{ {
#if defined __GTHREAD_MUTEX_INIT #if defined __GTHREAD_MUTEX_INIT
# ifndef __GXX_EXPERIMENTAL_CXX0X__
__gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT; __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;
_M_mutex = __tmp; _M_mutex = __tmp;
# endif
#else #else
__GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex); __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
#endif #endif
@ -201,7 +208,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class __recursive_mutex class __recursive_mutex
{ {
private: private:
#if __GTHREADS && defined __GTHREAD_RECURSIVE_MUTEX_INIT \
&& defined __GXX_EXPERIMENTAL_CXX0X__
__gthread_recursive_mutex_t _M_mutex = __GTHREAD_RECURSIVE_MUTEX_INIT;
#else
__gthread_recursive_mutex_t _M_mutex; __gthread_recursive_mutex_t _M_mutex;
#endif
__recursive_mutex(const __recursive_mutex&); __recursive_mutex(const __recursive_mutex&);
__recursive_mutex& operator=(const __recursive_mutex&); __recursive_mutex& operator=(const __recursive_mutex&);
@ -213,8 +225,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__gthread_active_p()) if (__gthread_active_p())
{ {
#if defined __GTHREAD_RECURSIVE_MUTEX_INIT #if defined __GTHREAD_RECURSIVE_MUTEX_INIT
# ifndef __GXX_EXPERIMENTAL_CXX0X__
__gthread_recursive_mutex_t __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT; __gthread_recursive_mutex_t __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT;
_M_mutex = __tmp; _M_mutex = __tmp;
# endif
#else #else
__GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex); __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex);
#endif #endif
@ -319,7 +333,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class __cond class __cond
{ {
private: private:
#if __GTHREADS && defined __GTHREAD_COND_INIT \
&& defined __GXX_EXPERIMENTAL_CXX0X__
__gthread_cond_t _M_cond = __GTHREAD_COND_INIT;
#else
__gthread_cond_t _M_cond; __gthread_cond_t _M_cond;
#endif
__cond(const __cond&); __cond(const __cond&);
__cond& operator=(const __cond&); __cond& operator=(const __cond&);
@ -331,8 +350,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__gthread_active_p()) if (__gthread_active_p())
{ {
#if defined __GTHREAD_COND_INIT #if defined __GTHREAD_COND_INIT
# ifndef __GXX_EXPERIMENTAL_CXX0X__
__gthread_cond_t __tmp = __GTHREAD_COND_INIT; __gthread_cond_t __tmp = __GTHREAD_COND_INIT;
_M_cond = __tmp; _M_cond = __tmp;
# endif
#else #else
__GTHREAD_COND_INIT_FUNCTION(&_M_cond); __GTHREAD_COND_INIT_FUNCTION(&_M_cond);
#endif #endif

View File

@ -458,13 +458,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
volatile _RC_t _M_ref_count; volatile _RC_t _M_ref_count;
// Constructor // Constructor
#if defined __GTHREAD_MUTEX_INIT && defined __GXX_EXPERIMENTAL_CXX0X__
__gthread_mutex_t _M_ref_count_lock = __GTHREAD_MUTEX_INIT;
#else
__gthread_mutex_t _M_ref_count_lock; __gthread_mutex_t _M_ref_count_lock;
#endif
_Refcount_Base(_RC_t __n) : _M_ref_count(__n), _M_ref_count_lock() _Refcount_Base(_RC_t __n) : _M_ref_count(__n), _M_ref_count_lock()
{ {
#ifdef __GTHREAD_MUTEX_INIT #ifdef __GTHREAD_MUTEX_INIT
# ifndef __GXX_EXPERIMENTAL_CXX0X__
__gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT; __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;
_M_ref_count_lock = __tmp; _M_ref_count_lock = __tmp;
# endif
#elif defined(__GTHREAD_MUTEX_INIT_FUNCTION) #elif defined(__GTHREAD_MUTEX_INIT_FUNCTION)
__GTHREAD_MUTEX_INIT_FUNCTION (&_M_ref_count_lock); __GTHREAD_MUTEX_INIT_FUNCTION (&_M_ref_count_lock);
#else #else
@ -472,6 +478,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif #endif
} }
#ifndef __GTHREAD_MUTEX_INIT
~_Refcount_Base()
{ __gthread_mutex_destroy(&_M_ref_count_lock); }
#endif
void void
_M_incr() _M_incr()
{ {