Commit Graph

206 Commits

Author SHA1 Message Date
Jonathan Wakely caa39b2e84 libstdc++: Fix testsuite failures and warnings due to is_pod deprecation
With -std=gnu++2a and -Wsystem-headers the std::is_pod deprecation
causes some new diagnostics. This suppresses them.

	* include/experimental/type_traits (experimental::is_pod_v): Disable
	-Wdeprecated-declarations warnings around reference to std::is_pod.
	* include/std/type_traits (is_pod_v): Likewise.
	* testsuite/18_support/max_align_t/requirements/2.cc: Also check
	is_standard_layout and is_trivial. Do not check is_pod for C++20.
	* testsuite/20_util/is_pod/requirements/explicit_instantiation.cc:
	Add -Wno-deprecated for C++20.
	* testsuite/20_util/is_pod/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_pod/value.cc: Likewise.
	* testsuite/experimental/type_traits/value.cc: Likewise.

From-SVN: r280066
2020-01-09 21:31:50 +00:00
Jakub Jelinek 8d9254fc8a Update copyright years.
From-SVN: r279813
2020-01-01 12:51:42 +01:00
Jonathan Wakely b5b2e3879d libstdc++: Implement ranges::safe_range for C++20 (P1870R1)
This change replaces the __forwarding_range implementation detail with
the ranges::safe_range concept and adds the ranges::enable_safe_range
variable template for opt-in in to the concept.

It also adjusts the begin/end/rbegin/rend customization point objects to
match the new rules for accessing rvalue ranges only when safe to do so.

	* include/bits/range_access.h (ranges::enable_safe_range): Define.
	(ranges::begin, ranges::end, ranges::rbegin, ranges::rend): Constrain
	to only accept types satisfying safe_range and treat argument as an
	lvalue when calling a member of performing ADL.
	(ranges::__detail::__range_impl, ranges::__detail::__forwarding_range):
	Remove.
	(ranges::range): Adjust definition.
	(ranges::safe_range): Define.
	(ranges::iterator_t, ranges::range_difference_t): Reorder definitions
	to match the synopsis in the working draft.
	(ranges::disable_sized_range): Remove duplicate definition.
	* include/experimental/string_view (ranges::enable_safe_range): Add
	partial specialization for std::experimental::basic_string_view.
	* include/std/ranges (ranges::viewable_range, ranges::subrange)
	(ranges::empty_view, ranges::iota_view): Use safe_range. Specialize
	enable_safe_range.
	(ranges::safe_iterator_t, ranges::safe_subrange_t): Define.
	* include/std/span (ranges::enable_safe_range): Add partial
	specialization for std::span.
	* include/std/string_view (ranges::enable_safe_range): Likewise for
	std::basic_string_view.
	* testsuite/std/ranges/access/begin.cc: Adjust expected results.
	* testsuite/std/ranges/access/cbegin.cc: Likewise.
	* testsuite/std/ranges/access/cdata.cc: Likewise.
	* testsuite/std/ranges/access/cend.cc: Likewise.
	* testsuite/std/ranges/access/crbegin.cc: Likewise.
	* testsuite/std/ranges/access/crend.cc: Likewise.
	* testsuite/std/ranges/access/data.cc: Likewise.
	* testsuite/std/ranges/access/end.cc: Likewise.
	* testsuite/std/ranges/access/rbegin.cc: Likewise.
	* testsuite/std/ranges/access/rend.cc: Likewise.
	* testsuite/std/ranges/empty_view.cc: Test ranges::begin and
	ranges::end instead of unqualified calls to begin and end.
	* testsuite/std/ranges/safe_range.cc: New test.
	* testsuite/std/ranges/safe_range_types.cc: New test.
	* testsuite/util/testsuite_iterators.h: Add comment about safe_range.

From-SVN: r279135
2019-12-09 17:35:24 +00:00
Jonathan Wakely 3eda32cb9b libstdc++: Fix experimental::filesystem::u8path(const Source&) for Windows
This function failed to compile when called with a std::string.

Also, constructing a path with a char8_t string did not correctly treat
the string as already UTF-8 encoded.

	* include/bits/fs_path.h (u8path(InputIterator, InputIterator))
	(u8path(const Source&)) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Simplify
	conditions.
	* include/experimental/bits/fs_path.h [_GLIBCXX_FILESYSTEM_IS_WINDOWS]
	(__u8path(const Source&, char)): Add overloads for std::string and
	types convertible to std::string.
	(_Cvt::_S_wconvert): Add a new overload for char8_t strings and use
	codecvt_utf8_utf16 to do the correct conversion.

From-SVN: r278869
2019-11-30 01:03:36 +00:00
Jonathan Wakely 24cc0de967 libstdc++: Adjust some function templates for coding conventions
* include/bits/fs_path.h (path::operator/=): Change template-head to
	use typename instead of class.
	* include/experimental/bits/fs_path.h (path::operator/=): Likewise.
	* include/std/ostream (operator<<): Likewise.

From-SVN: r278859
2019-11-29 17:43:55 +00:00
Tom Honermann 2b4e2c93d9 libstdc++: P1423R3 char8_t remediation (2/4)
Update feature test macro, add deleted operators, update u8path

This patch increments the __cpp_lib_char8_t feature test macro, adds deleted
operator<< overloads for basic_ostream, and modifies u8path to accept
sequences of char8_t for both the C++17 implementation of std::filesystem, and
the filesystem TS implementation.

The implementation mechanism used for u8path differs between the C++17 and
filesystem TS implementations.  The changes to the former take advantage of
C++17 'if constexpr'.  The changes to the latter retain C++11 compatibility
and rely on tag dispatching.

2019-11-29  Tom Honermann  <tom@honermann.net>

	Update feature test macro, add deleted operators, update u8path
	* include/bits/c++config: Bumped the value of the __cpp_lib_char8_t
	feature test macro.
	* include/bits/fs_path.h (u8path): Modified u8path to accept sequences
	of char8_t.
	* include/experimental/bits/fs_path.h (u8path): Modified u8path to
	accept sequences of char8_t.
	* include/std/ostream: Added deleted overloads of wchar_t, char8_t,
	char16_t, and char32_t for ordinary and wide formatted character and
	string inserters.

From-SVN: r278856
2019-11-29 17:43:42 +00:00
Tom Honermann a1e7d33bb9 libstdc++: P1423R3 char8_t remediation (1/4)
Decouple constraints for u8path from path constructors

This patch moves helper classes and functions for std::filesystem::path out of
the class definition to a detail namespace so that they are available to the
implementations of std::filesystem::u8path.  Prior to this patch, the SFINAE
constraints for those implementations were specified via delegation to the
overloads of path constructors with a std::locale parameter; it just so
happened that those overloads had the same constraints.  As of P1423R3, u8path
and those overloads no longer have the same constraints, so this dependency
must be broken.

This patch also updates the experimental implementation of the filesystem TS
to add SFINAE constraints to its implementations of u8path.  These functions
were previously unconstrained and marked with a TODO comment.

