From patchwork Tue Sep 28 19:40:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 45531 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 2472C3858435 for ; Tue, 28 Sep 2021 19:46:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2472C3858435 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1632858378; bh=5MsY08EHnP/Om4lPY9+6xNbIJ/WPSYq2mzssfQqFGwc=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=dg9OSHxzqfDLeg8WyGTP14vEg1uOtyAQCswNub9lkCxptEhLqoW/Ijw+BcRQapUcd JAfAOtTir0NoIOgsuya2d3dX9oGlWxK23txIIA1vCOuJZU5imvI0X+ovVxSiF40InN vxLrW5AedO4Xjg1aLxBmk40v0XToF+31/L6rZmf8= 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 4A0003858038 for ; Tue, 28 Sep 2021 19:40:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4A0003858038 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-337-5NiEWAbSOEadYpcto1zkRw-1; Tue, 28 Sep 2021 15:40:06 -0400 X-MC-Unique: 5NiEWAbSOEadYpcto1zkRw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E012D10247A8; Tue, 28 Sep 2021 19:40:05 +0000 (UTC) Received: from localhost (unknown [10.33.36.241]) by smtp.corp.redhat.com (Postfix) with ESMTP id 88CBE19C79; Tue, 28 Sep 2021 19:40:05 +0000 (UTC) Date: Tue, 28 Sep 2021 20:40:04 +0100 To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Add noexcept to functions in Message-ID: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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" Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/bits/regex.h (basic_regex, swap): Add noexcept to non-throwing functions. * include/bits/regex_automaton.h (_State_base, _State) (_NFA_base): Likewise. * include/bits/regex_compiler.h (_Compiler): Likewise. * include/bits/regex_error.h (regex_error::code()): Likewise. * include/bits/regex_scanner.h (_Scanner): Likewise. Tested x86_64-linux. Committed to trunk. commit df0dd04b78cfc0f723387b703978600caac93cbb Author: Jonathan Wakely Date: Mon Sep 27 20:42:17 2021 libstdc++: Add noexcept to functions in Signed-off-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/bits/regex.h (basic_regex, swap): Add noexcept to non-throwing functions. * include/bits/regex_automaton.h (_State_base, _State) (_NFA_base): Likewise. * include/bits/regex_compiler.h (_Compiler): Likewise. * include/bits/regex_error.h (regex_error::code()): Likewise. * include/bits/regex_scanner.h (_Scanner): Likewise. diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h index b8a0ad251d8..d4a7729de2c 100644 --- a/libstdc++-v3/include/bits/regex.h +++ b/libstdc++-v3/include/bits/regex.h @@ -421,7 +421,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 * Constructs a basic regular expression that does not match any * character sequence. */ - basic_regex() + basic_regex() noexcept : _M_flags(ECMAScript), _M_loc(), _M_automaton(nullptr) { } @@ -697,7 +697,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 * expression. */ unsigned int - mark_count() const + mark_count() const noexcept { if (_M_automaton) return _M_automaton->_M_sub_count() - 1; @@ -709,7 +709,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 * or in the last call to assign(). */ flag_type - flags() const + flags() const noexcept { return _M_flags; } // [7.8.5] locale @@ -731,7 +731,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 * object. */ locale_type - getloc() const + getloc() const noexcept { return _M_loc; } // [7.8.6] swap @@ -741,7 +741,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 * @param __rhs Another regular expression object. */ void - swap(basic_regex& __rhs) + swap(basic_regex& __rhs) noexcept { std::swap(_M_flags, __rhs._M_flags); std::swap(_M_loc, __rhs._M_loc); @@ -848,7 +848,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 template inline void swap(basic_regex<_Ch_type, _Rx_traits>& __lhs, - basic_regex<_Ch_type, _Rx_traits>& __rhs) + basic_regex<_Ch_type, _Rx_traits>& __rhs) noexcept { __lhs.swap(__rhs); } diff --git a/libstdc++-v3/include/bits/regex_automaton.h b/libstdc++-v3/include/bits/regex_automaton.h index 872a17fe8cb..02d81f3e417 100644 --- a/libstdc++-v3/include/bits/regex_automaton.h +++ b/libstdc++-v3/include/bits/regex_automaton.h @@ -95,13 +95,13 @@ namespace __detail }; protected: - explicit _State_base(_Opcode __opcode) + explicit _State_base(_Opcode __opcode) noexcept : _M_opcode(__opcode), _M_next(_S_invalid_state_id) { } public: bool - _M_has_alt() + _M_has_alt() const noexcept { return _M_opcode == _S_opcode_alternative || _M_opcode == _S_opcode_repeat @@ -130,7 +130,7 @@ namespace __detail "std::function"); explicit - _State(_Opcode __opcode) : _State_base(__opcode) + _State(_Opcode __opcode) noexcept : _State_base(__opcode) { if (_M_opcode() == _S_opcode_match) new (this->_M_matcher_storage._M_addr()) _MatcherT(); @@ -143,7 +143,7 @@ namespace __detail _MatcherT(__rhs._M_get_matcher()); } - _State(_State&& __rhs) : _State_base(__rhs) + _State(_State&& __rhs) noexcept : _State_base(__rhs) { if (__rhs._M_opcode() == _S_opcode_match) new (this->_M_matcher_storage._M_addr()) @@ -162,7 +162,7 @@ namespace __detail // Since correct ctor and dtor rely on _M_opcode, it's better not to // change it over time. _Opcode - _M_opcode() const + _M_opcode() const noexcept { return _State_base::_M_opcode; } bool @@ -170,11 +170,11 @@ namespace __detail { return _M_get_matcher()(__char); } _MatcherT& - _M_get_matcher() + _M_get_matcher() noexcept { return *static_cast<_MatcherT*>(this->_M_matcher_storage._M_addr()); } const _MatcherT& - _M_get_matcher() const + _M_get_matcher() const noexcept { return *static_cast( this->_M_matcher_storage._M_addr()); @@ -187,7 +187,7 @@ namespace __detail typedef regex_constants::syntax_option_type _FlagT; explicit - _NFA_base(_FlagT __f) + _NFA_base(_FlagT __f) noexcept : _M_flags(__f), _M_start_state(0), _M_subexpr_count(0), _M_has_backref(false) { } @@ -199,15 +199,15 @@ namespace __detail public: _FlagT - _M_options() const + _M_options() const noexcept { return _M_flags; } _StateIdT - _M_start() const + _M_start() const noexcept { return _M_start_state; } _SizeT - _M_sub_count() const + _M_sub_count() const noexcept { return _M_subexpr_count; } _GLIBCXX_STD_C::vector _M_paren_stack; diff --git a/libstdc++-v3/include/bits/regex_compiler.h b/libstdc++-v3/include/bits/regex_compiler.h index 5b4f2ae3558..423ab823194 100644 --- a/libstdc++-v3/include/bits/regex_compiler.h +++ b/libstdc++-v3/include/bits/regex_compiler.h @@ -66,7 +66,7 @@ namespace __detail const typename _TraitsT::locale_type& __traits, _FlagT __flags); shared_ptr - _M_get_nfa() + _M_get_nfa() noexcept { return std::move(_M_nfa); } private: diff --git a/libstdc++-v3/include/bits/regex_error.h b/libstdc++-v3/include/bits/regex_error.h index 27593833544..d3713fa5f47 100644 --- a/libstdc++-v3/include/bits/regex_error.h +++ b/libstdc++-v3/include/bits/regex_error.h @@ -150,7 +150,7 @@ namespace regex_constants * @returns the regex error code. */ regex_constants::error_type - code() const + code() const noexcept { return _M_code; } private: diff --git a/libstdc++-v3/include/bits/regex_scanner.h b/libstdc++-v3/include/bits/regex_scanner.h index e810fa7dd31..05d8172a0ad 100644 --- a/libstdc++-v3/include/bits/regex_scanner.h +++ b/libstdc++-v3/include/bits/regex_scanner.h @@ -223,11 +223,11 @@ namespace __detail _M_advance(); _TokenT - _M_get_token() const + _M_get_token() const noexcept { return _M_token; } const _StringT& - _M_get_value() const + _M_get_value() const noexcept { return _M_value; } #ifdef _GLIBCXX_DEBUG