From patchwork Tue Oct 5 08:38:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 45825 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 804163857038 for ; Tue, 5 Oct 2021 08:56:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 804163857038 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1633424188; bh=KF3Gb+X7NWGGun0DSXvUxOwhr9B2tmF3w1VrI5DRLv4=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=SLH8Vc4gfc4scOZx19of2c2J99WL/TXp3dxnHYNPC+yt7SyWDjUA4+t7Qrk3dAV49 495rJGpqmzzukMmarhR9ryfSuRdDneme//qESk+FE1nX55J+OeDya9L0XqR2qzK7aE pzGGoK4Drh90kyLSq8CmKBype67poJ8Mu3yl4YyU= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id CB6B93857416 for ; Tue, 5 Oct 2021 08:38:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CB6B93857416 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-515-33Yh69d7Pjm9csPQ4IV1Zw-1; Tue, 05 Oct 2021 04:38:34 -0400 X-MC-Unique: 33Yh69d7Pjm9csPQ4IV1Zw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4CC7083DBC9; Tue, 5 Oct 2021 08:38:33 +0000 (UTC) Received: from localhost (unknown [10.33.37.40]) by smtp.corp.redhat.com (Postfix) with ESMTP id D0E285D9F4; Tue, 5 Oct 2021 08:38:32 +0000 (UTC) Date: Tue, 5 Oct 2021 09:38:31 +0100 To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Add noexcept to some std::function internals Message-ID: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" libstdc++-v3/ChangeLog: * include/bits/std_function.h (_Any_data::_M_access): Add noexcept. (_Function_base::_Base_manager::_M_get_pointer): Likewise. (_Function_base::_Base_manager::_M_not_empty_function): Likewise. Tested powerpc64le-linux. Committed to trunk. commit 9665c2e76849c8e0066c6660779ae082fce67ea8 Author: Jonathan Wakely Date: Mon Oct 4 15:22:58 2021 libstdc++: Add noexcept to some std::function internals libstdc++-v3/ChangeLog: * include/bits/std_function.h (_Any_data::_M_access): Add noexcept. (_Function_base::_Base_manager::_M_get_pointer): Likewise. (_Function_base::_Base_manager::_M_not_empty_function): Likewise. diff --git a/libstdc++-v3/include/bits/std_function.h b/libstdc++-v3/include/bits/std_function.h index 3dda820bd1a..55738440949 100644 --- a/libstdc++-v3/include/bits/std_function.h +++ b/libstdc++-v3/include/bits/std_function.h @@ -82,17 +82,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION union [[gnu::may_alias]] _Any_data { - void* _M_access() { return &_M_pod_data[0]; } - const void* _M_access() const { return &_M_pod_data[0]; } + void* _M_access() noexcept { return &_M_pod_data[0]; } + const void* _M_access() const noexcept { return &_M_pod_data[0]; } template _Tp& - _M_access() + _M_access() noexcept { return *static_cast<_Tp*>(_M_access()); } template const _Tp& - _M_access() const + _M_access() const noexcept { return *static_cast(_M_access()); } _Nocopy_types _M_unused; @@ -131,7 +131,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // Retrieve a pointer to the function object static _Functor* - _M_get_pointer(const _Any_data& __source) + _M_get_pointer(const _Any_data& __source) noexcept { if _GLIBCXX17_CONSTEXPR (__stored_locally) { @@ -217,22 +217,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template static bool - _M_not_empty_function(const function<_Signature>& __f) + _M_not_empty_function(const function<_Signature>& __f) noexcept { return static_cast(__f); } template static bool - _M_not_empty_function(_Tp* __fp) + _M_not_empty_function(_Tp* __fp) noexcept { return __fp != nullptr; } template static bool - _M_not_empty_function(_Tp _Class::* __mp) + _M_not_empty_function(_Tp _Class::* __mp) noexcept { return __mp != nullptr; } template static bool - _M_not_empty_function(const _Tp&) + _M_not_empty_function(const _Tp&) noexcept { return true; } };