This patch does not provide any intentional behavioral changes other than the
added constraints to the experimental filesystem TS implementation of u8path.

Alternatives to this refactoring would have been to make the u8path overloads
friends of class path, or to make the helpers public members. Both of those
approaches struck me as less desirable than this approach, though this
approach does require more code changes and will affect implementation detail
portions of mangled names for path constructors and inline member functions
(mostly function template specializations).

2019-11-29  Tom Honermann  <tom@honermann.net>

	Decouple constraints for u8path from path constructors
	* include/bits/fs_path.h: Moved helper utilities out of
	std::filesystem::path into a detail namespace to make them
	available for use by u8path.
	* include/experimental/bits/fs_path.h: Moved helper utilities out
	of std::experimental::filesystem::v1::path into a detail
	namespace to make them available for use by u8path.

From-SVN: r278855
2019-11-29 17:43:37 +00:00
Jonathan Wakely 5ce55f3ff5 Simplify common case of use_future_t that uses std::allocator
There is no need to store and pass around the allocator object when it's
an instance of std::allocator. Define a partial specialization of
std::use_future_t and the corresponding completion token so that no
allocator is stored. Overload the completion handler constructor to not
expect an allocator to be stored.

	* include/experimental/executor (__use_future_ct, use_future_t):
	Define partial specializations for std::allocator.
	(__use_future_ch): Overload constructor for completion tokens using
	std::allocator.

From-SVN: r277404
2019-10-24 15:39:57 +01:00
Jonathan Wakely a16bc2f317 Make some new algorithms work in parallel mode
* include/experimental/algorithm (experimental::sample): Qualify call
	to __sample correctly.
	* include/parallel/algo.h (sample, for_each_n): Add using-declarations
	for algorithms that don't have parallel implementations.

From-SVN: r276432
2019-10-01 22:02:27 +01:00
Andreas Tobler b54453598a Include netinet/in.h in include/experimental/internet
2019-09-30  Andreas Tobler  <andreast@gcc.gnu.org>

	* include/experimental/internet: Include netinet/in.h if we have
	_GLIBCXX_HAVE_NETINET_IN_H defined.

From-SVN: r276374
2019-09-30 22:26:57 +02:00
Jonathan Wakely d5f7e04923 Fix array index error in address_v6 comparisons
* include/experimental/internet (operator==, operator<): Fix loop
	condition to avoid reading past the end of the array.

From-SVN: r276153
2019-09-26 17:08:33 +01:00
Jonathan Wakely cb0de9b60c P0325R4 to_array from LFTS with updates
As an extension to what the standard requires, this also adds
conditional noexcept-specifiers to the std::to_array functions.

	P0325R4 to_array from LFTS with updates
	* include/experimental/array (to_array): Qualify call to __to_array.
	* include/std/array (__cpp_lib_to_array, to_array): Define for C++20.
	* include/std/version (__cpp_lib_to_array): Likewise.
	* testsuite/23_containers/array/creation/1.cc: New test.
	* testsuite/23_containers/array/creation/2.cc: New test.
	* testsuite/23_containers/array/creation/3_neg.cc: New test.
	* testsuite/23_containers/array/tuple_interface/tuple_element_neg.cc:
	Use zero for dg-error line number.

From-SVN: r274209
2019-08-08 11:18:53 +01:00
Jonathan Wakely 0d67cd380d Define __type_identity_t alias and use for string_view
This defines the equivalent of C++2a's std::type_identity_t alias but
for use in C++11 and later. This can be used to replace __detail::__idt
in the string_view headers, which previously used common_type_t because
the one argument specialization of common_type_t was simply the identity
transform (which is no longer true).

	* include/experimental/string_view (__detail::__idt): Remove.
	(operator==, operator!=, operator<, operator>, operator<=, operator>=):
	Use __type_identity_t instead of __detail::__idt;
	* include/std/string_view (__detail::__idt): Remove.
	(operator==, operator!=, operator<, operator>, operator<=, operator>=):
	Use __type_identity_t instead of __detail::__idt;
	* include/std/type_traits (__type_identity_t): New alias template.

From-SVN: r273442
2019-07-12 12:43:22 +01:00
Jonathan Wakely 26b1320ee5 PR libstdc++/90281 Fix string conversions for filesystem::path
Fix several bugs in the encoding conversions for filesystem::path that
prevent conversion of Unicode characters outside the Basic Multilingual
Plane, and prevent returning basic_string specializations with
alternative allocator types.

The std::codecvt_utf8 class template is not suitable for UTF-16
conversions because it uses UCS-2 instead. For conversions between UTF-8
and UTF-16 either std::codecvt<C, char, mbstate> or
codecvt_utf8_utf16<C> must be used.

