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

PR libstdc++/53270
	* include/ext/concurrence.h: Use NSDMI for gthreads types.
	* include/ext/rope: Likewise. Destroy mutexes in destructors. Add
	system_header pragma.

	Revert:
	2012-06-19  Jonathan Wakely  <jwakely.gcc@gmail.com>

	PR libstdc++/53270
	* config/os/gnu-linux/os_defines.h: Disable static initializer macros
	for gthreads types in C++11 mode.

From-SVN: r189555
This commit is contained in:
Jonathan Wakely 2012-07-16 22:34:13 +00:00 committed by Jonathan Wakely
parent 7f45a48547
commit 7868eae9d7
4 changed files with 60 additions and 49 deletions

View File

@ -1,3 +1,17 @@
2012-07-16 Jonathan Wakely <jwakely.gcc@gmail.com>
PR libstdc++/53270
* include/ext/concurrence.h: Use NSDMI for gthreads types.
* include/ext/rope: Likewise. Destroy mutexes in destructors. Add
system_header pragma.
Revert:
2012-06-19 Jonathan Wakely <jwakely.gcc@gmail.com>
PR libstdc++/53270
* config/os/gnu-linux/os_defines.h: Disable static initializer macros
for gthreads types in C++11 mode.
2012-07-16 Jonathan Wakely <jwakely.gcc@gmail.com>
PR libstdc++/53978

View File

@ -46,10 +46,4 @@
# undef _GLIBCXX_HAVE_GETS
#endif
#if defined(__hppa__) && defined(__GXX_EXPERIMENTAL_CXX0X__)
# define _GTHREAD_USE_MUTEX_INIT_FUNC
# define _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
# define _GTHREAD_USE_COND_INIT_FUNC
#endif
#endif

View File

@ -1,6 +1,6 @@
// Support for concurrent programing -*- C++ -*-
// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012
// Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
@ -143,7 +143,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class __mutex
{
private:
#if __GTHREADS && defined __GTHREAD_MUTEX_INIT
__gthread_mutex_t _M_mutex = __GTHREAD_MUTEX_INIT;
#else
__gthread_mutex_t _M_mutex;
#endif
__mutex(const __mutex&);
__mutex& operator=(const __mutex&);
@ -151,17 +155,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
public:
__mutex()
{
#if __GTHREADS
#if __GTHREADS && ! defined __GTHREAD_MUTEX_INIT
if (__gthread_active_p())
{
#if defined __GTHREAD_MUTEX_INIT
__gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;
_M_mutex = __tmp;
#else
__GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
__GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex);
#endif
}
#endif
}
#if __GTHREADS && ! defined __GTHREAD_MUTEX_INIT
@ -201,7 +198,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class __recursive_mutex
{
private:
#if __GTHREADS && defined __GTHREAD_RECURSIVE_MUTEX_INIT
__gthread_recursive_mutex_t _M_mutex = __GTHREAD_RECURSIVE_MUTEX_INIT;
#else
__gthread_recursive_mutex_t _M_mutex;
#endif
__recursive_mutex(const __recursive_mutex&);
__recursive_mutex& operator=(const __recursive_mutex&);
@ -209,17 +210,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
public:
__recursive_mutex()
{
#if __GTHREADS
#if __GTHREADS && ! defined __GTHREAD_RECURSIVE_MUTEX_INIT
if (__gthread_active_p())
{
#if defined __GTHREAD_RECURSIVE_MUTEX_INIT
__gthread_recursive_mutex_t __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT;
_M_mutex = __tmp;
#else
__GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex);
__GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex);
#endif
}
#endif
}
#if __GTHREADS && ! defined __GTHREAD_RECURSIVE_MUTEX_INIT
@ -319,7 +313,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class __cond
{
private:
#if __GTHREADS && defined __GTHREAD_COND_INIT
__gthread_cond_t _M_cond = __GTHREAD_COND_INIT;
#else
__gthread_cond_t _M_cond;
#endif
__cond(const __cond&);
__cond& operator=(const __cond&);
@ -327,17 +325,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
public:
__cond()
{
#if __GTHREADS
#if __GTHREADS && ! defined __GTHREAD_COND_INIT
if (__gthread_active_p())
{
#if defined __GTHREAD_COND_INIT
__gthread_cond_t __tmp = __GTHREAD_COND_INIT;
_M_cond = __tmp;
#else
__GTHREAD_COND_INIT_FUNCTION(&_M_cond);
__GTHREAD_COND_INIT_FUNCTION(&_M_cond);
#endif
}
#endif
}
#if __GTHREADS && ! defined __GTHREAD_COND_INIT

View File

@ -1,7 +1,7 @@
// SGI's rope class -*- C++ -*-
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
// Free Software Foundation, Inc.
// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
// 2012 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
@ -44,6 +44,8 @@
#ifndef _ROPE
#define _ROPE 1
#pragma GCC system_header
#include <algorithm>
#include <iosfwd>
#include <bits/stl_construct.h>
@ -458,20 +460,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
volatile _RC_t _M_ref_count;
// Constructor
__gthread_mutex_t _M_ref_count_lock;
_Refcount_Base(_RC_t __n) : _M_ref_count(__n), _M_ref_count_lock()
{
#ifdef __GTHREAD_MUTEX_INIT
__gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;
_M_ref_count_lock = __tmp;
#elif defined(__GTHREAD_MUTEX_INIT_FUNCTION)
__gthread_mutex_t _M_ref_count_lock = __GTHREAD_MUTEX_INIT;
#else
__gthread_mutex_t _M_ref_count_lock;
#endif
_Refcount_Base(_RC_t __n) : _M_ref_count(__n)
{
#ifndef __GTHREAD_MUTEX_INIT
#ifdef __GTHREAD_MUTEX_INIT_FUNCTION
__GTHREAD_MUTEX_INIT_FUNCTION (&_M_ref_count_lock);
#else
#error __GTHREAD_MUTEX_INIT or __GTHREAD_MUTEX_INIT_FUNCTION should be defined by gthr.h abstraction layer, report problem to libstdc++@gcc.gnu.org.
#endif
#endif
}
#ifndef __GTHREAD_MUTEX_INIT
~_Refcount_Base()
{ __gthread_mutex_destroy(&_M_ref_count_lock); }
#endif
void
_M_incr()
{
@ -581,7 +591,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
bool _M_is_balanced:8;
unsigned char _M_depth;
__GC_CONST _CharT* _M_c_string;
#ifdef __GTHREAD_MUTEX_INIT
__gthread_mutex_t _M_c_string_lock = __GTHREAD_MUTEX_INIT;
#else
__gthread_mutex_t _M_c_string_lock;
#endif
/* Flattened version of string, if needed. */
/* typically 0. */
/* If it's not 0, then the memory is owned */
@ -602,13 +616,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
_M_tag(__t), _M_is_balanced(__b), _M_depth(__d), _M_c_string(0)
#ifdef __GTHREAD_MUTEX_INIT
{
// Do not copy a POSIX/gthr mutex once in use. However, bits are bits.
__gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT;
_M_c_string_lock = __tmp;
}
{ }
#else
{ __GTHREAD_MUTEX_INIT_FUNCTION (&_M_c_string_lock); }
{ __GTHREAD_MUTEX_INIT_FUNCTION (&_M_c_string_lock); }
~_Rope_RopeRep()
{ __gthread_mutex_destroy (&_M_c_string_lock); }
#endif
#ifdef __GC
void