From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 000EB3857001; Fri, 23 Jun 2023 16:12:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 000EB3857001 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1687536773; bh=Bc2vqGdiLOxLudu2WAIFRAt4ACrL1gTcM4dppedpAP0=; h=From:To:Subject:Date:From; b=CLgSYNboN9V8ZMPgbUlaGtu5gG0PzUgsCOmEyR9Ko1MbNJsuYtw5jQw0qpewwtB0Q nz+e0KTCYUmFMNPrUVY5QB5mCyTfbAzi1egovrbvTDyX2ohFOcreyO6ml6MgS5vXiv PF0294zYmfg/XdD9CcWarK/pf/mMY/uxtNe5cwgk= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r10-11466] libstdc++: Add noexcept to functions in X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-10 X-Git-Oldrev: 4c347b8d59958d5aa76c5fdcecd72478e08c5aa3 X-Git-Newrev: 596aa947770806d93395d190de3b1d7e14391a21 Message-Id: <20230623161253.000EB3857001@sourceware.org> Date: Fri, 23 Jun 2023 16:12:52 +0000 (GMT) List-Id: https://gcc.gnu.org/g:596aa947770806d93395d190de3b1d7e14391a21 commit r10-11466-g596aa947770806d93395d190de3b1d7e14391a21 Author: Jonathan Wakely Date: Mon Sep 27 20:42:17 2021 +0100 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. (cherry picked from commit df0dd04b78cfc0f723387b703978600caac93cbb) Diff: --- libstdc++-v3/include/bits/regex.h | 12 ++++++------ libstdc++-v3/include/bits/regex_automaton.h | 22 +++++++++++----------- libstdc++-v3/include/bits/regex_compiler.h | 2 +- libstdc++-v3/include/bits/regex_error.h | 2 +- libstdc++-v3/include/bits/regex_scanner.h | 4 ++-- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h index c7630869548..647f26b8975 100644 --- a/libstdc++-v3/include/bits/regex.h +++ b/libstdc++-v3/include/bits/regex.h @@ -420,7 +420,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) { } @@ -696,7 +696,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; @@ -708,7 +708,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 @@ -730,7 +730,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 * object. */ locale_type - getloc() const + getloc() const noexcept { return _M_loc; } // [7.8.6] swap @@ -740,7 +740,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); @@ -847,7 +847,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 b7165f19cec..25d9ee98480 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 a3001b2a432..0e9ffc430dc 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 b63d6572961..21d4cd85c1e 100644 --- a/libstdc++-v3/include/bits/regex_error.h +++ b/libstdc++-v3/include/bits/regex_error.h @@ -152,7 +152,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 93ef4c66f38..eb82bbbee8c 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