The __str_codecvt_in and __str_codecvt_out utilities do not
return false on a partial conversion (e.g. for invalid or incomplete
Unicode input). Add new helpers that treat partial conversions as
errors, and use them for all filesystem::path conversions.

	PR libstdc++/90281 Fix string conversions for filesystem::path
	* include/bits/fs_path.h (u8path) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]:
	Use codecvt_utf8_utf16 instead of codecvt_utf8. Use
	__str_codecvt_in_all to fail for partial conversions and throw on
	error.
	[!_GLIBCXX_FILESYSTEM_IS_WINDOWS && _GLIBCXX_USE_CHAR8_T]
	(path::_Cvt<char8_t>): Add explicit specialization.
	[_GLIBCXX_FILESYSTEM_IS_WINDOWS] (path::_Cvt::_S_wconvert): Remove
	overloads.
	[_GLIBCXX_FILESYSTEM_IS_WINDOWS] (path::_Cvt::_S_convert): Use
	if-constexpr instead of dispatching to _S_wconvert. Use codecvt
	instead of codecvt_utf8. Use __str_codecvt_in_all and
	__str_codecvt_out_all.
	[!_GLIBCXX_FILESYSTEM_IS_WINDOWS] (path::_Cvt::_S_convert): Use
	codecvt instead of codecvt_utf8. Use __str_codecvt_out_all.
	(path::_S_str_convert) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Use
	codecvt_utf8_utf16 instead of codecvt_utf8. Construct return values
	with allocator. Use __str_codecvt_out_all. Fallthrough to POSIX code
	after converting to UTF-8.
	(path::_S_str_convert): Use codecvt instead of codecvt_utf8. Use
	__str_codecvt_in_all.
	(path::string): Fix initialization of string types with different
	allocators.
	(path::u8string) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Use
	codecvt_utf8_utf16 instead of codecvt_utf8. Use __str_codecvt_out_all.
	* include/bits/locale_conv.h (__do_str_codecvt): Reorder static and
	runtime conditions.
	(__str_codecvt_out_all, __str_codecvt_in_all): New functions that
	return false for partial conversions.
	* include/experimental/bits/fs_path.h (u8path):
	[_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Implement correctly for mingw.
	[_GLIBCXX_FILESYSTEM_IS_WINDOWS] (path::_Cvt::_S_wconvert): Add
	missing handling for char8_t. Use codecvt and codecvt_utf8_utf16
	instead of codecvt_utf8. Use __str_codecvt_in_all and
	__str_codecvt_out_all.
	[!_GLIBCXX_FILESYSTEM_IS_WINDOWS] (path::_Cvt::_S_convert): Use
	codecvt instead of codecvt_utf8. Use __str_codecvt_out_all.
	(path::string) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Use
	codecvt_utf8_utf16 instead of codecvt_utf8. Construct return values
	with allocator. Use __str_codecvt_out_all and __str_codecvt_in_all.
	(path::string) [!_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Use
	__str_codecvt_in_all.
	(path::u8string) [_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Use
	codecvt_utf8_utf16 instead of codecvt_utf8. Use __str_codecvt_out_all.
	* src/c++17/fs_path.cc (path::_S_convert_loc): Use
	__str_codecvt_in_all.
	* src/filesystem/path.cc (path::_S_convert_loc): Likewise.
	* testsuite/27_io/filesystem/path/construct/90281.cc: New test.
	* testsuite/27_io/filesystem/path/factory/u8path.cc: New test.
	* testsuite/27_io/filesystem/path/native/string.cc: Test with empty
	strings and with Unicode characters outside the basic multilingual
	plane.
	* testsuite/27_io/filesystem/path/native/alloc.cc: New test.
	* testsuite/experimental/filesystem/path/construct/90281.cc: New test.
	* testsuite/experimental/filesystem/path/factory/u8path.cc: New test.
	* testsuite/experimental/filesystem/path/native/alloc.cc: New test.
	* testsuite/experimental/filesystem/path/native/string.cc: Test with
	empty strings and with Unicode characters outside the basic
	multilingual plane.

From-SVN: r272385
2019-06-17 15:19:04 +01:00
Jonathan Wakely cc28d23496 Disable -Wctor-dtor-privacy warnings for some standard types
* include/experimental/type_traits (experimental::nonesuch): Use
	pragma to disable -Wctor-dtor-privacy warnings.
	* include/std/type_traits (__is_convertible_helper<From, To, false>)
	(__is_nt_convertible_helper<From, To, false>, __nonesuch): Likewise.

From-SVN: r272289
2019-06-14 15:03:20 +01:00
Jonathan Wakely 441ed45ca2 PR libstdc++/90634 reduce allocations in filesystem::path construction
PR libstdc++/90634
	* include/experimental/bits/fs_path.h (path::path(path&&)): Only call
	_M_split_cmpts() for a path with multiple components.
	(path::_S_is_dir_sep()): Add missing 'static' keyword to function.
	* src/filesystem/path.cc (path::_M_split_cmpts()): Count number of
	components and reserve space in vector. Return early when there is
	only one component.
	* testsuite/27_io/filesystem/path/construct/90634.cc: New test.
	* testsuite/experimental/filesystem/path/construct/90634.cc: New test.

From-SVN: r271717
2019-05-28 20:39:48 +01:00
Jonathan Wakely aa573a6a3e Make any_cast compare typeinfo as well as function pointers
It's possible for the function pointer comparison to fail even though
the type is correct, because the function could be defined multiple
times with different addresses when shared libraries are in use.

Retain the function pointer check for the common case where the check
succeeds, but compare typeinfo (if RTTI is enabled) if the first check
fails.

	* include/experimental/any (__any_caster): Use RTTI if comparing
	addresses fails, to support non-unique addresses in shared libraries.
	* include/std/any (__any_caster): Likewise.

From-SVN: r271557
2019-05-23 15:13:18 +01:00
Jonathan Wakely 7dbab5dc84 PR libstdc++/90220 fix experimental::any_cast for non-object types
This corresponds to the fixes done for std::any_cast, but has to be done
without if-constexpr. The dummy specialization of _Manager_internal<_Op>
is used to avoid instantiating the real _Manager_internal<T>::_S_manage
function just to compare its address.

	PR libstdc++/90220
	* include/experimental/any (__any_caster): Constrain to only be
	callable for object types. Use remove_cv_t instead of decay_t.
	If the type decays or isn't copy constructible, compare the manager
	function to a dummy specialization.
	(__any_caster): Add overload constrained for non-object types.
	(any::_Manager_internal<_Op>): Add dummy specialization.
	* testsuite/experimental/any/misc/any_cast.cc: Test function types
	and array types.

From-SVN: r271556
2019-05-23 14:39:06 +01:00
Jonathan Wakely 52ea1caf28 PR libstdc++/77691 fix resource_adaptor failures due to max_align_t bugs
Remove the hardcoded whitelist of allocators expected to return memory
aligned to alignof(max_align_t), because that doesn't work when the
platform's malloc() and GCC's max_align_t do not agree what the largest
fundamental alignment is. It's also sub-optimal for user-defined
allocators that return memory suitable for any fundamental alignment.

Instead use a hardcoded list of alignments that are definitely supported
by the platform malloc, and use a copy of the allocator rebound to a POD
type with the requested alignment. Only allocate an oversized
buffer to use with std::align for alignments larger than any of the
hardcoded values.

For 32-bit Solaris x86 do not include alignof(max_align_t) in the
hardcoded values.

	PR libstdc++/77691
	* include/experimental/memory_resource: Add system header pragma.
	(__resource_adaptor_common::__guaranteed_alignment): Remove.
	(__resource_adaptor_common::_Types)
	(__resource_adaptor_common::__new_list)
	(__resource_adaptor_common::_New_list)
	(__resource_adaptor_common::_Alignments)
	(__resource_adaptor_common::_Fund_align_types): New utilities for
	creating a list of types with fundamental alignments.
	(__resource_adaptor_imp::do_allocate): Call new _M_allocate function.
	(__resource_adaptor_imp::do_deallocate): Call new _M_deallocate
	function.
	(__resource_adaptor_imp::_M_allocate): New function that first tries
	to use an allocator rebound to a type with a fundamental alignment.
	(__resource_adaptor_imp::_M_deallocate): Likewise for deallocation.
	* testsuite/experimental/memory_resource/new_delete_resource.cc:
	Adjust expected allocation sizes.
	* testsuite/experimental/memory_resource/resource_adaptor.cc: Remove
	xfail.

From-SVN: r271522
2019-05-22 21:29:39 +01:00
Jonathan Wakely 593cda3e61 Fix uses of non-reserved names for template parameters
* include/bits/random.h (seed_seq::param): Fix non-reserved name.
	* include/experimental/type_traits (is_detected_exact)
	(is_detected_exact_v): Likewise.
	* include/pstl/execution_defs.h (is_execution_policy)
	(is_execution_policy_v, __enable_if_execution_policy): Likewise.
	* include/pstl/execution_impl.h (__policy_traits): Likewise.
	* testsuite/17_intro/names.cc: Check for more non-reserved names.
	* testsuite/experimental/names.cc: New test.

From-SVN: r271324
2019-05-17 15:13:40 +01:00
Nina Dinka Ranns a73d2fa852 nonesuch is insufficiently useless (lwg2996)
2019-05-14  Nina Dinka Ranns  <dinka.ranns@gmail.com>

	nonesuch is insufficiently useless (lwg2996)
	* include/std/type_traits (struct __nonesuch): Added private base
	class to make __nonesuch not an aggregate and removed deleted default
	constructor.
	* include/bits/stl_pair.h (struct __nonesuch_no_braces): Removed.
	(operator=(const pair&)): Use __nonesuch instead of
	__nonesuch_no_braces.
	(operator=(pair&&)): Likewise
	* include/std/tuple (operator=(const tuple&)): Use __nonesuch instead
	of __nonesuch_no_braces.
	(operator=(tuple&&)): Likewise
	* include/experimental/type_traits (struct nonesuch): Added private
	base class to make nonesuch not an aggregate and removed deleted
	default constructor.
	* testsuite/20_util/nonesuch/nonesuch.cc: New.
	* testsuite/experimental/type_traits/nonesuch.cc: New.

From-SVN: r271175
2019-05-14 16:48:27 +01:00
Jonathan Wakely bceb07e358 PR libstdc++/90454.cc path construction from void*
Make the filesystem::path constructors SFINAE away for void* arguments,
instead of giving an error due to iterator_traits<void*>::reference.

	PR libstdc++/90454.cc path construction from void*
	* include/bits/fs_path.h (path::_Path): Use remove_pointer so that
	pointers to void are rejected as well as void.
	* include/experimental/bits/fs_path.h (path::_Path): Likewise.
	* testsuite/27_io/filesystem/path/construct/80762.cc: Also check
	pointers to void.
	* testsuite/experimental/filesystem/path/construct/80762.cc: Likewise.

From-SVN: r271134
2019-05-13 21:12:06 +01:00
Jonathan Wakely 041aa6abe4 Improve API docs for Filesystem TS and Networking TS
* include/experimental/bits/fs_path.h: Improve docs.
	* include/experimental/bits/net.h: Fix wrong header name in comment.
	Do not document implementation details.
	* include/experimental/netfwd: Fix doxygen grouping.

From-SVN: r270990
2019-05-08 00:22:01 +01:00
Jonathan Wakely b752e2c926 Remove redundant __constexpr_addressof function
The std::__addressof function is always constexpr, even in C++14, so we
can just use that.

	* include/experimental/bits/lfts_config.h: Improve doc markup.
	* include/experimental/optional: Improve docs.
	(_Has_addressof_mem, _Has_addressof_free, _Has_addressof)
	(__constexpr_addressof): Remove.
	(optional::operator->()): Use std::__addressof().
	* include/std/optional (optional::operator->()): Adjust whitespace.
	* testsuite/experimental/optional/constexpr/observers/2.cc: Check
	that operator-> is still constexpr with overloaded operator&. Change
	to compile-only test.
	* testsuite/experimental/optional/constexpr/observers/3.cc: Change to
	compile-only test.

From-SVN: r270826
2019-05-02 22:23:35 +01:00
Jonathan Wakely 3084625d39 Improve docs for Networking TS
* include/experimental/bits/net.h: Fix/improve doxygen markup.
	* include/experimental/buffer: Likewise.
	* include/experimental/executor: Likewise.
	* include/experimental/internet: Likewise.
	* include/experimental/io_context: Likewise.
	* include/experimental/net: Likewise.
	* include/experimental/netfwd: Likewise.
	* include/experimental/socket: Likewise.
	* include/experimental/timer: Likewise.

From-SVN: r270810
2019-05-02 16:46:34 +01:00
Jonathan Wakely 1ababc8bd5 Improve docs for Library Fundamentals TS
* doc/doxygen/doxygroups.cc: Move description of experimental group
	here.
	* include/experimental/algorithm: Add to libfund-ts doc group.
	* include/experimental/any: Likewise. Do not document implementation
	details.
	* include/experimental/array: Add to libfund-ts doc group.
	* include/experimental/bits/lfts_config.h: Define libfund-ts doc group
	for Library Fundamentals.
	* include/experimental/chrono: Add to libfund-ts doc group.
	* include/experimental/deque: Likewise.
	* include/experimental/forward_list: Likewise.
	* include/experimental/functional: Likewise.
	* include/experimental/iterator: Likewise.
	* include/experimental/list: Likewise.
	* include/experimental/map: Likewise.
	* include/experimental/memory: Likewise.
	* include/experimental/memory_resource: Likewise. Improve docs.
	details.
	* include/experimental/numeric: Add to libfund-ts doc group.
	* include/experimental/optional: Likewise.
	* include/experimental/propagate_const: Likewise.
	* include/experimental/random: Likewise.
	* include/experimental/ratio: Likewise.
	* include/experimental/regex: Likewise.
	* include/experimental/set: Likewise.
	* include/experimental/source_location: Likewise.
	* include/experimental/string: Likewise.
	* include/experimental/string_view: Likewise.
	* include/experimental/system_error: Likewise.
	* include/experimental/tuple: Likewise.
	* include/experimental/type_traits: Likewise.
	* include/experimental/unordered_map: Likewise.
	* include/experimental/unordered_set: Likewise.
	* include/experimental/utility: Likewise.
	* include/experimental/vector: Likewise.
	* testsuite/experimental/any/misc/any_cast_neg.cc: Adjust dg-error.
	* testsuite/experimental/array/neg.cc: Adjust dg-error.
	* testsuite/experimental/propagate_const/assignment/move_neg.cc:
	Likewise.
	* testsuite/experimental/propagate_const/cons/move_neg.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements2.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements3.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements4.cc: Likewise.
	* testsuite/experimental/propagate_const/requirements5.cc: Likewise.

From-SVN: r270809
2019-05-02 16:46:29 +01:00
Jonathan Wakely caace30081 Improve docs for Filesystem TS
* include/experimental/bits/fs_dir.h: Fix Doxygen markup.
	* include/experimental/bits/fs_fwd.h: Improve docs.
	* include/experimental/bits/fs_ops.h: fix Doxygen markup.
	* include/experimental/bits/fs_path.h: Likewise.
	(path, filesystem_error, u8path): Improve docs.
	* include/experimental/filesystem: Link to docs for TS.

From-SVN: r270808
2019-05-02 16:45:32 +01:00
Jonathan Wakely 700e6332a7 Remove redundant step in experimental::filesystem::path construction
* include/experimental/bits/fs_path.h
	(path::_S_convert_loc<_InputIterator>): Create const std::string to
	avoid redundant call to _S_convert_loc with non-const pointers.

From-SVN: r270608
2019-04-26 16:58:47 +01:00
Jonathan Wakely fb8b3e2993 Fix basic_string_view typedefs and enforce preconditions
The basic_string_view::pointer and basic_string_view::reference typedefs
are supposed to refer to the non-const value type.

In previous standards having traits_type::char_type different to
value_type was simply undefined, but in the C++2a draft it's ill-formed,
as changed by P1148R0. For std::basic_string and iostreams we might
want to only enforce this conditionally for __cplusplus > 201703L but
for std::basic_string_view we don't have backwards compatibility
concerns. Also add assertions to verify the _CharT argument is a
"char-like" type (non-array, trivial, standard layout type).

Also remove the non-standard basic_string_view::_M_check and
basic_string_view::_M_limit member functions, replacing them with
non-member functions that will still exist even if basic_string_view is
specialized by the program.

	* include/experimental/string_view (basic_string_view::pointer)
	(basic_string_view::reference): Fix to refer to non-const value_type.
	* include/bits/basic_string.h (basic_string): Use __sv_check and
	__sv_limit instead of basic_string_view::_M_check and
	basic_string_view::_M_limit.
	* include/std/string_view (__sv_check, __sv_limit): New
	helper functions to replace basic_string_view::_M_check and
	basic_string_view::_M_limit.
	(basic_string_view): Add static assertions to enforce ill-formed
	requirement for traits_type::char_type from P1148R0, and to enforce
	required properties of char-like types.
	(basic_string_view::pointer, basic_string_view::reference): Fix to
	refer to non-const value_type.
	(basic_string_view::operator[], basic_string_view::at)
	(basic_string_view::front, basic_string_view::back)
	(basic_string_view::data): Use const_reference and const_pointer
	typedefs for return types.
	(basic_string_view::_M_check, basic_string_view::_M_limit): Remove.
	(hash<wstring_view>): Fix argument_type typedef.
	* testsuite/21_strings/basic_string_view/modifiers/remove_prefix/
	char/1.cc: Fix expected return type of basic_string_view::data().
	* testsuite/21_strings/basic_string_view/modifiers/remove_prefix/
	wchar_t/1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/remove_suffix/
	char/1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/modifiers/remove_suffix/
	wchar_t/1.cc: Likewise.
	* testsuite/21_strings/basic_string_view/requirements/traits_neg.cc:
	New test.
	* testsuite/21_strings/basic_string_view/requirements/typedefs.cc:
	Check reference and pointer typedefs.
	* testsuite/experimental/string_view/requirements/typedefs.cc:
	Likewise.
	* testsuite/experimental/string_view/modifiers/remove_prefix/char/1.cc:
	Fix expected return type of basic_string_view::data().
	* testsuite/experimental/string_view/modifiers/remove_prefix/wchar_t/
	1.cc: Likewise.
	* testsuite/experimental/string_view/modifiers/remove_suffix/char/1.cc:
	Likewise.
	* testsuite/experimental/string_view/modifiers/remove_suffix/wchar_t/
	1.cc: Likewise.

From-SVN: r270548
2019-04-24 16:17:53 +01:00
Jonathan Wakely 187fdaea67 PR libstdc++/89460 Fix Networking TS test failures on HP-UX
Check for availability of POSIX sockatmark before using it.

Rename _S_ntoh overloads that are ambiguous when passed an integral type
that is neither uint16_t nor uint32_t.

	PR libstdc++/89460
	* configure.ac: Check for sockatmark.
	* crossconfig.m4: Check for sockatmark.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* include/experimental/internet (address_v4::_S_hton): Rename
	overloaded functions to _S_hton_16 and _S_ntoh_16.
	(address_v4::_S_ntoh): Rename to _S_ntoh_16 and _S_ntoh_32.
	(basic_endpoint): Adjust calls to _S_hton and _S_ntoh.
	* include/experimental/socket (basic_socket::at_mark): Check
	_GLIBCXX_HAVE_SOCKATMARK.

From-SVN: r269588
2019-03-11 16:28:11 +00:00
Tom Honermann c124af936b P0482R5 char8_t: Standard library support
gcc/cp:

2019-02-19  Tom Honermann  <tom@honermann.net>

	* name-lookup.c (get_std_name_hint): Added u8string as a name hint.

libstdc++:

2019-02-19  Tom Honermann  <tom@honermann.net>

	P0482R5 char8_t: Standard library support
	* config/abi/pre/gnu-versioned-namespace.ver (CXXABI_2.0): Add
	typeinfo symbols for char8_t.
	* config/abi/pre/gnu.ver: Add CXXABI_1.3.12.
	(GLIBCXX_3.4.26): Add symbols for specializations of
	numeric_limits and codecvt that involve char8_t.
	(CXXABI_1.3.12): Add typeinfo symbols for char8_t.
	* include/bits/atomic_base.h: Add atomic_char8_t.
	* include/bits/basic_string.h: Add std::hash<u8string> and
	operator""s(const char8_t*, size_t).
	* include/bits/c++config: Define _GLIBCXX_USE_CHAR8_T and
	__cpp_lib_char8_t.
	* include/bits/char_traits.h: Add char_traits<char8_t>.
	* include/bits/codecvt.h: Add
	codecvt<char16_t, char8_t, mbstate_t>,
	codecvt<char32_t, char8_t, mbstate_t>,
	codecvt_byname<char16_t, char8_t, mbstate_t>, and
	codecvt_byname<char32_t, char8_t, mbstate_t>.
	* include/bits/cpp_type_traits.h: Add __is_integer<char8_t> to
	recognize char8_t as an integral type.
	* include/bits/fs_path.h: (path::__is_encoded_char): Recognize
	char8_t.
	(path::u8string): Return std::u8string when char8_t support is
	enabled.
	(path::generic_u8string): Likewise.
	(path::_S_convert): Handle conversion from char8_t input.
	(path::_S_str_convert): Likewise.
	* include/bits/functional_hash.h: Add hash<char8_t>.
	* include/bits/locale_conv.h (__str_codecvt_out): Add overloads for
	char8_t.
	* include/bits/locale_facets.h (_GLIBCXX_NUM_UNICODE_FACETS): Bump
	for new char8_t specializations.
	* include/bits/localefwd.h: Add missing declarations of
	codecvt<char16_t, char, mbstate_t> and
	codecvt<char32_t, char, mbstate_t>.  Add char8_t declarations
	codecvt<char16_t, char8_t, mbstate_t> and
	codecvt<char32_t, char8_t, mbstate_t>.
	* include/bits/postypes.h: Add u8streampos
	* include/bits/stringfwd.h: Add declarations of
	char_traits<char8_t> and u8string.
	* include/c_global/cstddef: Add __byte_operand<char8_t>.
	* include/experimental/bits/fs_path.h (path::__is_encoded_char):
	Recognize char8_t.
	(path::u8string): Return std::u8string when char8_t support is
	enabled.
	(path::generic_u8string): Likewise.
	(path::_S_convert): Handle conversion from char8_t input.
	(path::_S_str_convert): Likewise.
	* include/experimental/string: Add u8string.
	* include/experimental/string_view: Add u8string_view,
	hash<experimental::u8string_view>, and
	operator""sv(const char8_t*, size_t).
	* include/std/atomic: Add atomic<char8_t> and atomic_char8_t.
	* include/std/charconv (__is_int_to_chars_type): Recognize char8_t
	as a character type.
	* include/std/limits: Add numeric_limits<char8_t>.
	* include/std/string_view: Add u8string_view,
	hash<experimental::u8string_view>, and
	operator""sv(const char8_t*, size_t).
	* include/std/type_traits: Add __is_integral_helper<char8_t>,
	__make_unsigned<char8_t>, and __make_signed<char8_t>.
	* libsupc++/atomic_lockfree_defines.h: Define
	ATOMIC_CHAR8_T_LOCK_FREE.
	* src/c++11/Makefile.am: Compile with -fchar8_t when compiling
	codecvt.cc and limits.cc so that char8_t specializations of
	numeric_limits and codecvt and emitted.
	* src/c++11/Makefile.in: Likewise.
	* src/c++11/codecvt.cc: Define members of
	codecvt<char16_t, char8_t, mbstate_t>,
	codecvt<char32_t, char8_t, mbstate_t>,
	codecvt_byname<char16_t, char8_t, mbstate_t>, and
	codecvt_byname<char32_t, char8_t, mbstate_t>.
	* src/c++11/limits.cc: Define members of
	numeric_limits<char8_t>.
	* src/c++98/Makefile.am: Compile with -fchar8_t when compiling
	locale_init.cc and localename.cc.
	* src/c++98/Makefile.in: Likewise.
	* src/c++98/locale_init.cc: Add initialization for the
	codecvt<char16_t, char8_t, mbstate_t> and
	codecvt<char32_t, char8_t, mbstate_t> facets.
	* src/c++98/localename.cc: Likewise.
	* testsuite/util/testsuite_abi.cc: Validate ABI bump.

From-SVN: r269004
2019-02-19 02:54:42 +00:00
Jonathan Wakely f7f07df5e2 Avoid ambiguity between C++2a std::erase_if and LFTS version
These calls should have been qualified to avoid ADL anyway, but in C++2a
it becomes essential to qualify the calls in experimental::erase because
std::erase_if is also declared and the calls become ambiguous.

	* include/experimental/forward_list (experimental::erase): Qualify
	call to erase_if.
	* include/experimental/list (experimental::erase): Likewise.
	* include/std/forward_list (std::erase): Likewise.
	* include/std/list (std::erase): Likewise.

From-SVN: r268356
2019-01-29 00:47:38 +00:00
Ulrich Drepper d715f55431 Fix after P0600.
gcc/testsuite/ChangeLog
2019-02-20  Ulrich Drepper  <drepper@redhat.com>

	Fix after P0600.
	* g++.dg/init/new39.C: Don't just ignore result of new.

libstdc++/ChangeLog
2019-02-20  Ulrich Drepper  <drepper@redhat.com>

	Implement C++20 P0600r1.
	* include/backward/hash_map: Add nodiscard attribute to empty.
	* include/backward/hash_set: Likewise.
	* backward/hashtable.h: Likewise.
	* include/bits/basic_string.h: Likewise.
	* include/bits/forward_list.h: Likewise.
	* include/bits/hashtable.h: Likewise.
	* include/bits/regex.h: Likewise.
	* include/bits/stl_deque.h: Likewise.
	* include/bits/stl_list.h: Likewise.
	* include/bits/stl_map.h: Likewise.
	* include/bits/stl_multimap.h: Likewise.
	* include/bits/stl_multiset.h: Likewise.
	* include/bits/stl_queue.h: Likewise.
	* include/bits/stl_set.h: Likewise.
	* include/bits/stl_stack.h: Likewise.
	* include/bits/stl_tree.h: Likewise.
	* include/bits/stl_vector.h: Likewise.
	* include/bits/unordered_map.h: Likewise.
	* include/bits/unordered_set.h: Likewise.
	* include/debug/array: Likewise.
	* include/experimental/any: Likewise.
	* include/experimental/bits/fs_path.h: Likewise.
	* include/experimental/internet: Likewise.
	* include/experimental/string_view: Likewise.
	* include/ext/pb_ds/detail/bin_search_tree_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/binary_heap_/binary_heap_.hpp:
	Likewise.
	* include/ext/pb_ds/detail/binary_heap_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/cc_hash_table_map_/cc_ht_map_.hpp:
	Likewise.
	* include/ext/pb_ds/detail/cc_hash_table_map_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/cc_hash_table_map_/size_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/gp_hash_table_map_/gp_ht_map_.hpp:
	Likewise.
	* include/ext/pb_ds/detail/gp_hash_table_map_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/left_child_next_sibling_heap_/info_fn_imps.hpp:
	Likewise.
	*
include/ext/pb_ds/detail/left_child_next_sibling_heap_/left_child_next_sibling_heap_.hpp:
	Likewise.
	* include/ext/pb_ds/detail/list_update_map_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/list_update_map_/lu_map_.hpp:
	Likewise.
	* include/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/ov_tree_map_/ov_tree_map_.hp:
	Likewise.
	* include/ext/pb_ds/detail/pat_trie_/info_fn_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/pat_trie_/pat_trie_.hpp:
	Likewise.
	* include/ext/pb_ds/detail/rc_binomial_heap_/rc.hpp:
	Likewise.
	* include/ext/pb_ds/detail/tree_trace_base.hpp: Likewise.
	* include/ext/pb_ds/trie_policy.hpp: Likewise.
	* include/ext/rope: Likewise.
	* include/ext/slist: Likewise.
	* include/ext/vstring.h: Likewise.
	* include/profile/array: Likewise.
	* include/std/array: Likewise.
	* include/tr1/array: Likewise.
	* include/tr1/hashtable.h: Likewise.
	* include/tr1/regex: Likewise.
	* include/tr2/dynamic_bitset: Likewise.
	* include/bits/alloc_traits.h: Add nodiscard attribute to
	allocate.
	* include/experimental/memory_resource: Likewise.
	* include/ext/alloc_traits.h: Likewise.
	* include/ext/array_allocator.h: Likewise.
	* include/ext/bitmap_allocator.h: Likewise.
	* include/ext/debug_allocator.h: Likewise.
	* include/ext/extptr_allocator.h: Likewise.
	* include/ext/mt_allocator.h: Likewise.
	* include/ext/new_allocator.h: Likewise.
	* include/ext/pool_allocator.h: Likewise.
	* include/ext/throw_allocator.h: Likewise.
	* include/std/scoped_allocator: Likewise.
	* libsupc++/eh_alloc.cc: Likewise.
	* include/std/future: Add nodiscard attribute to async.
	* libsupc++/new: Add nodiscard attribute to new.

From-SVN: r268111
2019-01-21 11:47:30 +00:00
Jonathan Wakely cbe0bca404 Check AI_NUMERICSERV is defined before using it
The AI_NUMERICSERV constant is missing from old Darwin systems, so only
use it if it's supported.

	* include/experimental/internet [AI_NUMERICSERV]
	(resolver_base::numeric_service): Define conditionally.
	* testsuite/experimental/net/internet/resolver/base.cc: Test it
	conditionally.
	* testsuite/experimental/net/internet/resolver/ops/lookup.cc:
	Likewise.

From-SVN: r267809
2019-01-10 13:21:54 +00:00
Jonathan Wakely 43f1a5e1d8 PR libstdc++/88607 replace some more UTF-8 characters
2019-01-03  Jonathan Wakely  <jwakely@redhat.com>
	    Jakub Jelinek  <jakub@redhat.com>

	PR libstdc++/88607
	* include/experimental/memory: Replace UTF-8 quote characters.
	* include/std/future: Replace UTF-8 "em dash" characters.

Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r267565
2019-01-03 22:07:52 +00:00
Jonathan Wakely 3c732e6fe8 PR libstdc++/88607 replace or remove unnecessary UTF-8 characters
There are a number of UTF-8 characters in comments which add no value
and can be replaced with ASCII equivalents, or removed entirely for the
section sign (U+00A7).

	PR libstdc++/88607
	* include/bits/forward_list.h: Replace UTF-8 "ligature fi" character.
	* include/debug/forward_list: Likewise.
	* include/experimental/bits/shared_ptr.h: Remove UTF-8 "section sign"
	character.
	* include/experimental/chrono: Likewise.
	* include/experimental/functional: Likewise.
	* include/experimental/ratio: Likewise.
	* include/experimental/system_error: Likewise.
	* include/experimental/tuple: Likewise.
	* include/experimental/type_traits: Likewise.
	* include/parallel/workstealing.h: Replace UTF-8 "en dash" character.
	* include/parallel/multiseq_selection.h: Likewise.

From-SVN: r267564
2019-01-03 20:38:11 +00:00
Jakub Jelinek a554497024 Update copyright years.
From-SVN: r267494
2019-01-01 13:31:55 +01:00
Jonathan Wakely 6b7c0b5559 PR libstdc++/80762 avoid ambiguous __constructible_from<void, void>
Ensure we don't try to instantiate __is_constructible_from<void, void>,
because there are two partial specializations that are equally good
matches.

	PR libstdc++/80762
	* include/bits/fs_path.h (path::_Path): Use remove_cv_t and is_void.
	* include/experimental/bits/fs_path.h (path::_Path): Likewise.
	* testsuite/27_io/filesystem/path/construct/80762.cc: New test.
	* testsuite/experimental/filesystem/path/construct/80762.cc: New test.

From-SVN: r267056
2018-12-12 16:13:43 +00:00
Edward Smith-Rowland a62b871d65 Fix erasure goofs.
2018-11-29  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Fix erasure goofs.
	* include/experimental/deque: Make inline.
	* include/std/deque: Include bits/stl_algo.h.
	(erase, erase_if): Make inline.
	* include/std/string: Include bits/stl_algo.h.
	* include/std/unordered_set: Add erase, erase_if!
	* include/std/vector: Include bits/stl_algo.h.
	* testsuite/21_strings/basic_string/erasure.cc:
	Add { dg-options "-std=gnu++2a" }.
	* testsuite/23_containers/deque/erasure.cc: Ditto.
	* testsuite/23_containers/forward_list/erasure.cc: Ditto.
	* testsuite/23_containers/list/erasure.cc: Ditto.
	* testsuite/23_containers/map/erasure.cc: Ditto.
	* testsuite/23_containers/set/erasure.cc: Ditto.
	* testsuite/23_containers/unordered_map/erasure.cc: Ditto.
	* testsuite/23_containers/unordered_set/erasure.cc: Ditto.
	* testsuite/23_containers/vector/erasure.cc: Ditto.

From-SVN: r266616
2018-11-29 13:43:55 +00:00
Jonathan Wakely 0a1369fa95 PR libstdc++/83511 add default argument to basic_string_view::substr
PR libstdc++/83511
	* include/std/string_view (basic_string_view::substr): Add default
	argument to first parameter.
	* include/experimental/string_view (basic_string_view::substr):
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/substr/char/
	83511.cc: New test.
	* testsuite/21_strings/basic_string_view/operations/substr/wchar_t/
	83511.cc: New test.
	* testsuite/experimental/string_view/operations/substr/char/83511.cc:
	New test.
	* testsuite/experimental/string_view/operations/substr/wchar_t/83511.cc:
	New test.

From-SVN: r266568
2018-11-28 16:53:35 +00:00
Edward Smith-Rowland 188588e443 Implement uniform container erasure for C++20.
2018-11-28  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Implement uniform container erasure for C++20.
	* include/Makefile.am: Move erase_if.h.
	* include/Makefile.in: Move erase_if.h.
	* include/experimental/bits/erase_if.h: Move ...
	* include/bits/erase_if.h: ... here.
	* include/experimental/map: Move erase_if.h.
	* include/experimental/set: Move erase_if.h.
	* include/experimental/unordered_map: Move erase_if.h.
	* include/experimental/unordered_set: Move erase_if.h.
	* include/std/deque (erase_if, erase): New functions.
	* include/std/forward_list: Ditto.
	* include/std/list: Ditto.
	* include/std/map: Ditto.
	* include/std/set: Ditto.
	* include/std/string: Ditto.
	* include/std/unordered_map: Ditto.
	* include/std/unordered_set: Ditto.
	* include/std/vector: Ditto.
	* testsuite/21_strings/basic_string/erasure.cc: New test.
	* testsuite/23_containers/deque/erasure.cc: New test.
	* testsuite/23_containers/forward_list/erasure.cc: New test.
	* testsuite/23_containers/list/erasure.cc: New test.
	* testsuite/23_containers/map/erasure.cc: New test.
	* testsuite/23_containers/set/erasure.cc: New test.
	* testsuite/23_containers/unordered_map/erasure.cc: New test.
	* testsuite/23_containers/unordered_set/erasure.cc: New test.
	* testsuite/23_containers/vector/erasure.cc: New test.

From-SVN: r266567
2018-11-28 16:44:25 +00:00
Jonathan Wakely a70a4be9c2 Fix versioned namespace macros for Networking TS
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-16 17:12:51 +01:00
Jonathan Wakely 82a0f2fd10 Use autoconf to check for features needed by Networking TS
* 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-16 17:12:32 +01:00
Jonathan Wakely 345fba60b1 Add missing return
* include/experimental/socket (basic_socket::at_mark): Add missing
	return.

From-SVN: r265199
2018-10-16 16:24:00 +01:00
Jonathan Wakely e5989e71ff Initial commit of Networking TS implementation
* 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-12 11:50:15 +01:00
Jonathan Wakely 49cb790a4c PR libstdc++/77691 increase allocation size to at least alignment
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-12 00:21:11 +01:00
Jonathan Wakely 1bc7a28f94 PR libstdc++/87061 remove pmr type aliases for COW strings
The pmr aliases for basic_string and match_results are incompatible with
the gcc4-compatible ABI because the Copy-On-Write basic_string class
doesn't support C++11 allocators.

	PR libstdc++/87061
	* include/experimental/regex [!_GLIBCXX_USE_CXX11_ABI]
	(experimental::pmr::match_results, experimental::pmr::cmatch)
	(experimental::pmr::smatch, experimental::pmr::wcmatch)
	(experimental::pmr::wsmatch): Do not declare for gcc4-compatible ABI,
	because COW strings don't support C++11 allocator model.
	* include/experimental/string [!_GLIBCXX_USE_CXX11_ABI]
	(experimental::pmr::basic_string, experimental::pmr::string)
	(experimental::pmr::u16string, experimental::pmr::u32string)
	(experimental::pmr::wstring): Likewise.
	* include/std/regex [!_GLIBCXX_USE_CXX11_ABI] (pmr::match_results)
	(pmr::cmatch, pmr::smatch, pmr::wcmatch, pmr::wsmatch): Likewise.
	* include/std/string [!_GLIBCXX_USE_CXX11_ABI] (pmr::basic_string)
	(pmr::string, pmr::u16string, pmr::u32string, pmr::wstring): Likewise.
	* testsuite/21_strings/basic_string/types/pmr_typedefs.cc: Require
	cxx11-abi.
	* testsuite/28_regex/match_results/pmr_typedefs.cc: Likewise.

From-SVN: r263791
2018-08-22 23:54:33 +01:00
Jonathan Wakely b8eac4d064 Fix experimental::pmr typedefs and add tests
The typedefs in <experimental/regex> and <experimental/string> don't
need to be in the __cxx11 namespace, because they are only aliases and
so will have the same mangled name as the underlying types.

	* include/experimental/regex: Remove begin/end macros for namespace.
	* include/experimental/string: Likewise.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_deque.cc:
	New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_forward_list.cc: New test.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_list.cc:
	New test.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_map.cc:
	New test.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_match.cc:
	New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_multimap.cc: New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_multiset.cc: New test.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_set.cc:
	New test.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_string.cc:
	New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_unordered_map.cc: New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_unordered_multimap.cc: New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_unordered_multiset.cc: New test.
	* testsuite/experimental/polymorphic_allocator/
	pmr_typedefs_unordered_set.cc: New test.
	* testsuite/experimental/polymorphic_allocator/pmr_typedefs_vector.cc:
	New test.

From-SVN: r263568
2018-08-15 20:46:25 +01:00
Jonathan Wakely b479fbad24 Refactor uses-allocator construction
Remove duplicated logic in experimental::pmr::polymorphic_allocator by
calling the __uses_allocator_construct helper.

Fix bugs in std::pmr::polymorphic_allocator with incorrect SFINAE
constraint and incorrect argument order.

	* include/bits/uses_allocator.h (__uses_allocator_construct): Qualify
	calls to __uses_allocator_construct_impl and __use_alloc.
	* include/experimental/memory_resource
	(polymorphic_allocator::_M_construct): Remove.
	(polymorphic_allocator::construct): Call __uses_allocator_construct.
	Qualify calls to __use_alloc.
	* include/std/memory_resource (polymorphic_allocator::construct): Fix
	type in SFINAE constraint. Use constexpr if instead of tag dispatching
	to _S_construct overloads.
	(polymorphic_allocator::construct(pair<T1, T2>*, ...)): Fix order of
	arguments to _S_construct_p.
	(polymorphic_allocator::_S_construct): Remove.
	(polymorphic_allocator::_S_construct_p): Return allocators by value
	not by reference.
	* include/std/scoped_allocator (scoped_allocator_adaptor::construct):
	Qualify calls to __use_alloc.
	* testsuite/20_util/polymorphic_allocator/construct_pair.cc: New test,
	copied from testsuite/20_util/scoped_allocator/construct_pair.cc.
	* testsuite/experimental/polymorphic_allocator/1.cc: New test.
	* testsuite/experimental/polymorphic_allocator/construct_pair.cc:
	New test.

From-SVN: r263566
2018-08-15 20:20:02 +01:00
Jonathan Wakely 612c9c702e Remove char16_t and char32_t dependency on <stdint.h>
The char16_t and char32_t types are automatically defined by the
compiler and do not depend on support in <stdint.h>. The char_traits
specializations depend on uint_leastNN_t but can be made to work anyway
by using the predefined macros, or as a last resort make_unsigned.

	* include/bits/basic_string.h [!_GLIBCXX_USE_C99_STDINT_TR1]
	(hash<u16string>, hash<u32string>): Remove dependency on
	_GLIBCXX_USE_C99_STDINT_TR1.
	* include/bits/char_traits.h [!_GLIBCXX_USE_C99_STDINT_TR1]
	(char_traits<char16_t>, char_traits<char32_t>): Remove dependency on
	_GLIBCXX_USE_C99_STDINT_TR1. Use __UINT_LEAST16_TYPE__ and
	__UINT_LEAST32_TYPE__ or make_unsigned when <stdint.h> is not usable.
	* include/bits/codecvt.h [!_GLIBCXX_USE_C99_STDINT_TR1]
	(codecvt<char16_t, char, mbstate_t>)
	(codecvt<char32_t, char, mbstate_t>)
	(codecvt_byname<char16_t, char, mbstate_t>)
	(codecvt_byname<char32_t, char, mbstate_t>): Remove dependency
	on _GLIBCXX_USE_C99_STDINT_TR1.
	* include/bits/locale_facets.h [!_GLIBCXX_USE_C99_STDINT_TR1]
	(_GLIBCXX_NUM_UNICODE_FACETS): Likewise.
	* include/bits/stringfwd.h [!_GLIBCXX_USE_C99_STDINT_TR1]
	(char_traits<char16_t>, char_traits<char32_t>)
	(basic_string<char16_t>, basic_string<char32_t>): Remove dependency
	on _GLIBCXX_USE_C99_STDINT_TR1.
	* include/experimental/string_view [!_GLIBCXX_USE_C99_STDINT_TR1]
	(u16string_view, u32string_view, hash<u16string_view>)
	(hash<u32string_view>, operator""sv(const char16_t, size_t))
	(operator""sv(const char32_t, size_t)): Likewise.
	* include/ext/vstring.h [!_GLIBCXX_USE_C99_STDINT_TR1]
	(hash<__u16vstring>, hash<__u32vstring>): Likewise.
	* include/ext/vstring_fwd.h [!_GLIBCXX_USE_C99_STDINT_TR1]
	(__u16vstring, __u16sso_string, __u16rc_string, __u32vstring)
	(__u32sso_string, __u32rc_string): Likewise.
	* include/std/codecvt [!_GLIBCXX_USE_C99_STDINT_TR1] (codecvt_mode)
	(codecvt_utf8, codecvt_utf16, codecvt_utf8_utf16): Likewise.
	* include/std/string_view [!_GLIBCXX_USE_C99_STDINT_TR1]
	(u16string_view, u32string_view, hash<u16string_view>)
	(hash<u32string_view>, operator""sv(const char16_t, size_t))
	(operator""sv(const char32_t, size_t)): Likewise.
	* src/c++11/codecvt.cc: Likewise.
	* src/c++98/locale_init.cc: Likewise.
	* src/c++98/localename.cc: Likewise.

From-SVN: r263002
2018-07-26 15:02:01 +01:00