From patchwork Sat Sep 26 19:52:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 523111 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 30DAE140771 for ; Sun, 27 Sep 2015 05:52:22 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=VInQv0eC; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=jZqqYwuM8JdJSvRjF 49yRQBOPNmic8kp+u1MiNoey7NxIO7n1m+bTsAEgdmcIF/8HV8WVaGdYAiA63TYX X71dhAPJeVu5wCfGABinuqDL9+5KteBd2DVzhkjSGFsHTF46KTQ+b0CT8HyT301i 6+FRpb7XuSUpl7UscbMh/8A9Do= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=0w6Oo40awvAg36JyY32XZrx A5i4=; b=VInQv0eC7WyFaPXmmw6nygN7+6xC2qhZ1CKYiD5VbrKSz1btBj4dmB4 fiL6zRGGiPyoHkXHcMjFe9u/SV3UQo1oUO009F5nvUSvzY2Hk3L5ERww4rK57keE m8F3mLWZ+R929pB2xnByDwVzMy0azPgHpwT8CfgI9vREIrANzEok= Received: (qmail 75877 invoked by alias); 26 Sep 2015 19:52:15 -0000 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 Received: (qmail 75858 invoked by uid 89); 26 Sep 2015 19:52:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Sat, 26 Sep 2015 19:52:12 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 1621B98C23; Sat, 26 Sep 2015 19:52:11 +0000 (UTC) Received: from localhost (ovpn-116-138.ams2.redhat.com [10.36.116.138]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t8QJqAYx017817; Sat, 26 Sep 2015 15:52:10 -0400 Date: Sat, 26 Sep 2015 20:52:09 +0100 From: Jonathan Wakely To: Florian Weimer Cc: Martin Sebor , libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org, =?iso-8859-1?Q?Fran=E7ois?= Dumont Subject: Re: [patch] Enable lightweight checks with _GLIBCXX_ASSERTIONS. Message-ID: <20150926195209.GL12094@redhat.com> References: <20150907182755.GP2631@redhat.com> <87r3mauiud.fsf@mid.deneb.enyo.de> <20150907195939.GT2631@redhat.com> <55EEF828.4060707@redhat.com> <20150908154535.GX2631@redhat.com> <55F05728.1000209@redhat.com> <55F1B041.5060507@gmail.com> <55F1B1F5.4060300@redhat.com> <55F1B682.1040109@gmail.com> <55F69A17.1000504@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <55F69A17.1000504@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.5.23 (2014-03-12) On 14/09/15 11:57 +0200, Florian Weimer wrote: >On 09/10/2015 06:57 PM, Martin Sebor wrote: > >>>> There is quite a bit of documentation of _FORTIFY_SOURCE that explains >>>> its effect on user code. >>> >>> I think there are only random blog articles discussing aspects of it, >>> most of them slightly incorrect or outdated. >> >> _FORTIFY_SOURCE is a GLIBC feature test macro. It's documented >> in and mentioned in some of its online manuals. >> For example: >> >> http://man7.org/linux/man-pages/man7/feature_test_macros.7.html >> >> or here: >> >> http://manpages.ubuntu.com/manpages/hardy/man7/feature_test_macros.7.html > >Oh, so there is an out-dated man-page as well. :-/ > >The fd_set checks added in glibc 2.15 are missing. That caused some >backslash because some folks were actually abusing FD_SET and related >macros. Nothing too severe, and in the end, we stood our ground. I >expect the libstdc++ changes to be similar. > >Again, my main argument is that the main users of _FORTIFY_SOURCE are >distributions, and they would inject whatever preprocessor macro enables >the new libstdc++ checks anyway, so saving them that work would be >preferable IMHO. Would changes like this be suitable for _FORTIFY_SOURCE? diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex index 5e5ced1..074bf26 100644 --- a/libstdc++-v3/include/std/mutex +++ b/libstdc++-v3/include/std/mutex @@ -70,7 +70,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __recursive_mutex_base& operator=(const __recursive_mutex_base&) = delete; #ifdef __GTHREAD_RECURSIVE_MUTEX_INIT +# if _GLIBCXX_ASSERTIONS && defined(PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP) + // Use an error-checking mutex type when assertions are enabled. + __native_type _M_mutex = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; +# else __native_type _M_mutex = __GTHREAD_RECURSIVE_MUTEX_INIT; +# endif __recursive_mutex_base() = default; #else