]> gcc.gnu.org Git - gcc.git/commit
libstdc++: Fix socket option classes
authorJonathan Wakely <jwakely@redhat.com>
Mon, 26 Apr 2021 20:16:21 +0000 (21:16 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 24 Aug 2021 14:13:17 +0000 (15:13 +0100)
commit91e84187e4ddac74135f1540065c25816cad044c
tree5c89e21195c867978cf1e865151a7cd1dcf55a8e
parentedcf1b0de47e503fd7afe7095bfdffbe9475f13f
libstdc++: Fix socket option classes

This fixes some flaws in the socket option types defined in
net::socket_base:

- The constructors were not noexcept.
- The __sockopt_base<T>::value() member function was present
  unconditionally (so was defined for socket_base::linger which is
  incorrect).
- The __socket_crtp<C, T>::operator=(T) assignment operator was not
  noexcept, and was hidden in the derived classes.

Also:

- Use class instead of struct for the socket option types.
- Define the _S_level and _S_name constants as private.
- Declare the __socket_crtp base as a friend.

libstdc++-v3/ChangeLog:

* include/experimental/bits/net.h (__socket_base): Add
bool template parameter to allow BooleanSocketOption and
IntegerSocketOption to have different __socket_base<int>
base classes.
(__socket_base<bool>): Adjust base class.
(__socket_base<int>): Add partial specialization.
(__socket_crtp::operator=(_Tp)): Add noexcept-specifier.
* include/experimental/socket (socket_base::broadcast)
(socket_base::debug, socket_base::do_not_route)
(socket_base::keep_alive, socket_base::linger)
(socket_base::out_of_band_inline)
(socket_base::receive_buffer_size)
(socket_base::receive_low_watermark)
(socket_base::reuse_address, socket_base::send_buffer_size)
(socket_base::send_low_watermark): Add using-declaration for
__socket_crtp::operator=(_Tp).
* testsuite/experimental/net/socket/socket_base.cc: Check
properties of socket option types.

(cherry picked from commit 06c86a4f210c76a157512a2963e6c31302d161cb)
libstdc++-v3/include/experimental/bits/net.h
libstdc++-v3/include/experimental/socket
libstdc++-v3/testsuite/experimental/net/socket/socket_base.cc
This page took 0.059424 seconds and 5 git commands to generate.