aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
AgeCommit message (Collapse)AuthorFilesLines
2018-10-23PR libstdc++/87704 fix unique_ptr(nullptr_t) constructorsJonathan Wakely3-4/+48
Using a delegating constructor to implement these constructors means that they instantiate the destructor, which requires the element_type to be complete. In C++11 and C++14 they were specified to be delegating, but that was changed as part of LWG 2801 so in C++17 they don't require a complete type (as was intended all along). PR libstdc++/87704 * include/bits/unique_ptr.h (unique_ptr::unique_ptr(nullptr_t)): Do not delegate to default constructor. (unique_ptr<T[], D>::unique_ptr(nullptr_t)): Likewise. * testsuite/20_util/unique_ptr/cons/incomplete.cc: New test. From-SVN: r265423
2018-10-20testsuite_containers.h ↵François Dumont3-4/+21
(forward_members_unordered<>::forward_members_unordered (const value_type&)): Add local_iterator pre and post increment checks. 2018-10-20 François Dumont <fdumont@gcc.gnu.org> * testsuite/util/testsuite_containers.h (forward_members_unordered<>::forward_members_unordered (const value_type&)): Add local_iterator pre and post increment checks. * config/abi/pre/gnu.ver: Add GLIBCXX_3.4.26 new symbol. From-SVN: r265344
2018-10-19Skip tests for GNU extensions when testing with strict modeJonathan Wakely15-8/+66
Tests for the implicit allocator rebinding extension will fail if the extension is disabled, so skip them. * testsuite/23_containers/array/requirements/explicit_instantiation/ 3.cc: Skip test when compiled with a -std=c++NN strict mode. * testsuite/23_containers/deque/requirements/explicit_instantiation/ 3.cc: Likewise. * testsuite/23_containers/forward_list/requirements/ explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/list/requirements/explicit_instantiation/ 3.cc: Likewise. * testsuite/23_containers/map/requirements/explicit_instantiation/ 3.cc: Likewise. * testsuite/23_containers/multimap/requirements/explicit_instantiation/ 3.cc: Likewise. * testsuite/23_containers/multiset/requirements/explicit_instantiation/ 3.cc: Likewise. * testsuite/23_containers/set/requirements/explicit_instantiation/ 3.cc: Likewise. * testsuite/23_containers/unordered_map/requirements/ explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/unordered_multiset/requirements/ explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/unordered_set/requirements/ explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/vector/ext_pointer/explicit_instantiation/ 3.cc: Likewise. * testsuite/23_containers/vector/requirements/explicit_instantiation/ 3.cc: Likewise. From-SVN: r265334
2018-10-19Fix testsuite failures due to extra errors in strict dialectsJonathan Wakely9-0/+18
When __STRICT_ANSI__ is defined the incorrect allocators used in these tests also trigger and additional static assertion. Prune those extra errors so that the tests don't fail when built with strict dialects. * testsuite/23_containers/deque/48101_neg.cc: Prune additional errors printed when __STRICT_ANSI__ is defined. * testsuite/23_containers/forward_list/48101_neg.cc: Likewise. * testsuite/23_containers/list/48101_neg.cc: Likewise. * testsuite/23_containers/multiset/48101_neg.cc: Likewise. * testsuite/23_containers/set/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_multiset/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_set/48101_neg.cc: Likewise. * testsuite/23_containers/vector/48101_neg.cc: Likewise. From-SVN: r265333
2018-10-19Conditionally disable tests of non-standard extensionsJonathan Wakely12-6/+58
These tests include uses of the extension to allow allocators with the wrong value_type in containers. Skip those parts of the tests when __STRICT_ANIS__ is defined. * testsuite/23_containers/forward_list/requirements/ explicit_instantiation/5.cc [__STRICT_ANSI__]: Don't test non-standard extension. * testsuite/23_containers/list/requirements/explicit_instantiation/ 5.cc [__STRICT_ANSI__]: Likewise. * testsuite/23_containers/map/requirements/explicit_instantiation/5.cc [__STRICT_ANSI__]: Likewise. * testsuite/23_containers/multimap/requirements/explicit_instantiation/ 5.cc [__STRICT_ANSI__]: Likewise. * testsuite/23_containers/multiset/requirements/explicit_instantiation/ 5.cc [__STRICT_ANSI__]: Likewise. * testsuite/23_containers/set/requirements/explicit_instantiation/5.cc [__STRICT_ANSI__]: Likewise. * testsuite/23_containers/unordered_map/requirements/debug_container.cc [__STRICT_ANSI__]: Likewise. * testsuite/23_containers/unordered_map/requirements/ explicit_instantiation/5.cc [__STRICT_ANSI__]: Likewise. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation/5.cc [__STRICT_ANSI__]: Likewise. * testsuite/23_containers/unordered_multiset/requirements/ explicit_instantiation/5.cc [__STRICT_ANSI__]: Likewise. * testsuite/23_containers/unordered_set/requirements/ explicit_instantiation/5.cc [__STRICT_ANSI__]: Likewise. From-SVN: r265332
2018-10-19Fix tests that use allocators with incorrect value typesJonathan Wakely27-68/+111
As a GNU extension we allow containers to be instantiated with allocators that use a different value type from the container, and automatically rebind the allocator to the correct type. This extension is disabled in strict modes (when __STRICT_ANSI__ is defined, i.e. -std=c++NN dialects). These testcases unintentionally rely on the extension and so fail for strict modes. Tests which intentionally make use of the extension will still fail in strict dialects, but will be addressed in a later change. * testsuite/20_util/scoped_allocator/1.cc: Use allocator with correct value type for the container. * testsuite/23_containers/forward_list/cons/14.cc: Likewise. * testsuite/23_containers/map/56613.cc: Likewise. * testsuite/23_containers/unordered_map/55043.cc: Likewise. * testsuite/23_containers/unordered_map/allocator/copy.cc: Likewise. * testsuite/23_containers/unordered_map/allocator/copy_assign.cc: Likewise. * testsuite/23_containers/unordered_map/allocator/minimal.cc: Likewise. * testsuite/23_containers/unordered_map/allocator/move.cc: Likewise. * testsuite/23_containers/unordered_map/allocator/move_assign.cc: Likewise. * testsuite/23_containers/unordered_map/allocator/noexcept.cc: Likewise. * testsuite/23_containers/unordered_map/cons/81891.cc: Likewise. * testsuite/23_containers/unordered_map/requirements/exception/ basic.cc: Likewise. * testsuite/23_containers/unordered_map/requirements/exception/ generation_prohibited.cc: Likewise. * testsuite/23_containers/unordered_map/requirements/exception/ propagation_consistent.cc: Likewise. * testsuite/23_containers/unordered_multimap/55043.cc: Likewise. * testsuite/23_containers/unordered_multimap/allocator/copy.cc: Likewise. * testsuite/23_containers/unordered_multimap/allocator/copy_assign.cc: Likewise. * testsuite/23_containers/unordered_multimap/allocator/minimal.cc: Likewise. * testsuite/23_containers/unordered_multimap/allocator/move.cc: Likewise. * testsuite/23_containers/unordered_multimap/allocator/move_assign.cc: Likewise. * testsuite/23_containers/unordered_multimap/allocator/noexcept.cc: Likewise. * testsuite/23_containers/unordered_multimap/requirements/exception/ basic.cc: Likewise. * testsuite/23_containers/unordered_multimap/requirements/exception/ generation_prohibited.cc: Likewise. * testsuite/23_containers/unordered_multimap/requirements/exception/ propagation_consistent.cc: Likewise. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation/5.cc: Likewise. * testsuite/ext/malloc_allocator/sanity.cc: Likewise. From-SVN: r265331
2018-10-19Disable tests that only pass for GNU dialectsJonathan Wakely13-0/+26
The airy and hypergeometric functions are non-standard extensions and are only defined for -std=gnu++NN dialects, not -std=c++NN ones. * ext/special_functions/airy_ai/check_nan.cc: Skip test for non-standard extension when a strict -std=c++NN dialect is used. * ext/special_functions/airy_ai/check_value.cc: Likewise. * ext/special_functions/airy_ai/compile.cc: Likewise. * ext/special_functions/airy_bi/check_nan.cc: Likewise. * ext/special_functions/airy_bi/check_value.cc: Likewise. * ext/special_functions/airy_bi/compile.cc: Likewise. * ext/special_functions/conf_hyperg/check_nan.cc: Likewise. * ext/special_functions/conf_hyperg/check_value.cc: Likewise. * ext/special_functions/conf_hyperg/compile.cc: Likewise. * ext/special_functions/hyperg/check_nan.cc: Likewise. * ext/special_functions/hyperg/check_value.cc: Likewise. * ext/special_functions/hyperg/compile.cc: Likewise. From-SVN: r265330
2018-10-19Remove duplicate testsJonathan Wakely6-148/+12
These tests originally existed to check the containers in C++11 mode, when the default was C++98 mode. Now that the default is C++14 (and we run most tests for all modes) it serves no purpose to have two copies of the tests when neither is explicitly using -std=gnu++98 anyway. * testsuite/23_containers/list/requirements/explicit_instantiation/ 5_c++0x.cc: Remove redundant test that is functionally identical to the 5.cc test. * testsuite/23_containers/map/requirements/explicit_instantiation/ 5_c++0x.cc: Likewise. * testsuite/23_containers/multimap/requirements/explicit_instantiation/ 5_c++0x.cc: Likewise. * testsuite/23_containers/multiset/requirements/explicit_instantiation/ 5_c++0x.cc: Likewise. * testsuite/23_containers/set/requirements/explicit_instantiation/ 5_c++0x.cc: Likewise. From-SVN: r265329
2018-10-19Fix compilation error with _GLIBCXX_PARALLELJonathan Wakely4-5/+30
* include/bits/regex_executor.tcc (_Backref_matcher::_M_apply): Use _GLIBCXX_STD_A to refer to normal mode algorithms. * testsuite/28_regex/headers/regex/parallel_mode.cc: New test. * testsuite/28_regex/headers/regex/std_c++0x_neg.cc: Remove empty whitespace. From-SVN: r265314
2018-10-19Fix testsuite failures in Debug ModeJonathan Wakely5-0/+16
This fixes the following testsuite failures on ia32 when compiled with -D_GLIBCXX_DEBUG: FAIL: 23_containers/map/modifiers/erase/dr130-linkage-check.cc FAIL: 23_containers/multimap/modifiers/erase/dr130-linkage-check.cc FAIL: 23_containers/multiset/modifiers/erase/dr130-linkage-check.cc FAIL: 23_containers/set/modifiers/erase/dr130-linkage-check.cc The normal mode containers already use the abi-tag to mangle these overloads differently, but the debug mode versions weren't fixed. * include/debug/map.h (map::erase(iterator)): Add abi-tag so that C++11 version mangles differently from incompatible C++98 version. * include/debug/multimap.h (multimap::erase(iterator)): Likewise. * include/debug/multiset.h (multiset::erase(iterator)) (multiset::erase(const_iterator, const_iterator)): Likewise. * include/debug/set.h (set::erase(iterator)) (multiset::erase(const_iterator, const_iterator)): Likewise. From-SVN: r265313
2018-10-18Fix tests that fail when built with different optionsJonathan Wakely3-0/+8
* testsuite/20_util/duration/cons/2.cc: Add -ffloat-store to fix failure when compiled without optimisation. * testsuite/ext/profile/mutex_extensions_neg.cc: Prune additional errors caused by C++17 std::pmr alias templates. From-SVN: r265287
2018-10-18PR libstdc++/87642 handle multibyte thousands separators from libcJonathan Wakely3-4/+76
If a locale's THOUSANDS_SEP or MON_THOUSANDS_SEP string is not a single character we either need to narrow it to a single char or ignore it (and therefore disable digit grouping for that facet). PR libstdc++/87642 * config/locale/gnu/monetary_members.cc (moneypunct<char, true>::_M_initialize_moneypunct): Use __narrow_multibyte_chars to convert multibyte thousands separators to a single char. * config/locale/gnu/numeric_members.cc (numpunct<char>::_M_initialize_numpunct): Likewise. (__narrow_multibyte_chars): New function. From-SVN: r265286
2018-10-18PR libstdc++/87641 correctly initialize accumulator in valarray::sum()Jonathan Wakely4-22/+103
Use the value of the first element as the initial value of the __valarray_sum accumulator. Value-initialization might not create the additive identity for the value type. Make a similar change to __valarray_product even though it's only ever used internally with a value_type of size_t. PR libstdc++/87641 * include/bits/valarray_array.h (__valarray_sum): Use first element to initialize accumulator instead of value-initializing it. (__valarray_product<_Tp>): Move to ... * src/c++98/valarray.cc (__valarray_product<_Tp>): Here. Use first element to initialize accumulator. (__valarray_product(const valarray<size_t>&)): Remove const_cast made unnecessary by LWG 389. * testsuite/26_numerics/valarray/87641.cc: New test. From-SVN: r265270
2018-10-18revert: [multiple changes]François Dumont3-22/+41
2018-10-18 François Dumont <fdumont@gcc.gnu.org> Partial revert. 2018-10-08 François Dumont <fdumont@gcc.gnu.org> * include/debug/list (list<>::cbegin()): Use C++11 direct initialization. (list<>::cend()): Likewise. (list<>::erase(const_iterator, const_iterator)): Ensure consistent iterator comparisons. (list<>::splice(const_iterator, list&&, const_iterator, const_iterator)): Likewise. Partial revert. 2018-10-15 François Dumont <fdumont@gcc.gnu.org> * include/debug/vector (vector<>::cbegin()): Use C++11 direct initialization. (vector<>::cend()): Likewise. (vector<>::insert(const_iterator, const _Tp&)): Use consistent iterator comparison. (vector<>::erase(const_iterator)): Likewise. (vector<>::erase(const_iterator, const_iterator)): Likewise. From-SVN: r265259
2018-10-17re PR libstdc++/87619 (sizeof(std::variant) can be reduced if its ↵Ville Voutilainen3-1/+60
variant_size is UCHAR_MAX) PR libstdc++/87619 * include/std/variant (__select_index): Fix an off-by-one. * testsuite/20_util/variant/87619.cc: New. From-SVN: r265247
2018-10-16Fix regression in std::random_device default constructorJonathan Wakely2-1/+4
When the default constructor was split out into a separate function (in r261522) I accidentally made it call _M_init("mt19937") instead of _M_init_pretr1("mt19937"). That means it will always throw an exception, because "mt19937" isn't a valid token accepted by the _M_init function. Restore the original behaviour by calling _M_init_pretr1("mt19937"). * include/bits/random.h (random_device) [!_GLIBCXX_USE_DEV_RANDOM]: Fix default constructor to call correct function. From-SVN: r265218
2018-10-16Rename namespace alias in test to avoid name collisionJonathan Wakely2-12/+16
* testsuite/experimental/net/internet/address/v4/creation.cc: Do not declare ip in global namespace, to avoid collision with struct ip defined in <netinet/ip.h>. From-SVN: r265205
2018-10-16Fix versioned namespace macros for Networking TSJonathan Wakely9-38/+28
We no longer put the versioned namespace macros on the innermost namespace, but always nested directly below namespace std. * include/experimental/bits/net.h: Move versioned namespace macros to correct location. * include/experimental/buffer: Likewise. * include/experimental/executor: Likewise. * include/experimental/internet: Likewise. * include/experimental/io_context: Likewise. * include/experimental/netfwd: Likewise. * include/experimental/socket: Likewise. * include/experimental/timer: Likewise. From-SVN: r265204
2018-10-16Use autoconf to check for features needed by Networking TSJonathan Wakely8-36/+290
* config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Check for headers used by Networking TS. * include/experimental/executor: Include <condition_variable> instead of <mutex>. * include/experimental/internet: Use autoconf macros for available headers. Include <sys/socket.h> for. Remove <cstring> and use __builtin_memcpy and __builtin_strchr. (resolver_errc) [!_GLIBCXX_HAVE_NETDB_H]: Do not define. (address_v4::to_string, address_v6::to_string) [!_GLIBCXX_HAVE_ARPA_INET_H]: Likewise. (basic_resolver_results) [!_GLIBCXX_HAVE_NETDB_H]: Make private constructors report errors. [!_GLIBCXX_HAVE_NETINET_TCP_H] (tcp::no_delay): Do not define. * include/experimental/io_context: Likewise. * include/experimental/socket: Likewise. [!_GLIBCXX_HAVE_SYS_SOCKET_H, !_GLIBCXX_HAVE_POLL_H] (socket_base): Do not define nested types when relevant header not available. (__socket_impl::native_non_blocking) [!_GLIBCXX_HAVE_FCNTL_H]: Report an error. (__basic_socket_impl::open, __basic_socket_impl::local_endpoint) (__basic_socket_impl::bind) [!_GLIBCXX_HAVE_SYS_SOCKET_H]: Likewise. (__basic_socket_impl::io_control) [!_GLIBCXX_HAVE_SYS_IOCTL_H]: Likewise. (basic_socket::at_mark, basic_socket::shutdown) (basic_socket::remote_endpoint, basic_socket::connect) (basic_socket::async_connect) [!_GLIBCXX_HAVE_SYS_SOCKET_H]: Likewise. (basic_socket::available) [_GLIBCXX_HAVE_SYS_IOCTL_H]: Check macro for <sys/ioctl.h> availability. (basic_socket::wait) [!_GLIBCXX_HAVE_POLL_H]: Likewise. (basic_datagram_socket::receive, basic_datagram_socket::async_receive) (basic_datagram_socket::receive_from) (basic_datagram_socket::async_receive_from) (basic_datagram_socket::send, basic_datagram_socket::async_send) (basic_datagram_socket::send_to, basic_datagram_socket::async_send_to) [!_GLIBCXX_HAVE_SYS_SOCKET_H]: Likewise. (basic_stream_socket::receive, basic_stream_socket::async_receive) (basic_stream_socket::send, basic_stream_socket::async_send) [!_GLIBCXX_HAVE_SYS_SOCKET_H]: Likewise. (basic_socket_acceptor::listen, basic_socket_acceptor::accept) (basic_socket_acceptor::async_accept) [!_GLIBCXX_HAVE_SYS_SOCKET_H]: Likewise. (basic_socket_acceptor::wait) [!_GLIBCXX_HAVE_POLL_H]: Likewise. From-SVN: r265203
2018-10-16Use effective target in Networking TS testsJonathan Wakely19-19/+42
* testsuite/experimental/net/headers.cc: Remove dg-options. * testsuite/experimental/net/buffer/arithmetic.cc: Replace dg-options with dg-do using effective target. * testsuite/experimental/net/buffer/const.cc: Likewise. * testsuite/experimental/net/buffer/creation.cc: Likewise. * testsuite/experimental/net/buffer/mutable.cc: Likewise. * testsuite/experimental/net/buffer/size.cc: Likewise. * testsuite/experimental/net/buffer/traits.cc: Likewise. * testsuite/experimental/net/execution_context/use_service.cc: Likewise. * testsuite/experimental/net/internet/address/v4/comparisons.cc: Likewise. * testsuite/experimental/net/internet/address/v4/cons.cc: Likewise. * testsuite/experimental/net/internet/address/v4/creation.cc: Likewise. * testsuite/experimental/net/internet/address/v4/members.cc: Likewise. * testsuite/experimental/net/internet/resolver/base.cc: Likewise. * testsuite/experimental/net/internet/resolver/ops/lookup.cc: Likewise. * testsuite/experimental/net/internet/resolver/ops/reverse.cc: Likewise. * testsuite/experimental/net/timer/waitable/cons.cc: Likewise. * testsuite/experimental/net/timer/waitable/dest.cc: Likewise. * testsuite/experimental/net/timer/waitable/ops.cc: Likewise. From-SVN: r265200
2018-10-16Add missing returnJonathan Wakely2-4/+7
* include/experimental/socket (basic_socket::at_mark): Add missing return. From-SVN: r265199
2018-10-16Define _GLIBCXX_USE_DEV_RANDOM as replacement for _GLIBCXX_USE_RANDOM_TR1Jonathan Wakely8-29/+60
Define and use a new macro with a more descriptive name. Only use the old macro in <tr1/random.h>. * acinclude.m4 (GLIBCXX_CHECK_RANDOM_TR1): Replace with ... (GLIBCXX_CHECK_DEV_RANDOM): New macro with more descriptive name. Define _GLIBCXX_USE_DEV_RANDOM as well as _GLIBCXX_USE_RANDOM_TR1. * config.h.in: Regenerate. * configure: Regenerate. * configure.ac: Use GLIBCXX_CHECK_DEV_RANDOM instead of GLIBCXX_CHECK_RANDOM_TR1. crossconfig.m4: Likewise. * include/bits/random.h (random_device): Use _GLIBCXX_USE_DEV_RANDOM instead of _GLIBCXX_USE_RANDOM_TR1. * testsuite/26_numerics/random/random_device/cons/token.cc: Likewise. From-SVN: r265197
2018-10-16Introduce dg-add-options net_tsRainer Orth9-0/+30
* testsuite/lib/dg-options.exp (add_options_for_net_ts): New proc. * testsuite/experimental/net/internet/address/v4/comparisons.cc: Add dg-add-options net_ts. * testsuite/experimental/net/internet/address/v4/cons.cc: Likewise. * testsuite/experimental/net/internet/address/v4/creation.cc: Likewise. * testsuite/experimental/net/internet/address/v4/members.cc: Likewise. * testsuite/experimental/net/internet/resolver/base.cc: Likewise. * testsuite/experimental/net/internet/resolver/ops/lookup.cc: Likewise. * testsuite/experimental/net/internet/resolver/ops/reverse.cc: Likewise. From-SVN: r265192
2018-10-16Fix tests that fail when compiled without optimisationJonathan Wakely4-1/+11
* testsuite/20_util/duration/literals/range_neg.cc: Adjust pruned diagnostic to account for quotes around 'constexpr'. * testsuite/23_containers/deque/capacity/max_size.cc: Define static variable. * testsuite/23_containers/vector/capacity/max_size.cc: Likewise. From-SVN: r265190
2018-10-16PR libstdc++/87618 fix typos in linker scriptJonathan Wakely4-4/+30
PR libstdc++/87618 * config/abi/pre/gnu.ver: Fix typos in patterns for basic_stringbuf. * testsuite/27_io/basic_stringbuf/cons/char/default.cc: Disable optimisation to check constructor definition can be linked to. * testsuite/27_io/basic_stringbuf/cons/wchar_t/default.cc: Likewise. From-SVN: r265188
2018-10-15Adjust test to pass with latest glibcJonathan Wakely2-2/+7
Glibc changed the it_IT locales to use thousands separators, invalidating this test. Use nl_NL instead, as Dutch only uses grouping for money not numbers. * testsuite/22_locale/numpunct/members/char/3.cc: Adjust test to account for change to glibc it_IT localedata (glibc bz#10797). From-SVN: r265165
2018-10-15PR libstdc++/87587 prevent -Wabi warningsJonathan Wakely2-0/+12
The warnings about changes to empty struct parameter passing can be ignored because the callers are all internal to the library, and so compiled with the same -fabi-version as the function definitions. It would be preferable to use #pragma GCC diagnostic warning "-Wabi=12" to get warnings about any other ABI changes in future versions, but until PR c++/87611 is fixed the warnings must be completely disabled with #pragma GCC diagnostic ignroed "-Wabi". PR libstdc++/87587 * src/c++11/cxx11-shim_facets.cc: Suppress -Wabi warnings. From-SVN: r265163
2018-10-15vector (vector<>::cbegin()): Use C++11 direct initialization.François Dumont2-10/+26
2018-10-15 François Dumont <fdumont@gcc.gnu.org> * include/debug/vector (vector<>::cbegin()): Use C++11 direct initialization. (vector<>::cend()): Likewise. (vector<>::emplace(const_iterator, _Args&&...)): Likewise and use consistent iterator comparison. (vector<>::insert(const_iterator, size_type, const _Tp&)): Likewise. (vector<>::insert(const_iterator, _InputIterator, _InputIterator)): Likewise. (vector<>::erase(const_iterator)): Likewise. (vector<>::erase(const_iterator, const_iterator)): Likewise. From-SVN: r265156
2018-10-12Initial commit of Networking TS implementationJonathan Wakely30-0/+10668
* include/Makefile.am: Add new headers. * include/Makefile.in: Regenerate. * include/experimental/bits/net.h: New header for common implementation details of Networking TS. * include/experimental/buffer: New header. * include/experimental/executor: New header. * include/experimental/internet: New header. * include/experimental/io_context: New header. * include/experimental/net: New header. * include/experimental/netfwd: New header. * include/experimental/socket: New header. * include/experimental/timer: New header. * testsuite/experimental/net/buffer/arithmetic.cc: New test. * testsuite/experimental/net/buffer/const.cc: New test. * testsuite/experimental/net/buffer/creation.cc: New test. * testsuite/experimental/net/buffer/mutable.cc: New test. * testsuite/experimental/net/buffer/size.cc: New test. * testsuite/experimental/net/buffer/traits.cc: New test. * testsuite/experimental/net/execution_context/use_service.cc: New test. * testsuite/experimental/net/headers.cc: New test. * testsuite/experimental/net/internet/address/v4/comparisons.cc: New test. * testsuite/experimental/net/internet/address/v4/cons.cc: New test. * testsuite/experimental/net/internet/address/v4/creation.cc: New test. * testsuite/experimental/net/internet/address/v4/members.cc: New test. * testsuite/experimental/net/internet/resolver/base.cc: New test. * testsuite/experimental/net/internet/resolver/ops/lookup.cc: New test. * testsuite/experimental/net/internet/resolver/ops/reverse.cc: New test. * testsuite/experimental/net/timer/waitable/cons.cc: New test. * testsuite/experimental/net/timer/waitable/dest.cc: New test. * testsuite/experimental/net/timer/waitable/ops.cc: New test. From-SVN: r265080
2018-10-12PR libstdc++/77691 increase allocation size to at least alignmentJonathan Wakely3-5/+23
It's not safe to assume that malloc(n) returns memory aligned to more than n, so when relying on the guaranteed alignment of malloc ensure that the number of bytes allocated is at least as large as the alignment. PR libstdc++/77691 * include/experimental/memory_resource (__resource_adaptor_imp): Do not allocate sizes smaller than alignment when relying on guaranteed alignment. * testsuite/experimental/memory_resource/new_delete_resource.cc: Adjust expected number of bytes allocated for alignof(max_align_t). From-SVN: r265068
2018-10-112018-10-11 François Dumont <fdumont@gcc.gnu.org>François Dumont2-20/+37
* include/debug/forward_list (forward_list<>::before_begin()): Use C++11 direct initialization. (forward_list<>::begin()): Likewise. (forward_list<>::end()): Likewise. (forward_list<>::cbefore_begin()): Likewise. (forward_list<>::cbegin()): Likewise. (forward_list<>::cend()): Likewise. (forward_list<>::emplace_after<>(const_iterator, _Args&&...)): Likewise. (forward_list<>::insert_after(const_iterator, const _Tp&)): Likewise. (forward_list<>::insert_after(const_iterator, _Tp&&)): Likewise. (forward_list<>::insert_after(const_iterator, size_type, const _Tp&)): Likewise. (forward_list<>::insert_after(const_iterator, initializer_list<>)): Likewise. (forward_list<>::erase_after(const_iterator)): Likewise. (forward_list<>::erase_after(const_iterator, const_iterator)): Likewise and ensure consistent iterator comparison. From-SVN: r265061
2018-10-112018-10-11 François Dumont <fdumont@gcc.gnu.org>François Dumont2-33/+44
* include/bits/forward_list.h (_Fwd_list_iterator<>::operator==): Replace member function with inline friend. (_Fwd_list_iterator<>::operator!=): Likewise. (_Fwd_list_const_iterator<>::operator==): Likewise. (_Fwd_list_const_iterator<>::operator!=): Likewise. (operator==(const _Fwd_list_iterator<>&, const _Fwd_list_const_iterator<>&)): Remove. (operator!=(const _Fwd_list_iterator<>&, const _Fwd_list_const_iterator<>&)): Remove. (forward_list<>::_Node): Take typedef from base type. (forward_list<>::iterator): Likewise. (forward_list<>::const_iterator): Likewise. From-SVN: r265060
2018-10-11PR libstdc++/80538 Only call sleep for non-zero valuesJonathan Wakely3-12/+48
Avoid a system call when no sleep is required. Sleep in a loop (actually two loops) to handle interruption by signals. PR libstdc++/80538 * src/c++11/thread.cc (this_thread::__sleep_for) [_GLIBCXX_HAVE_SLEEP]: Only call sleep for non-zero values. Loop while sleep call is interrupted and until steady_clock shows requested duration has elapsed. (!_GLIBCXX_HAVE_USLEEP]: Use the _GLIBCXX_HAVE_SLEEP code path, but avoiding the usleep call. * testsuite/30_threads/this_thread/60421.cc: Test repeated signal interruptions. From-SVN: r265044
2018-10-11Make ext allocators support heterogeneous equality comparisonJonathan Wakely9-40/+181
The Allocator requirements include the ability to compare different specializations of the same allocator class template. This did not work for __gnu_cxx::new_allocator and other extension allocators. This patch replaces the equality operators for those allocators with inline friends that support heterogeneous comparisons. (I'm not changing all ext allocators because some are bit-rotted already). Additionally, the equality operators for comparing two std::allocator objects of the same type are now defined as inline friends. Those overloads don't need to be declared at namespace scope, because they aren't specified in the standard (but they're needed in this implementation to avoid ambiguities caused by the extra overloads defined for the base allocator type). * include/bits/allocator.h (operator==(const allocator<_Tp>&, const allocator<_Tp>)) (operator!=(const allocator<_Tp>&, const allocator<_Tp>)): Replace with inline friends. * include/ext/debug_allocator.h (operator==, operator!=): Replace with inline friend functions that compare to rebound allocators. * include/ext/malloc_allocator.h (operator==, operator!=): Likewise. * include/ext/new_allocator.h (operator==, operator!=): Likewise. * testsuite/ext/debug_allocator/eq.cc: New test. * testsuite/ext/ext_pointer/alloc_eq.cc: New test. * testsuite/ext/malloc_allocator/eq.cc: New test. * testsuite/ext/new_allocator/eq.cc: New test. From-SVN: r265036
2018-10-10PR libstdc++/87544 limit max_size() to PTRDIFF_MAX / sizeof(T)Jonathan Wakely6-4/+105
The C++17 standard requires the default implementation for allocator_traits::max_size to return SIZE_MAX / sizeof(value_type). That causes GCC to warn because the value could be larger than can sensibly be passed to malloc. This patch changes the new_allocator and malloc_allocator max_size() members to use PTRDIFF_MAX instead of SIZE_MAX (and because they define it, the allocator_traits default isn't used). This also changes vector::max_size to impose a sensible limit using PTRDIFF_MAX for cases where the value from the allocator or allocator_traits is not sensible. PR libstdc++/87544 * include/bits/stl_vector.h (vector::_S_max_size): Limit size to PTRDIFF_MAX / sizeof(value_type). * include/ext/malloc_allocator.h (malloc_allocator::max_size): Likewise. * include/ext/new_allocator.h (new_allocator::max_size): Likewise. * testsuite/23_containers/vector/allocator/minimal.cc: Adjust expected value for max_size(). * testsuite/23_containers/vector/capacity/87544.cc: New test. From-SVN: r265021
2018-10-092018-10-09 François Dumont <fdumont@gcc.gnu.org>François Dumont2-24/+25
* include/bits/stl_list.h (_List_operator<>::operator==): Replace member function with inline friend. (_List_operator<>::operator!=): Likewise. (_List_const_operator<>::operator==): Likewise. (_List_const_operator<>::operator!=): Likewise. (operator==(const _List_iterator<>&, const _List_const_iterator<>&)): Remove. (operator!=(const _List_iterator<>&, const _List_const_iterator<>&)): Remove. From-SVN: r264993
2018-10-09Define std::string and related typedefs outside __cxx11 namespaceJonathan Wakely3-3/+12
The typedefs for common specializations of std::__cxx11::basic_string do not need to be in the std::__cxx11 namespace. Those typedefs are never used for linkage purposes so don't appear in mangled names, and so don't need to be distinct from the equivalent typedefs for the COW std::basic_string specializations. It is OK for the same typedef to refer to different types in different translation units. Defining them directly in namespace std improves diagnostics that use those typedefs. For example: error: could not convert '1' from 'int' to 'std::__cxx11::string' {aka 'std::__cxx11::basic_string<char>'} will now be printed as: error: could not convert '1' from 'int' to 'std::string' {aka 'std::__cxx11::basic_string<char>'} The precise type is still shown, but the typedef is not obfuscated with the inline namespace. * include/bits/stringfwd.h (string, wstring, u16string, u32string): Define typedefs outside of __cxx11 inline namespace. * python/libstdcxx/v6/printers.py (register_type_printers): Also register printers for typedefs in new location. From-SVN: r264958
2018-10-08PR libstdc++/87538 Verify fix for std::experimental::not_fnJonathan Wakely2-0/+51
PR libstdc++/87538 * testsuite/experimental/functional/87538.cc: New test. From-SVN: r264922
2018-10-08PR libstdc++/87538 fix std::not_fn exception specificationsJonathan Wakely3-1/+58
PR libstdc++/87538 * include/std/functional (_Not_fn::operator()): Check value of __is_nothrow_invocable as well. * testsuite/20_util/function_objects/not_fn/87538.cc: New test. From-SVN: r264921
2018-10-08list (list<>::cbegin()): Use C++11 direct initialization.François Dumont2-18/+35
2018-10-08 François Dumont <fdumont@gcc.gnu.org> * include/debug/list (list<>::cbegin()): Use C++11 direct initialization. (list<>::cend()): Likewise. (list<>::emplace<>(const_iterator, _Args&&...)): Likewise. (list<>::insert(const_iterator, initializer_list<>)): Likewise. (list<>::insert(const_iterator, size_type, const _Tp&)): Likewise. (list<>::erase(const_iterator, const_iterator)): Ensure consistent iterator comparisons. (list<>::splice(const_iterator, list&&, const_iterator, const_iterator)): Likewise. From-SVN: r264911
2018-10-052018-10-05 François Dumont <fdumont@gcc.gnu.org>François Dumont6-75/+72
* include/bits/stl_tree.h (_Rb_tree_iterator<>::operator==): Make inline friend. (_Rb_tree_iterator<>::operator!=): Likewise. (_Rb_tree_const_iterator<>::operator==): Likewise. (_Rb_tree_const_iterator<>::operator!=): Likewise. (operator==(const _Rb_tree_iterator<>&, const _Rb_tree_const_iterator&)): Remove. (operator!=(const _Rb_tree_iterator<>&, const _Rb_tree_const_iterator&)): Remove. (operator==(const _Rb_tree<>&, const _Rb_tree<>&)): Make inline friend. (operator<(const _Rb_tree<>&, const _Rb_tree<>&)): Likewise. (operator!=(const _Rb_tree<>&, const _Rb_tree<>&)): Likewise and deprecate. (operator>(const _Rb_tree<>&, const _Rb_tree<>&)): Likewise. (operator<=(const _Rb_tree<>&, const _Rb_tree<>&)): Likewise. (operator>=(const _Rb_tree<>&, const _Rb_tree<>&)): Likewise. * include/debug/map.h (map<>::erase(const_iterator, const_iterator)): Compare __victim with _Base::cend(). * include/debug/multimap.h (multimap<>::erase(const_iterator, const_iterator)): Likewise. * include/debug/set.h (set<>::erase(const_iterator, const_iterator)): Compare __victim with _Base::cend(). * include/debug/multiset.h (multiset<>::erase(const_iterator, const_iterator)): Likewise. From-SVN: r264875
2018-10-03PR libstdc++/59439 optimize uses of classic ("C") std::localeJonathan Wakely3-9/+26
The global locale::_Impl that represents the "C" locale is never destroyed, so there is no need to keep track of reference count updates for that object. This greatly reduce contention between threads that refer to the classic locale. Since the global std::locale initially uses the classic locale, this benefits the common case for any code using the global locale, such as construction/destruction of iostream objects. All these updates are done inside libstdc++.so so there's no need to worry about users' objects having inlined old versions of the code which still update the reference count for the classic locale. PR libstdc++/59439 * src/c++98/locale.cc (locale::locale(const locale&)): Bypass reference count updates for the classic locale. (locale::~locale()): Likewise. (locale::operator=(const locale&)): Likewise. * src/c++98/locale_init.cc (locale::locale()): Likewise. (locale::global(const locale&)): Likewise. From-SVN: r264811
2018-10-032018-10-03 François Dumont <fdumont@gcc.gnu.org>François Dumont5-75/+132
* include/debug/map.h (map<>::emplace<>(_Args&&...)): Use C++11 direct initialization. (map<>::emplace_hint<>(const_iterator, _Args&&...)): Likewise. (map<>::insert(value_type&&)): Likewise. (map<>::insert<>(_Pair&&)): Likewise. (map<>::insert<>(const_iterator, _Pair&&)): Likewise. (map<>::try_emplace): Likewise. (map<>::insert_or_assign): Likewise. (map<>::insert(node_type&&)): Likewise. (map<>::insert(const_iterator, node_type&&)): Likewise. (map<>::erase(const_iterator)): Likewise. (map<>::erase(const_iterator, const_iterator)): Likewise. * include/debug/multimap.h (multimap<>::emplace<>(_Args&&...)): Use C++11 direct initialization. (multimap<>::emplace_hint<>(const_iterator, _Args&&...)): Likewise. (multimap<>::insert<>(_Pair&&)): Likewise. (multimap<>::insert<>(const_iterator, _Pair&&)): Likewise. (multimap<>::insert(node_type&&)): Likewise. (multimap<>::insert(const_iterator, node_type&&)): Likewise. (multimap<>::erase(const_iterator)): Likewise. (multimap<>::erase(const_iterator, const_iterator)): Likewise. * include/debug/set.h (set<>::emplace<>(_Args&&...)): Use C++11 direct initialization. (set<>::emplace_hint<>(const_iterator, _Args&&...)): Likewise. (set<>::insert(value_type&&)): Likewise. (set<>::insert<>(const_iterator, value_type&&)): Likewise. (set<>::insert(const_iterator, node_type&&)): Likewise. (set<>::erase(const_iterator)): Likewise. (set<>::erase(const_iterator, const_iterator)): Likewise. * include/debug/multiset.h (multiset<>::emplace<>(_Args&&...)): Use C++11 direct initialization. (multiset<>::emplace_hint<>(const_iterator, _Args&&...)): Likewise. (multiset<>::insert<>(value_type&&)): Likewise. (multiset<>::insert<>(const_iterator, value_type&&)): Likewise. (multiset<>::insert(node_type&&)): Likewise. (multiset<>::insert(const_iterator, node_type&&)): Likewise. (multiset<>::erase(const_iterator)): Likewise. (multiset<>::erase(const_iterator, const_iterator)): Likewise. From-SVN: r264805
2018-10-02vector<bool> _M_start and 0 offsetMarc Glisse2-3/+9
2018-10-02 Marc Glisse <marc.glisse@inria.fr> PR libstdc++/87258 * include/bits/stl_bvector.h (vector::begin(), vector::cbegin()): Rebuild _M_start with an explicit 0 offset. From-SVN: r264791
2018-10-02Avoid redundant runtime checks in std::visitJonathan Wakely2-18/+23
Calling std::get will check some static assertions and also do a runtime check for a valid index before calling __detail::__variant::__get. The std::visit function already handles the case where any variant has an invalid index, so __get can be used directly in __visit_invoke. * include/std/variant (__gen_vtable_impl::__visit_invoke): Call __get directly instead of get, as caller ensures correct index is used. (holds_alternative, get, get_if): Remove redundant inline specifiers. (_VARIANT_RELATION_FUNCTION_TEMPLATE): Likewise. From-SVN: r264786
2018-10-02Use -fno-show-column in libstdc++ installed testing.Joseph Myers2-1/+6
<https://gcc.gnu.org/ml/libstdc++/2016-08/msg00006.html> arranged for libstdc++ tests to use -fno-show-column by default, but only for build-tree testing. This patch adds it to the options used for installed testing as well. Tested with installed testing for a cross to x86_64-linux-gnu, where it fixes various test failures. * testsuite/lib/libstdc++.exp (libstdc++_init): Use -fno-show-column in default cxxflags. From-SVN: r264784
2018-10-02config: Remove unused define for os uClibcBernhard Reutner-Fischer2-4/+5
__NO_STRING_INLINES was removed from uClibc around 2004 so has no effect. libstdc++-v3/ChangeLog: 2018-10-01 Bernhard Reutner-Fischer <aldot@gcc.gnu.org> * config/os/uclibc/os_defines.h (__NO_STRING_INLINES): Delete. From-SVN: r264783
2018-10-01allocator.xml: Adjust link to "Reconsidering Custom Memory Allocation".Gerald Pfeifer2-1/+6
* doc/xml/manual/allocator.xml: Adjust link to "Reconsidering Custom Memory Allocation". From-SVN: r264761
2018-10-01Regenerate libstdc++ HTML pagesJonathan Wakely9-11/+15
* doc/html/*: Regenerate. From-SVN: r264760
2018-09-30messages.xml: Switch link to www.oracle.com to https.Gerald Pfeifer2-1/+6
* doc/xml/manual/messages.xml: Switch link to www.oracle.com to https. From-SVN: r264723