From patchwork Mon Jul 16 21:56:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 171274 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id C05222C0132 for ; Tue, 17 Jul 2012 07:57:21 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1343080643; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:In-Reply-To:References:Date: Message-ID:Subject:From:To:Cc:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=aUGIiPLAfVZZnzTd+DXG9HHSNnI=; b=iDkoZHIrNHNAse42V07NNcg0Mt8o7jSiUDygHQIXM5GKG8Ip7rlWb5o9kdygme HCUoWLfDX6dyq/VxoG4+BNW5fKe4OCEx26x6Ws2l5JTE0zV/k34XNxiXezd9ipC7 xDC4NuUxcYDgin2eSN6bGhISW5kqXwkTDUy9mDsUkKIhk= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:MIME-Version:Received:Received:In-Reply-To:References:Date:Message-ID:Subject:From:To:Cc:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=HQ8qyYYT45+cSPyCCFc68MFaPhawhg4ZQYLk78KJP/8H8nmn2gItTwhTpHpGY5 bhXxAdub+o+hmtZm0tULlPD6+EK8ttyQ954mljKfj4ktL6XBc7qDG3PtoSN+n+hx rA4mZB/yFXfqSGX1ovpvG/XKU7hHc5CEi8uNRBaMCrneQ=; Received: (qmail 16388 invoked by alias); 16 Jul 2012 21:57:16 -0000 Received: (qmail 16369 invoked by uid 22791); 16 Jul 2012 21:57:15 -0000 X-SWARE-Spam-Status: No, hits=-5.1 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, TW_FN, TW_SF, T_FILL_THIS_FORM_SHORT X-Spam-Check-By: sourceware.org Received: from mail-lb0-f175.google.com (HELO mail-lb0-f175.google.com) (209.85.217.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 16 Jul 2012 21:57:02 +0000 Received: by lbol5 with SMTP id l5so8702493lbo.20 for ; Mon, 16 Jul 2012 14:57:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.10.198 with SMTP id k6mr76220lbb.83.1342475819999; Mon, 16 Jul 2012 14:56:59 -0700 (PDT) Received: by 10.112.27.228 with HTTP; Mon, 16 Jul 2012 14:56:59 -0700 (PDT) In-Reply-To: References: Date: Mon, 16 Jul 2012 22:56:59 +0100 Message-ID: Subject: Re: [v3] PR 53270 fix hppa-linux bootstrap regression From: Jonathan Wakely To: "libstdc++" , gcc-patches Cc: Jason Merrill , danglin@gcc.gnu.org Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On 16 July 2012 22:48, Jonathan Wakely wrote: > On 7 July 2012 18:16, Jonathan Wakely wrote: >> >> My preference is (1) for 4.7 and (4) for 4.6 but the changes are not >> ones I feel comfortable making on release branches without other >> opinions. Please comment :-) > > No comments? > > Then I'm going for my preferences as stated above. PR libstdc++/53270 * include/ext/concurrence.h (__mutex, __recursive_mutex, __cond): Use NSDMI in C++98 mode too. * include/ext/rope: Add system_header pragma. (_Refcount_Base, _Rope_RopeRep): Use NSDMI. (_Rope_RopeRep::~_Rope_RopeRep): Destroy mutex. Tested x86_64-linux. Committed to trunk. commit 68d45f18ff7020c3eaeddf8d6e3c198a02891ada Author: Jonathan Wakely Date: Sat Jul 7 14:40:43 2012 +0100 PR libstdc++/53270 * include/ext/concurrence.h (__mutex, __recursive_mutex, __cond): Use NSDMI in C++98 mode too. * include/ext/rope: Add system_header pragma. (_Refcount_Base, _Rope_RopeRep): Use NSDMI. (_Rope_RopeRep::~_Rope_RopeRep): Destroy mutex. diff --git a/libstdc++-v3/include/ext/concurrence.h b/libstdc++-v3/include/ext/concurrence.h index 25e218b..ad02839 100644 --- a/libstdc++-v3/include/ext/concurrence.h +++ b/libstdc++-v3/include/ext/concurrence.h @@ -1,7 +1,6 @@ // Support for concurrent programing -*- C++ -*- -// Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 -// Free Software Foundation, Inc. +// Copyright (C) 2003-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 @@ -143,8 +142,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class __mutex { private: -#if __GTHREADS && defined __GTHREAD_MUTEX_INIT \ - && defined __GXX_EXPERIMENTAL_CXX0X__ +#if __GTHREADS && defined __GTHREAD_MUTEX_INIT __gthread_mutex_t _M_mutex = __GTHREAD_MUTEX_INIT; #else __gthread_mutex_t _M_mutex; @@ -156,19 +154,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION public: __mutex() { -#if __GTHREADS +#if __GTHREADS && ! defined __GTHREAD_MUTEX_INIT if (__gthread_active_p()) - { -#if defined __GTHREAD_MUTEX_INIT -# ifndef __GXX_EXPERIMENTAL_CXX0X__ - __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT; - _M_mutex = __tmp; -# endif -#else - __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex); + __GTHREAD_MUTEX_INIT_FUNCTION(&_M_mutex); #endif - } -#endif } #if __GTHREADS && ! defined __GTHREAD_MUTEX_INIT @@ -208,8 +197,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class __recursive_mutex { private: -#if __GTHREADS && defined __GTHREAD_RECURSIVE_MUTEX_INIT \ - && defined __GXX_EXPERIMENTAL_CXX0X__ +#if __GTHREADS && defined __GTHREAD_RECURSIVE_MUTEX_INIT __gthread_recursive_mutex_t _M_mutex = __GTHREAD_RECURSIVE_MUTEX_INIT; #else __gthread_recursive_mutex_t _M_mutex; @@ -221,19 +209,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 -# ifndef __GXX_EXPERIMENTAL_CXX0X__ - __gthread_recursive_mutex_t __tmp = __GTHREAD_RECURSIVE_MUTEX_INIT; - _M_mutex = __tmp; -# endif -#else - __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex); + __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION(&_M_mutex); #endif - } -#endif } #if __GTHREADS && ! defined __GTHREAD_RECURSIVE_MUTEX_INIT @@ -333,8 +312,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class __cond { private: -#if __GTHREADS && defined __GTHREAD_COND_INIT \ - && defined __GXX_EXPERIMENTAL_CXX0X__ +#if __GTHREADS && defined __GTHREAD_COND_INIT __gthread_cond_t _M_cond = __GTHREAD_COND_INIT; #else __gthread_cond_t _M_cond; @@ -346,19 +324,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION public: __cond() { -#if __GTHREADS +#if __GTHREADS && ! defined __GTHREAD_COND_INIT if (__gthread_active_p()) - { -#if defined __GTHREAD_COND_INIT -# ifndef __GXX_EXPERIMENTAL_CXX0X__ - __gthread_cond_t __tmp = __GTHREAD_COND_INIT; - _M_cond = __tmp; -# endif -#else - __GTHREAD_COND_INIT_FUNCTION(&_M_cond); + __GTHREAD_COND_INIT_FUNCTION(&_M_cond); #endif - } -#endif } #if __GTHREADS && ! defined __GTHREAD_COND_INIT diff --git a/libstdc++-v3/include/ext/rope b/libstdc++-v3/include/ext/rope index 15cb423..24b8510 100644 --- a/libstdc++-v3/include/ext/rope +++ b/libstdc++-v3/include/ext/rope @@ -1,7 +1,6 @@ // SGI's rope class -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 -// Free Software Foundation, Inc. +// Copyright (C) 2001-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 +43,8 @@ #ifndef _ROPE #define _ROPE 1 +#pragma GCC system_header + #include #include #include @@ -458,24 +459,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION volatile _RC_t _M_ref_count; // Constructor -#if defined __GTHREAD_MUTEX_INIT && defined __GXX_EXPERIMENTAL_CXX0X__ +#ifdef __GTHREAD_MUTEX_INIT __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), _M_ref_count_lock() + _Refcount_Base(_RC_t __n) : _M_ref_count(__n) { -#ifdef __GTHREAD_MUTEX_INIT -# ifndef __GXX_EXPERIMENTAL_CXX0X__ - __gthread_mutex_t __tmp = __GTHREAD_MUTEX_INIT; - _M_ref_count_lock = __tmp; -# endif -#elif defined(__GTHREAD_MUTEX_INIT_FUNCTION) +#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 @@ -592,7 +590,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 */ @@ -613,13 +615,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