From f26e72d8310c3e70f7a4b345e06a9c5c8d51728a Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 21 May 2020 00:59:55 +0100 Subject: [PATCH] libstdc++: Use 'using' for types in Networking TS headers * include/experimental/buffer: Replace typedefs with alias-declarations. * include/experimental/executor: Likewise. * include/experimental/internet: Likewise. * include/experimental/socket: Likewise. * include/experimental/timer: Likewise. --- libstdc++-v3/ChangeLog | 9 +++ libstdc++-v3/include/experimental/buffer | 4 +- libstdc++-v3/include/experimental/executor | 18 ++--- libstdc++-v3/include/experimental/internet | 86 +++++++++++----------- libstdc++-v3/include/experimental/socket | 54 +++++++------- libstdc++-v3/include/experimental/timer | 18 ++--- 6 files changed, 99 insertions(+), 90 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 67ca5b76d21..0ecfde4a9a6 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2020-05-21 Jonathan Wakely + + * include/experimental/buffer: Replace typedefs with + alias-declarations. + * include/experimental/executor: Likewise. + * include/experimental/internet: Likewise. + * include/experimental/socket: Likewise. + * include/experimental/timer: Likewise. + 2020-05-19 Jonathan Wakely PR libstdc++/94087 diff --git a/libstdc++-v3/include/experimental/buffer b/libstdc++-v3/include/experimental/buffer index 0b04b71286c..8ccdb28cc5b 100644 --- a/libstdc++-v3/include/experimental/buffer +++ b/libstdc++-v3/include/experimental/buffer @@ -488,8 +488,8 @@ inline namespace v1 { public: // types: - typedef const_buffer const_buffers_type; - typedef mutable_buffer mutable_buffers_type; + using const_buffers_type = const_buffer; + using mutable_buffers_type = mutable_buffer; // constructors: explicit diff --git a/libstdc++-v3/include/experimental/executor b/libstdc++-v3/include/experimental/executor index 3560e345e8a..f55414c9360 100644 --- a/libstdc++-v3/include/experimental/executor +++ b/libstdc++-v3/include/experimental/executor @@ -369,8 +369,8 @@ inline namespace v1 class async_result { public: - typedef _CompletionToken completion_handler_type; - typedef void return_type; + using completion_handler_type = _CompletionToken; + using return_type = void; explicit async_result(completion_handler_type&) {} async_result(const async_result&) = delete; @@ -660,8 +660,8 @@ inline namespace v1 public: // types: - typedef _Tp target_type; - typedef _Executor executor_type; + using target_type = _Tp; + using executor_type = _Executor; // construct / copy / destroy: @@ -766,7 +766,7 @@ inline namespace v1 template struct associated_allocator, _ProtoAlloc> { - typedef associated_allocator_t<_Tp, _ProtoAlloc> type; + using type = associated_allocator_t<_Tp, _ProtoAlloc>; static type get(const executor_binder<_Tp, _Executor>& __b, @@ -777,7 +777,7 @@ inline namespace v1 template struct associated_executor, _Executor1> { - typedef _Executor type; + using type = _Executor; static type get(const executor_binder<_Tp, _Executor>& __b, @@ -791,7 +791,7 @@ inline namespace v1 public: // types: - typedef _Executor executor_type; + using executor_type = _Executor; // construct / copy / destroy: @@ -845,7 +845,7 @@ inline namespace v1 public: // types: - typedef system_executor executor_type; + using executor_type = system_executor; // construct / copy / destroy: @@ -1446,7 +1446,7 @@ inline namespace v1 public: // types: - typedef _Executor inner_executor_type; + using inner_executor_type = _Executor; // construct / copy / destroy: diff --git a/libstdc++-v3/include/experimental/internet b/libstdc++-v3/include/experimental/internet index 1aa81095009..71e40d83a7e 100644 --- a/libstdc++-v3/include/experimental/internet +++ b/libstdc++-v3/include/experimental/internet @@ -110,8 +110,8 @@ namespace ip /// @} #endif - typedef uint_least16_t port_type; ///< Type used for port numbers. - typedef uint_least32_t scope_id_type; ///< Type used for IPv6 scope IDs. + using port_type = uint_least16_t; ///< Type used for port numbers. + using scope_id_type = uint_least32_t; ///< Type used for IPv6 scope IDs. /// Convenience alias for constraining allocators for strings. template @@ -133,7 +133,7 @@ namespace ip { public: // types: - typedef uint_least32_t uint_type; + using uint_type = uint_least32_t; struct bytes_type : array { @@ -918,11 +918,11 @@ namespace ip { public: // types: - typedef address_v4 value_type; - typedef ptrdiff_t difference_type; - typedef const address_v4* pointer; - typedef const address_v4& reference; - typedef input_iterator_tag iterator_category; + using value_type = address_v4; + using difference_type = ptrdiff_t; + using pointer = const address_v4*; + using reference = const address_v4&; + using iterator_category = input_iterator_tag; // constructors: basic_address_iterator(const address_v4& __a) noexcept @@ -972,17 +972,17 @@ namespace ip address_v4 _M_address; }; - typedef basic_address_iterator address_v4_iterator; + using address_v4_iterator = basic_address_iterator; template<> class basic_address_iterator { public: // types: - typedef address_v6 value_type; - typedef ptrdiff_t difference_type; - typedef const address_v6* pointer; - typedef const address_v6& reference; - typedef input_iterator_tag iterator_category; + using value_type = address_v6; + using difference_type = ptrdiff_t; + using pointer = const address_v6*; + using reference = const address_v6&; + using iterator_category = input_iterator_tag; // constructors: basic_address_iterator(const address_v6& __a) noexcept @@ -1026,7 +1026,7 @@ namespace ip address_v6 _M_address; }; - typedef basic_address_iterator address_v6_iterator; + using address_v6_iterator = basic_address_iterator; template class basic_address_range; // not defined @@ -1039,7 +1039,7 @@ namespace ip public: // types: - typedef basic_address_iterator iterator; + using iterator = basic_address_iterator; // constructors: @@ -1071,7 +1071,7 @@ namespace ip iterator _M_end; }; - typedef basic_address_range address_v4_range; + using address_v4_range = basic_address_range; // @} @@ -1084,7 +1084,7 @@ namespace ip public: // types: - typedef basic_address_iterator iterator; + using iterator = basic_address_iterator; // constructors: @@ -1112,7 +1112,7 @@ namespace ip iterator _M_end; }; - typedef basic_address_range address_v6_range; + using address_v6_range = basic_address_range; // @} @@ -1384,7 +1384,7 @@ namespace ip { public: // types: - typedef _InternetProtocol protocol_type; + using protocol_type = _InternetProtocol; // constructors: @@ -1574,8 +1574,8 @@ namespace ip { public: // types: - typedef _InternetProtocol protocol_type; - typedef typename _InternetProtocol::endpoint endpoint_type; + using protocol_type = _InternetProtocol; + using endpoint_type = typename _InternetProtocol::endpoint; // constructors: basic_resolver_entry() { } @@ -1697,15 +1697,15 @@ namespace ip { public: // types: - typedef _InternetProtocol protocol_type; - typedef typename protocol_type::endpoint endpoint_type; - typedef basic_resolver_entry value_type; - typedef const value_type& const_reference; - typedef value_type& reference; - typedef typename forward_list::const_iterator const_iterator; - typedef const_iterator iterator; - typedef ptrdiff_t difference_type; - typedef size_t size_type; + using protocol_type = _InternetProtocol; + using endpoint_type = typename protocol_type::endpoint; + using value_type = basic_resolver_entry; + using const_reference = const value_type&; + using reference = value_type&; + using const_iterator = typename forward_list::const_iterator; + using iterator = const_iterator; + using difference_type = ptrdiff_t; + using size_type = size_t; // construct / copy / destroy: @@ -1775,10 +1775,10 @@ namespace ip public: // types: - typedef io_context::executor_type executor_type; - typedef _InternetProtocol protocol_type; - typedef typename _InternetProtocol::endpoint endpoint_type; - typedef basic_resolver_results<_InternetProtocol> results_type; + using executor_type = io_context::executor_type; + using protocol_type = _InternetProtocol; + using endpoint_type = typename _InternetProtocol::endpoint; + using results_type = basic_resolver_results<_InternetProtocol>; // construct / copy / destroy: @@ -2056,11 +2056,11 @@ namespace ip { public: // types: - typedef basic_endpoint endpoint; ///< A TCP endpoint. - typedef basic_resolver resolver; ///< A TCP resolver. - typedef basic_stream_socket socket; ///< A TCP socket. - typedef basic_socket_acceptor acceptor; ///< A TCP acceptor. - typedef basic_socket_iostream iostream; /// A TCP iostream. + using endpoint = basic_endpoint; ///< A TCP endpoint. + using resolver = basic_resolver; ///< A TCP resolver. + using socket = basic_stream_socket; ///< A TCP socket. + using acceptor = basic_socket_acceptor; ///< A TCP acceptor. + using iostream = basic_socket_iostream; /// A TCP iostream. #ifdef _GLIBCXX_HAVE_NETINET_TCP_H /// Disable coalescing of small segments (i.e. the Nagle algorithm). @@ -2111,9 +2111,9 @@ namespace ip { public: // types: - typedef basic_endpoint endpoint; - typedef basic_resolver resolver; - typedef basic_datagram_socket socket; + using endpoint = basic_endpoint; + using resolver = basic_resolver; + using socket = basic_datagram_socket; // static members: static constexpr udp v4() noexcept { return udp(AF_INET); } diff --git a/libstdc++-v3/include/experimental/socket b/libstdc++-v3/include/experimental/socket index 81b1d15b654..837965cb3c0 100644 --- a/libstdc++-v3/include/experimental/socket +++ b/libstdc++-v3/include/experimental/socket @@ -701,10 +701,10 @@ inline namespace v1 public: // types: - typedef io_context::executor_type executor_type; - typedef int native_handle_type; - typedef _Protocol protocol_type; - typedef typename protocol_type::endpoint endpoint_type; + using executor_type = io_context::executor_type; + using native_handle_type = int; + using protocol_type = _Protocol; + using endpoint_type = typename protocol_type::endpoint; // basic_socket operations: @@ -1067,9 +1067,9 @@ inline namespace v1 public: // types: - typedef int native_handle_type; - typedef _Protocol protocol_type; - typedef typename protocol_type::endpoint endpoint_type; + using native_handle_type = int; + using protocol_type = _Protocol; + using endpoint_type = typename protocol_type::endpoint; // construct / copy / destroy: @@ -1520,9 +1520,9 @@ inline namespace v1 public: // types: - typedef int native_handle_type; - typedef _Protocol protocol_type; - typedef typename protocol_type::endpoint endpoint_type; + using native_handle_type = int; + using protocol_type = _Protocol; + using endpoint_type = typename protocol_type::endpoint; // construct / copy / destroy: @@ -1833,11 +1833,11 @@ inline namespace v1 public: // types: - typedef io_context::executor_type executor_type; - typedef int native_handle_type; - typedef _AcceptableProtocol protocol_type; - typedef typename protocol_type::endpoint endpoint_type; - typedef typename protocol_type::socket socket_type; + using executor_type = io_context::executor_type; + using native_handle_type = int; + using protocol_type = _AcceptableProtocol; + using endpoint_type = typename protocol_type::endpoint; + using socket_type = typename protocol_type::socket; // construct / copy / destroy: @@ -2277,12 +2277,12 @@ inline namespace v1 public: // types: - typedef _Protocol protocol_type; - typedef typename protocol_type::endpoint endpoint_type; - typedef _Clock clock_type; - typedef typename clock_type::time_point time_point; - typedef typename clock_type::duration duration; - typedef _WaitTraits wait_traits_type; + using protocol_type = _Protocol; + using endpoint_type = typename protocol_type::endpoint; + using clock_type = _Clock; + using time_point = typename clock_type::time_point; + using duration = typename clock_type::duration; + using wait_traits_type = _WaitTraits; // construct / copy / destroy: @@ -2355,12 +2355,12 @@ inline namespace v1 public: // types: - typedef _Protocol protocol_type; - typedef typename protocol_type::endpoint endpoint_type; - typedef _Clock clock_type; - typedef typename clock_type::time_point time_point; - typedef typename clock_type::duration duration; - typedef _WaitTraits wait_traits_type; + using protocol_type = _Protocol; + using endpoint_type = typename protocol_type::endpoint; + using clock_type = _Clock; + using time_point = typename clock_type::time_point; + using duration = typename clock_type::duration; + using wait_traits_type = _WaitTraits; // construct / copy / destroy: diff --git a/libstdc++-v3/include/experimental/timer b/libstdc++-v3/include/experimental/timer index d50ca76c2df..58249d0387d 100644 --- a/libstdc++-v3/include/experimental/timer +++ b/libstdc++-v3/include/experimental/timer @@ -81,11 +81,11 @@ inline namespace v1 public: // types: - typedef io_context::executor_type executor_type; - typedef _Clock clock_type; - typedef typename clock_type::duration duration; - typedef typename clock_type::time_point time_point; - typedef _WaitTraits traits_type; + using executor_type = io_context::executor_type; + using clock_type = _Clock; + using duration = typename clock_type::duration; + using time_point = typename clock_type::time_point; + using traits_type = _WaitTraits; // construct / copy / destroy: @@ -170,10 +170,10 @@ inline namespace v1 friend class io_context; }; - typedef basic_waitable_timer system_timer; - typedef basic_waitable_timer steady_timer; - typedef basic_waitable_timer - high_resolution_timer; + using system_timer = basic_waitable_timer; + using steady_timer = basic_waitable_timer; + using high_resolution_timer + = basic_waitable_timer; template void -- 2.30.2