From patchwork Tue May 15 16:56:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 913827 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-477721-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="QF1Lzwn1"; dkim-atps=neutral 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 40lkHk6c5Kz9ryk for ; Wed, 16 May 2018 02:56:50 +1000 (AEST) 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:mime-version:content-type; q=dns; s=default; b=E+xf+W9sODK8GPzXYI/+JuDzQSr8eZhqMmloxUf9er/a7zzmdE CUihB5K+Ry0BgB9EsEBTyLmnhkzxiExi96qdFQNUQMRruy+gXD42349Y03QWj0Jp yD5PHLXpaiY/gkomyR/aDE94w/nNNaFpNxO8GNIDsHI/XgVLUahltSVhM= 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:mime-version:content-type; s= default; bh=sk05ZhhgHPIAOV2B4g3aYs0VOQw=; b=QF1Lzwn1cz3hmZObHg3Q xrT0Q2jme47TYFS0r/SoqQhHGGnjfINB6cGHQJhqUriuvgapYVoUyQfriFPyeFIe 5mWmmm+n+qP2NvtblSNKv9haASSFI/gbjXmn99uUQZbpl0DbpAvNb21wZM4K68uH TcVVulQ9lBsQc5m+ijvCV5o= Received: (qmail 8059 invoked by alias); 15 May 2018 16:56:43 -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 8040 invoked by uid 89); 15 May 2018 16:56:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=6247, our X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 15 May 2018 16:56:41 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1B1BD808255C; Tue, 15 May 2018 16:56:40 +0000 (UTC) Received: from localhost (unknown [10.33.36.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id CAA41100727B; Tue, 15 May 2018 16:56:39 +0000 (UTC) Date: Tue, 15 May 2018 17:56:39 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: Tim Shen Subject: [PATCH] libstdc++/85184 remove __glibcxx_assert assertions from Message-ID: <20180515165639.GJ7974@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.9.2 (2017-12-15) As I said in the bugzilla PR, these assertions are all to catch our own mistakes, not user error. If we're comfortable the code is correct then we should remove them. Should we wait until near the end of stage 1, to get more time with these checks in place? diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 8359f4f5335..a3d74966435 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,8 @@ +2018-05-15 Jonathan Wakely + + PR libstdc++/85184 + * include/std/variant: Remove all uses of __glibcxx_assert. + 2018-05-15 Jonathan Wakely PR libstdc++/85749 diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant index c0212404bb2..efc1d3bf1e0 100644 --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -555,7 +555,6 @@ namespace __variant __throw_exception_again; } } - __glibcxx_assert(this->_M_index == __rhs._M_index); return *this; } @@ -624,7 +623,6 @@ namespace __variant __throw_exception_again; } } - __glibcxx_assert(this->_M_index == __rhs._M_index); return *this; } @@ -1105,7 +1103,7 @@ namespace __variant noexcept(is_nothrow_constructible_v<__accepted_type<_Tp&&>, _Tp&&>) : variant(in_place_index<__accepted_index<_Tp&&>>, std::forward<_Tp>(__t)) - { __glibcxx_assert(holds_alternative<__accepted_type<_Tp&&>>(*this)); } + { } template @@ -1114,7 +1112,7 @@ namespace __variant variant(in_place_type_t<_Tp>, _Args&&... __args) : variant(in_place_index<__index_of<_Tp>>, std::forward<_Args>(__args)...) - { __glibcxx_assert(holds_alternative<_Tp>(*this)); } + { } template @@ -1125,7 +1123,7 @@ namespace __variant _Args&&... __args) : variant(in_place_index<__index_of<_Tp>>, __il, std::forward<_Args>(__args)...) - { __glibcxx_assert(holds_alternative<_Tp>(*this)); } + { } template, _Args&&... __args) : _Base(in_place_index<_Np>, std::forward<_Args>(__args)...), _Default_ctor_enabler(_Enable_default_constructor_tag{}) - { __glibcxx_assert(index() == _Np); } + { } template, @@ -1144,7 +1142,7 @@ namespace __variant _Args&&... __args) : _Base(in_place_index<_Np>, __il, std::forward<_Args>(__args)...), _Default_ctor_enabler(_Enable_default_constructor_tag{}) - { __glibcxx_assert(index() == _Np); } + { } template enable_if_t<__exactly_once<__accepted_type<_Tp&&>> @@ -1160,7 +1158,6 @@ namespace __variant std::get<__index>(*this) = std::forward<_Tp>(__rhs); else this->emplace<__index>(std::forward<_Tp>(__rhs)); - __glibcxx_assert(holds_alternative<__accepted_type<_Tp&&>>(*this)); return *this; } @@ -1171,7 +1168,6 @@ namespace __variant { auto& ret = this->emplace<__index_of<_Tp>>(std::forward<_Args>(__args)...); - __glibcxx_assert(holds_alternative<_Tp>(*this)); return ret; } @@ -1184,7 +1180,6 @@ namespace __variant auto& ret = this->emplace<__index_of<_Tp>>(__il, std::forward<_Args>(__args)...); - __glibcxx_assert(holds_alternative<_Tp>(*this)); return ret; } @@ -1207,7 +1202,6 @@ namespace __variant this->_M_index = variant_npos; __throw_exception_again; } - __glibcxx_assert(index() == _Np); return std::get<_Np>(*this); } @@ -1230,7 +1224,6 @@ namespace __variant this->_M_index = variant_npos; __throw_exception_again; } - __glibcxx_assert(index() == _Np); return std::get<_Np>(*this); }