Commit Graph

9067 Commits

Author SHA1 Message Date
Jonathan Wakely ff8b2a0acb Fix NullablePointer test utility
* testsuite/util/testsuite_allocator.h (NullablePointer::operator bool):
	Fix return value.

From-SVN: r271189
2019-05-14 21:01:28 +01:00
Rainer Orth ccd1242eec Remove obsolete Solaris 10 support
libstdc++-v3:
	* config/os/solaris/solaris2.10: Move to ...
	* config/os/solaris: ... this.
	* configure.host (os_include_dir): Adapt.
	(abi_baseline_pair): Remove Solaris 10 handling.
	* config/abi/post/i386-solaris2.10: Remove.
	* config/abi/post/sparc-solaris2.10: Remove.
	* config/abi/post/i386-solaris2.11: Rename to ...
	* config/abi/post/i386-solaris: ... this.
	* config/abi/post/sparc-solaris2.11: Rename to ...
	* config/abi/post/sparc-solaris: ... this.

	* libsupc++/new_opa.cc [_GLIBCXX_HAVE_MEMALIGN] [__sun]: Remove
	workaround.

	* testsuite/ext/enc_filebuf/char/13598.cc: Remove *-*-solaris2.10
	xfail.

	libsanitizer:
	* configure.ac (have_dl_iterate_phdr): Remove *-*-solaris2.10*
	handling.
	* configure: Regenerate.

	libgcc:
	* config.host: Simplify various *-*-solaris2.1[0-9]* to
	*-*-solaris2*.
	* configure.ac: Likewise.
	* configure: Regenerate.

	* config/i386/sol2-unwind.h (x86_fallback_frame_state): Remove
	Solaris 10 and Solaris 11 < snv_125 handling.

	libbacktrace:
	* configure.ac (have_dl_iterate_phdr): Remove *-*-solaris2.10*
	handling.
	* configure: Regenerate.

	gcc/testsuite:
	* gcc.dg/atomic/c11-atomic-exec-4.c: Simplify triplet to
	*-*-solaris2*.
	* gcc.dg/atomic/c11-atomic-exec-5.c: Likewise.
	* gcc.dg/c99-math-double-1.c: Likewise.
	* gcc.dg/c99-math-float-1.c: Likewise.
	* gcc.dg/c99-math-long-double-1.c: Likewise.
	* gcc.misc-tests/linkage.exp: Simplify triplet to
	x86_64-*-solaris2*.

	* gcc.target/i386/mcount_pic.c: Remove *-*-solaris2.10* && !gld
	xfail.
	* gcc.target/i386/pr63620.c: Likewise.

	* lib/target-supports.exp (check_sse_os_support_available): Remove
	Solaris 9/x86 workaround.

	gcc:
	* config.gcc: Move *-*-solaris2.10* from obsolete configurations
	to unsupported ones.
	Simplify x86_64-*-solaris2.1[0-9]* to x86_64-*-solaris2*.
	* config.host: Likewise.
	* config/i386/sol2.h (ASM_COMMENT_START): Remove.
	* config/sparc/driver-sparc.c (host_detect_local_cpu) [__sun__ &&
	__svr4__]: Remove "brand" fallback.
	[!KSTAT_DATA_STRING]: Remove.
	* configure.ac (gcc_cv_ld_hidden): Simplify *-*-solaris2.1[0-9]*
	to *-*-solaris2*.
	(comdat_group): Likewise.
	(set_have_as_tls): Likewise.
	(gcc_cv_target_dl_iterate_phdr): Likewise.
	(gcc_cv_as_shf_merge): Remove Solaris 10/x86 workaround.
	(gcc_cv_ld_aligned_shf_merge): Remove Solaris 10/SPARC workaround.
	* configure: Regenerate.
	* doc/install.texi: Simplify Solaris target triplets.
	(Specific, i?86-*-solaris2*): Remove Solaris 10 references.
	(Specific, *-*-solaris2*): Document Solaris 10 removal.
	Remove Solaris 10 references.
	Remove obsolete Solaris bug reference.
	(Specific, sparc-sun-solaris2.10): Remove.

From-SVN: r271183
2019-05-14 17:17:23 +00:00
Jonathan Wakely 956a62aaa2 Add __raw_visit and __raw_idx_visit, use INVOKE<R>
This change simplifies visitation for variants, by using INVOKE<R> for
the visit<R> form, and explicitly specifying the tag types for raw
visitation, instead of inferring them from the return types of the
lambda functions used as visitors.

	* include/std/variant (__visit_with_index): Remove typedef.
	(__deduce_visit_result): New tag type.
	(__raw_visit, __raw_idx_visit): New helper functions for "raw"
	visitation of possibly-valueless variants, forwarding to __do_visit
	with the relevant tag type.
	(_Variant_storage<false, _Types...>::_M_reset_impl): Use __raw_visit
	and make lambda return void.
	(__variant_construct): Likewise.
	(_Copy_assign_base::operator=, _Move_assign_base::operator=): Use
	__raw_idx_visit and make lambda return void.
	(_Multi_array::__untag_result): Add metafunction to check the function
	pointer type for a tag type that dictates the kind of visitation.
	(_Multi_array<_Ret(*)(_Visitor, _Variants...), __first, __rest...>):
	Use decltype(auto) instead of tagged function pointer type.
	(__gen_vtable_impl): Remove bool non-type parameter and unused
	_Variant_tuple parameter.
	(__gen_vtable_impl::__visit_invoke_impl): Remove.
	(__gen_vtable_impl::__do_visit_invoke): Remove.
	(__gen_vtable_impl::__do_visit_invoke_r): Remove.
	(__gen_vtable_impl::__visit_invoke): Use if-constexpr and __invoke_r
	for the visit<R> case, rather than dispatching to separate functions.
	(_VARIANT_RELATION_FUNCTION_TEMPLATE): Use __raw_idx_visit and make
	lambda return void.
	(variant::swap): Likewise.
	(__do_visit): Replace two non-type template parameters with a single
	type parameter, so that the caller must specify the visitor's return
	type (or one of the tag types).
	(visit): Deduce a return type from the visitor and use the
	__deduce_visit_result tag to enforce that all overloads return the
	same type.
	(visit<R>): Call __do_visit<R> with explicit result type.
	(__variant_hash_call_base_impl::operator()): Use __raw_visit and make
	lambda return void.

From-SVN: r271182
2019-05-14 17:46:07 +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 330b17474c Use INVOKE<R> in std::function, std::bind and std::packaged_task
As well as simpifying the code by removing duplication, this means that
we only need to touch std::__invoke_r if we need to implement changes to
INVOKE<R>, such as those in P0932R0.

	* include/bits/std_function.h (_Simple_type_wrapper): Remove.
	(_Function_handler): Remove partial specializations for void return
	types and pointers to member.
	(_Function_handler::_M_manager): Adapt to removal of
	_Simple_type_wrapper.
	(_Function_handler::_M_invoke): Use __invoke_r instead of __invoke.
	* include/std/functional (_Bind_result::__enable_if_void)
	(_Bind_result::__disable_if_void): Remove sfinae helpers.
	(_Bind_result::__call): Use __invoke_r and remove overloads for void
	return types.
	* include/std/future (__future_base::_Task_state::_M_run)
	(__future_base::_Task_state::_M_run_delayed): Use __invoke_r and
	change return type of lambda expressions.

From-SVN: r271174
2019-05-14 16:25:08 +01:00
Jonathan Wakely 78c2855df6 Define std::__invoke_r for INVOKE<R>
* include/bits/invoke.h (__invoke_r): Define new function implementing
	the INVOKE<R> pseudo-function.
	* testsuite/20_util/function_objects/invoke/1.cc: Add more tests.
	* testsuite/20_util/function_objects/invoke/2.cc: New test.

From-SVN: r271173
2019-05-14 16:25:01 +01:00
Jonathan Wakely ce9f305e44 Add __is_nothrow_convertible to fix std::is_nothrow_invocable_r
The definition of is_nothrow_invocable in terms of is_convertible and
is_nothrow_constructible is incorrect, because a type could have an
explicit constructor that means is_nothrow_constructible is true, but
implicit conversions could use a different constructor that is
potentially-throwing.

Fix it by adding a C++11 version of C++20's is_nothrow_convertible that
only considers implicit conversions.

	* include/std/type_traits (__is_nt_convertible_helper): Define it
	unconditionally, not only for C++20.
	(__is_nothrow_convertible): Define internal trait for use in C++11.
	(__is_nt_invocable_impl: Fix by using __is_nothrow_convertible.
	(is_invocable_r_v, is_nothrow_invocable_r_v): Add missing parameter.
	* testsuite/20_util/is_nothrow_convertible/value_ext.cc: New test.
	* testsuite/20_util/is_nothrow_convertible/value.cc: Check with type
	that has nothrow explicit conversion but potentially-throwing implicit
	conversion.
	* testsuite/20_util/is_nothrow_invocable/value.cc: Likewise.
	* testsuite/20_util/is_nothrow_invocable/value_ext.cc: Fix helper
	function to only consider implicit conversions.
	* testsuite/20_util/tuple/cons/noexcept_specs.cc: Add comment.

From-SVN: r271171
2019-05-14 15:39:58 +01:00
Jonathan Wakely 22b6a9c1cd Reduce header dependencies in <iterator>
* include/std/iterator: Include <iosfwd> instead of <istream> and
	<ostream>.

From-SVN: r271169
2019-05-14 13:47:39 +01:00
Jonathan Wakely 7198e982e9 Removing unused, non-standard function in _Rb_tree
* include/bits/stl_tree.h (_Rb_tree::erase(const Key*, const Key*)):
	Remove unused, non-standard function.

From-SVN: r271168
2019-05-14 13:19:10 +01:00
Jonathan Wakely 0b3c00ff3c Make std::match_results::_M_resize more useful
As both callers of match_results::_M_resize(unsigned) immediately follow
it with a loop to update the value of each sub_match, that behaviour can
be moved into _M_resize itself. The first caller fills the container
with unmatched subs, which can be done with vector::assign, and the
second caller clears the container to establish a specific state, which
can be provided by a new member function specific to that purpose.

Tangentially, I also noticed that match_results::max_size() doesn't
account for the three special sub_match objects that are always present
in a fully established result state. This patch also fixes that.

	* include/bits/regex.h (match_results::max_size()): Adjust return
	value to account for prefix/suffix/unmatched subs.
	(match_results::_M_resize(unsigned int)): Use _Base_type::assign to
	reset the contained sub matches.
	(match_results::_M_establish_failed_match(_Bi_iter)): Add new member
	function to set result state following a failed match.
	* include/bits/regex.tcc (__regex_algo_impl): Remove loop to set
	sub_match states after _M_resize. Use _M_establish_failed_match.

From-SVN: r271167
2019-05-14 13:19:05 +01:00
Jonathan Wakely 8db7a05fd7 PR libstdc++/69724 avoid temporary in std::thread construction
The std::thread constructor creates (and then moves) an unnecessary
temporary copy of each argument. Optimize it to only make the one copy
that is required.

	PR libstdc++/69724
	* include/std/thread (thread::_State_impl, thread::_S_make_state):
	Replace single _Callable parameter with variadic _Args pack, to
	forward them directly to the tuple of decayed copies.
	* testsuite/30_threads/thread/cons/69724.cc: New test.

From-SVN: r271166
2019-05-14 13:01:15 +01:00
Nina Dinka Ranns db33efde17 Inconsistency wrt Allocators in basic_string assignment (LWG2579)
2019-05-14  Nina Dinka Ranns  <dinka.ranns@gmail.com>

	Inconsistency wrt Allocators in basic_string assignment (LWG2579)
	* include/bits/basic_string.h: (operator=(const basic_string&):
	Move allocator decision to assign.
	(assign(const basic_string&)): Move allocator decision here.
	* testsuite/21_strings/basic_string/allocator/char/copy_assign.cc:
	Add tests.
	* testsuite/21_strings/basic_string/allocator/wchar_t/copy_assign.cc:
	Add tests.

From-SVN: r271165
2019-05-14 12:48:31 +01:00
Jonathan Wakely c688848d6a Fix indentation in testsuite utility header
* testsuite/util/testsuite_allocator.h (memory_resource)
	(default_resource_mgr): Fix indentation.

From-SVN: r271161
2019-05-14 12:17:27 +01:00
Jonathan Wakely 066f9ea279 Add __gnu_test::NullablePointer utility to testsuite
* testsuite/20_util/allocator_traits/members/allocate_hint_nonpod.cc:
	Use operator-> to access raw pointer member.
	* testsuite/23_containers/vector/59829.cc: Likewise.
	* testsuite/23_containers/vector/bool/80893.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/cxx11.cc: Use NullablePointer.
	* testsuite/util/testsuite_allocator.h (NullablePointer): New utility
	for tests.
	(PointerBase, PointerBase_void): Derive from NullablePointer and use
	its constructors and equality operators. Change converting
	constructors to use operator-> to access private member of the other
	pointer type.
	(PointerBase_void::operator->()): Add, for access to private member.
	(operator-(PointerBase, PointerBase)): Change to hidden friend.
	(operator==(PointerBase, PointerBase)): Remove.
	(operator!=(PointerBase, PointerBase)): Remove.

From-SVN: r271160
2019-05-14 12:17:23 +01:00
Jonathan Wakely e25f488d60 Fix unique_ptr pretty printer for empty classes
The printer was confused when unique_ptr<T,D>::pointer is an empty
class, or the deleter is not empty. Instead of assuming the tuple has a
single _M_head_impl member manually inspect the tuple base classes to
get the first element.

	* python/libstdcxx/v6/printers.py (UniquePointerPrinter.__init__): Do
	not assume field called _M_head_impl is the first tuple element.
	* testsuite/libstdc++-prettyprinters/compat.cc: Make tuple
	implementation more accurate.
	* testsuite/libstdc++-prettyprinters/cxx11.cc: Check unique_ptr with
	empty pointer type and non-empty deleter.

From-SVN: r271159
2019-05-14 12:17:18 +01:00
Jonathan Wakely 1b18663e0f LWG 2899 - Make is_move_constructible correct for unique_ptr
* include/bits/unique_ptr.h (__uniq_ptr_impl): Add move constructor,
	move assignment operator.
	(__uniq_ptr_impl::release(), __uniq_ptr_impl::reset(pointer)): Add.
	(__uniq_ptr_data): New class template with conditionally deleted
	special members.
	(unique_ptr, unique_ptr<T[], D>): Change type of data member from
	__uniq_ptr_impl<T, D> to __uniq_ptr_data<T, D>. Define move
	constructor and move assignment operator as defaulted.
	(unique_ptr::release(), unique_ptr<T[], D>::release()): Forward to
	__uniq_ptr_impl::release().
	(unique_ptr::reset(pointer), unique_ptr<T[], D>::reset<U>(U)): Forward
	to __uniq_ptr_impl::reset(pointer).
	* python/libstdcxx/v6/printers.py (UniquePointerPrinter.__init__):
	Check for new __uniq_ptr_data type.
	* testsuite/20_util/unique_ptr/dr2899.cc: New test.

From-SVN: r271158
2019-05-14 12:17:11 +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 e6e0842944 Small markup changes to PBDS docs
* doc/xml/manual/policy_data_structures.xml: Comment out stray
	<remark> elements. Fix formatting of bibliography references.

From-SVN: r271132
2019-05-13 21:11:47 +01:00
Edward Smith-Rowland abac7fbe4a Document P0811R3 status in C++20 table
2019-05-13  Edward Smith-Rowland  <3dw4rd@verizon.net>

	* doc/xml/manual/status_cxx2020.xml: Document P0811R3 status.

From-SVN: r271122
2019-05-13 11:58:13 +01:00
Jonathan Wakely 8afd780d30 Fix ChangeLog date
From-SVN: r271121
2019-05-13 11:58:08 +01:00
Jonathan Wakely 544be2beb1 Remove Profile Mode, deprecated since GCC 7.1
The Profile Mode extension is not used by anybody, nor maintained by
anybody. The containers do not support the full API specified in recent
standards, and so enabling Profile Mode is not source compatible with
much modern C++ code. The heuristics that would check the profile
information and make useful suggestions never materialized, so it isn't
useful.

It should be removed.

	Remove Profile Mode, deprecated since 7.1.0
	* doc/Makefile.am: Remove XML file for profile mode docs.
	* doc/Makefile.in: Regenerate.
	* doc/xml/authors.xml: Remove authors of profile mode docs.
	* doc/xml/manual/appendix_contributing.xml: Remove mention of profile
	mode.
	* doc/xml/manual/debug.xml: Likewise.
	* doc/xml/manual/evolution.xml: Document removal of profile mode.
	* doc/xml/manual/profile_mode.xml: Remove profile mode docs.
	* doc/xml/manual/spine.xml: Remove profile mode author credit.
	* doc/xml/manual/test.xml: Remove docs for dg-require-profile-mode
	directive.
	* doc/xml/manual/using.xml: Remove docs for profile mode headers and
	macro.
	* doc/html/*: Regenerate.
	* include/Makefile.am: Remove profile mode headers.
	* include/Makefile.in: Regenerate.
	* include/bits/c++config (std::__profile): Remove namespace.
	[_GLIBCXX_PROFILE]: Remove checks for macro.
	* include/profile/array: Remove.
	* include/profile/base.h: Remove.
	* include/profile/bitset: Remove.
	* include/profile/deque: Remove.
	* include/profile/forward_list: Remove.
	* include/profile/impl/profiler.h: Remove.
	* include/profile/impl/profiler_algos.h: Remove.
	* include/profile/impl/profiler_container_size.h: Remove.
	* include/profile/impl/profiler_hash_func.h: Remove.
	* include/profile/impl/profiler_hashtable_size.h: Remove.
	* include/profile/impl/profiler_list_to_slist.h: Remove.
	* include/profile/impl/profiler_list_to_vector.h: Remove.
	* include/profile/impl/profiler_map_to_unordered_map.h: Remove.
	* include/profile/impl/profiler_node.h: Remove.
	* include/profile/impl/profiler_state.h: Remove.
	* include/profile/impl/profiler_trace.h: Remove.
	* include/profile/impl/profiler_vector_size.h: Remove.
	* include/profile/impl/profiler_vector_to_list.h: Remove.
	* include/profile/iterator_tracker.h: Remove.
	* include/profile/list: Remove.
	* include/profile/map: Remove.
	* include/profile/map.h: Remove.
	* include/profile/multimap.h: Remove.
	* include/profile/multiset.h: Remove.
	* include/profile/ordered_base.h: Remove.
	* include/profile/set: Remove.
	* include/profile/set.h: Remove.
	* include/profile/unordered_base.h: Remove.
	* include/profile/unordered_map: Remove.
	* include/profile/unordered_set: Remove.
	* include/profile/vector: Remove.
	* scripts/run_doxygen: Do not process profile mode headers.
	* testsuite/23_containers/array/element_access/60497.cc: Don't use
	profile mode type.
	* testsuite/23_containers/array/specialized_algorithms/swap_cxx17.cc:
	Remove dg-skip-if for profile mode.
	* testsuite/23_containers/forward_list/capacity/1.cc: Remove
	preprocessor check for profile mode.
	* testsuite/23_containers/list/capacity/29134.cc: Likewise.
	* testsuite/23_containers/map/modifiers/extract.cc: Remove dg-skip-if
	for profile mode.
	* testsuite/23_containers/map/modifiers/insert_or_assign/1.cc:
	Likewise.
	* testsuite/23_containers/map/modifiers/try_emplace/1.cc: Likewise.
	* testsuite/23_containers/multimap/modifiers/extract.cc: Likewise.
	* testsuite/23_containers/multiset/modifiers/extract.cc: Likewise.
	* testsuite/23_containers/set/modifiers/extract.cc: Likewise.
	* testsuite/23_containers/unordered_map/modifiers/extract.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/modifiers/extract.cc:
	Likewise.
	* testsuite/23_containers/unordered_multiset/modifiers/extract.cc:
	Likewise.
	* testsuite/23_containers/unordered_set/modifiers/extract.cc:
	Likewise.
	* testsuite/23_containers/vector/bool/capacity/29134.cc: Remove
	preprocessor check for profile mode.
	* testsuite/23_containers/vector/bool/modifiers/insert/31370.cc:
	Likewise.
	* testsuite/23_containers/vector/modifiers/insert_vs_emplace.cc:
	Remove dg-skip-if for profile mode.
	* testsuite/25_algorithms/binary_search/partitioned.cc: Likewise.
	* testsuite/25_algorithms/equal_range/partitioned.cc: Likewise.
	* testsuite/25_algorithms/lexicographical_compare/71545.cc: Likewise.
	* testsuite/25_algorithms/lower_bound/partitioned.cc: Likewise.
	* testsuite/25_algorithms/upper_bound/partitioned.cc: Likewise.
	* testsuite/Makefile.am: Remove profile_flags variable and
	* testsuite/Makefile.am: Remove profile_flags variable and
	check-profile target.
	* testsuite/Makefile.in: Regenerate.
	* testsuite/ext/profile/all.cc: Remove.
	* testsuite/ext/profile/mutex_extensions_neg.cc: Remove.
	* testsuite/ext/profile/profiler_algos.cc: Remove.
	* testsuite/ext/profile/replace_new.cc: Remove.
	* testsuite/ext/throw_allocator/deallocate_global.cc: Remove
	preprocessor check for profile mode.
	* testsuite/ext/throw_allocator/deallocate_local.cc: Likewise.
	* testsuite/lib/libstdc++.exp (check_v3_target_profile_mode): Remove.
	(check_v3_target_normal_mode): Do not check for profile mode macro.
	* testsuite/libstdc++-prettyprinters/80276.cc: Remove dg-skip-if for
	profile mode.
	* testsuite/libstdc++-prettyprinters/compat.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/cxx11.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/cxx17.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/debug.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/debug_cxx11.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/libfundts.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/simple.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/simple11.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/whatis.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/whatis2.cc: Likewise.

From-SVN: r271120
2019-05-13 11:50:21 +01:00
Jonathan Wakely 0d09ca2550 Remove array_allocator extension, deprecated since 4.9.0
This type is not a conforming allocator, because it cannot be reliably
rebound to allocate for a different type. The result of the rebind
transformation still uses the same underlying std::tr1::array<T, 1>
array, which may not be correctly aligned or even have elements the
right size for the value_type of the rebound allocator.

It has been deprecated for several years and should now be removed.

	* doc/xml/manual/allocator.xml: Remove documentation for
	array_allocator.
	* doc/xml/manual/evolution.xml: Document array_allocator removal.
	* doc/xml/manual/using.xml: Remove header from documentation.
	* include/Makefile.am: Remove <ext/array_allocator.h> header.
	* include/Makefile.in: Regenerate.
	* include/ext/array_allocator.h: Remove.
	* include/precompiled/extc++.h: Do not include removed header.
	* testsuite/ext/array_allocator/1.cc: Remove.
	* testsuite/ext/array_allocator/2.cc: Remove.
	* testsuite/ext/array_allocator/26875.cc: Remove.
	* testsuite/ext/array_allocator/3.cc: Remove.
	* testsuite/ext/array_allocator/check_deallocate_null.cc: Remove.
	* testsuite/ext/array_allocator/check_delete.cc: Remove.
	* testsuite/ext/array_allocator/check_new.cc: Remove.
	* testsuite/ext/array_allocator/variadic_construct.cc: Remove.
	* testsuite/ext/headers.cc: Do not include removed header.

From-SVN: r271119
2019-05-13 11:49:58 +01:00
François Dumont e9c54233f7 stl_bvector.h (operator==(const _Bit_iterator_base&, const _Bit_iterator_base&)): Make hidden friend.
2019-05-11  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/stl_bvector.h
	(operator==(const _Bit_iterator_base&, const _Bit_iterator_base&)):
	Make hidden friend.
	(operator<(const _Bit_iterator_base&, const _Bit_iterator_base&)):
	Likewise.
	(operator!=(const _Bit_iterator_base&, const _Bit_iterator_base&)):
	Likewise.
	(operator>(const _Bit_iterator_base&, const _Bit_iterator_base&)):
	Likewise.
	(operator<=(const _Bit_iterator_base&, const _Bit_iterator_base&)):
	Likewise.
	(operator>=(const _Bit_iterator_base&, const _Bit_iterator_base&)):
	Likewise.
	(operator-(const _Bit_iterator_base&, const _Bit_iterator_base&)):
	Likewise.
	(_Bit_iterator::operator+(difference_type)): Likewise and allow NRVO
	copy elision.
	(_Bit_iterator::operator-(difference_type)): Likewise.
	(operator+(ptrdiff_t, const _Bit_iterator&)): Make hidden friend.
	(_Bit_const_iterator::operator+(difference_type)): Likewise and allow
	NRVO copy elision.
	(_Bit_const_iterator::operator-(difference_type)): Likewise.
	(operator+(ptrdiff_t, const _Bit_const_iterator&)): Make hidden friend.

From-SVN: r271096
2019-05-11 13:29:05 +00:00
Jonathan Wakely 1a1e427caa PR libstdc++/81266 fix std:🧵:native_handle_type test
The test uses remove_pointer because in most cases native_handle_type is
a pointer to the actual type that the C++ class contains. However, for
std::thread, native_handle_type is the same type as the type contained
in std::thread, and so remove_pointer is not needed. On targets where
pthread_t is a pointer type remove_pointer<native_handle_type> is not a
no-op, instead it transforms pthread_t and causes the test to fail.

The fix is to not apply remove_pointer when testing std::thread.

	PR libstdc++/81266
	* testsuite/util/thread/all.h: Do not use remove_pointer for
	std:🧵:native_handle_type.

From-SVN: r271080
2019-05-10 22:41:23 +01:00
Jonathan Wakely 4b7a3ab82f PR libstdc++/90397 fix std::variant friend declarations
Clang diagnoses the inconsistent noexcept-specifier on the friend
declaration of __get. Add it, and also on __get_storage.

	PR libstdc++/90397
	* include/std/variant (_Variant_storage<false, Types...>::_M_storage())
	(_Variant_storage<true, Types...>::_M_reset()))
	(_Variant_storage<true, Types...>::_M_storage())): Add noexcept.
	(__get_storage): Likewise.
	(variant): Add noexcept to friend declarations for __get and
	__get_storage.

From-SVN: r271079
2019-05-10 22:41:19 +01:00
Jonathan Wakely 7fb65a8759 PR libstdc++/90388 fix std::hash<unique_ptr<T,D>> bugs
A disabled specialization should not be callable, so move the function
call operator into a new base class which correctly implements the
disabled hash semantics. For the versioned namespace configuration do
not derive from __poison_hash in the enabled case, as the empty base
class serves no purpose but potentially increases the object size. For
the default configuration that base class must be kept, to preserve
layout.

An enabled specialization should not be unconditionally noexcept,
because the underlying hash object might throw.

	PR libstdc++/90388
	* include/bits/unique_ptr.h (default_delete, default_delete<T[]>):
	Use _Require for constraints.
	(operator>(nullptr_t, const unique_ptr<T,D>&)): Implement exactly as
	per the standard.
	(__uniq_ptr_hash): New base class with conditionally-disabled call
	operator.
	(hash<unique_ptr<T,D>>): Derive from __uniq_ptr_hash.
	* testsuite/20_util/default_delete/48631_neg.cc: Adjust dg-error line.
	* testsuite/20_util/unique_ptr/hash/90388.cc: New test.

From-SVN: r271078
2019-05-10 22:41:16 +01:00
Jonathan Wakely 302b699607 Improve API docs for <memory> and <new>
* include/bits/shared_ptr.h: Improve docs.
	* include/bits/shared_ptr_base.h: Likewise.
	* include/bits/stl_uninitialized.h: Likewise.
	* include/bits/unique_ptr.h: Likewise.
	* libsupc++/new: Likewise.

From-SVN: r271077
2019-05-10 22:41:11 +01:00
François Dumont b2536b7c3d stl_deque.h (operator==(const _Deque_iterator<>&, const _Deque_iterator<>&)): Make hidden friend.
2019-05-09  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/stl_deque.h
	(operator==(const _Deque_iterator<>&, const _Deque_iterator<>&)):
	Make hidden friend.
	(operator!=(const _Deque_iterator<>&, const _Deque_iterator<>&)):
	Likewise.
	(operator<(const _Deque_iterator<>&, const _Deque_iterator<>&)):
	Likewise.
	(operator<=(const _Deque_iterator<>&, const _Deque_iterator<>&)):
	Likewise.
	(operator>(const _Deque_iterator<>&, const _Deque_iterator<>&)):
	Likewise.
	(operator>=(const _Deque_iterator<>&, const _Deque_iterator<>&)):
	Likewise.
	(_Deque_iterator<>::operator+(difference_type)): Likewise and allow NRVO
	copy elision.
	(_Deque_iterator<>::operator-(difference_type)): Likewise.

From-SVN: r271027
2019-05-09 05:28:42 +00:00
François Dumont 857c72026e re PR libstdc++/90277 (Debug Mode test failures)
2019-05-08  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/90277
	* testsuite/23_containers/unordered_multiset/insert/24061-multiset.cc
	(test01): Reserve for number of insertions to avoid rehash during test.
	* testsuite/23_containers/unordered_multimap/insert/24061-multimap.cc
	(test01): Likewise.
	* testsuite/23_containers/unordered_multimap/insert/24061-multimap.cc
	(test01): Likewise.
	(test02): Likewise.
	(test03): Likewise.

From-SVN: r271011
2019-05-08 13:03:32 +00: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 0e7bd559e4 Improve API docs for std::pair
* include/bits/stl_pair.h: Improve docs.
	* include/std/tuple: Likewise.

From-SVN: r270989
2019-05-07 23:46:56 +01:00
Jonathan Wakely c34d3fd306 Improve API docs for <chrono> and <ratio>
* doc/doxygen/doxygroups.cc (std::literals): Add documentation for
	inline namespace.
	* include/std/chrono: Improve docs.
	* include/std/ratio: Do not document implementation details.
	* testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Adjust dg-error
	line numbers.
	* testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Likewise.

From-SVN: r270988
2019-05-07 23:46:53 +01:00
Jonathan Wakely f61a12b395 PR libstdc++/89102 implement new common_type rules (P0435R1, P0548R1)
This change ensures that std::common_type<> is a complete type (LWG
2408), and that std::common_type<T>, std::common_type<cv T1, cv T2>, and
std::common_type<T1, T2, R...> will use program-defined specializations
for std::common_type<T1, T2> (LWG 2465).

The implementation of common_type<T1, T2, R...> is changed to use
void_t, and the specializations for duration and time_point are modified
to also use void_t instead of depending on implementation details of
common_type.

	PR libstdc++/89102
	* doc/xml/manual/intro.xml: Document DR 2408 and 2465 changes.
	* include/std/chrono (__duration_common_type_wrapper): Replace with ...
	(__duration_common_type): New helper.
	(common_type<chrono::duration<R1, P2>, chrono::duration<R2, P2>>): Use
	__duration_common_type.
	(__timepoint_common_type_wrapper): Replace with ...
	(__timepoint_common_type): New helper.
	(common_type<chrono::time_point<C, D2>, chrono::time_point<C, D2>>):
	Use __time_point_common_type.
	* include/std/type_traits (common_type<>): Define, as per LWG 2408.
	(__common_type_impl): If either argument is transformed by decay,
	use the common_type of the decayed types.
	(__common_type_impl<_Tp, _Up, _Tp, _Up>): If the types are already
	decayed, use __do_common_type_impl to get the common_type.
	(common_type<_Tp>): Use common_type<_Tp, _Tp>.
	(__do_member_type_wrapper, __member_type_wrapper)
	(__expanded_common_type_wrapper): Remove.
	(__common_type_pack, __common_type_fold): New helpers.
	(common_type<_Tp, _Up, _Vp...>): Use new helpers instead of
	__member_type_wrapper and __expanded_common_type_wrapper.
	* testsuite/20_util/common_type/requirements/explicit_instantiation.cc:
	Test zero-length template argument list.
	* testsuite/20_util/common_type/requirements/sfinae_friendly_1.cc:
	Test single argument cases and argument types that should decay.
	* testsuite/20_util/common_type/requirements/sfinae_friendly_2.cc:
	Adjust expected error.
	* testsuite/20_util/duration/literals/range_neg.cc: Use zero for
	dg-error lineno.
	* testsuite/20_util/duration/requirements/typedefs_neg1.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg2.cc: Likewise.
	* testsuite/20_util/duration/requirements/typedefs_neg3.cc: Likewise.

From-SVN: r270987
2019-05-07 23:46:39 +01:00
Jonathan Wakely 73e828becf Fix incorrect DR numbers in libstdc++ manual
* doc/xml/manual/intro.xml: Fix DR 2537 and DR 2566 confusion.

From-SVN: r270954
2019-05-07 16:30:52 +01:00
Nina Dinka Ranns f4e678ef74 Make allocator propagation more consistent for operator+(basic_string) (P1165R1)
2019-05-01  Nina Dinka Ranns  <dinka.ranns@gmail.com>

	Make allocator propagation more consistent for
	operator+(basic_string) (P1165R1)
	* include/bits/basic_string.h
	(operator+(basic_string&&, basic_string&&): Changed resulting
	allocator to always be the one from the first parameter.
	* include/bits/basic_string.tcc
	(operator+(const _CharT*, const basic_string&)): Changed
	resulting allocator to be SOCCC on the second parameter's allocator.
	(operator+(_CharT, const basic_string&)): Likewise.
	* testsuite/21_strings/basic_string/allocator/char/operator_plus.cc:
	New.
	* testsuite/21_strings/basic_string/allocator/wchar_t/operator_plus.cc:
	New.

From-SVN: r270953
2019-05-07 16:30:46 +01:00
Jonathan Wakely 2313938e75 Improve API docs for std::regex
* include/bits/regex.h: Improve docs.
	* include/bits/regex.tcc: Do not document implementation details.

From-SVN: r270952
2019-05-07 16:30:40 +01:00
Jonathan Wakely 99f1295989 Add test for std::hash<std::error_code>
Copied from 19_diagnostics/error_condition/hash.cc added recently.

	* testsuite/19_diagnostics/error_code/hash.cc: New test.

From-SVN: r270951
2019-05-07 16:30:29 +01:00
François Dumont 3997383be1 printers.py (add_one_template_type_printer): Add type printer for container types in std::__debug namespace.
2019-05-06  François Dumont  <fdumont@gcc.gnu.org>

	* python/libstdcxx/v6/printers.py (add_one_template_type_printer):
	Add type printer for container types in std::__debug namespace.
	* testsuite/lib/gdb-test.exp (whatis-regexp-test): New.
	(gdb-tests): Use distinct parameters for the type of test and use of
	regex.
	(gdb-test): Check for regex test even if 'whatis' test.
	* testsuite/libstdc++-prettyprinters/80276.cc: Adapt for _GLIBCXX_DEBUG
	mode.
	* testsuite/libstdc++-prettyprinters/cxx11.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/cxx17.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/libfundts.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/simple.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/simple11.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/whatis.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/whatis2.cc: Likewise.

From-SVN: r270893
2019-05-06 05:33:23 +00:00
Jonathan Wakely 5b5032522b Fix reference to wrong class in comment
* include/std/system_error (error_category): Fix comment.

From-SVN: r270877
2019-05-04 16:52:52 +01:00
Jonathan Wakely 854a5c7722 PR libstdc++/90299 make filesystem::absolute overloads consistent
In this implementation it is an error to pass the empty path to absolute,
because the empty path doesn't represent any file in the filesystem so
the function cannot meet its postcondition.

Currently the absolute(const path&, error_code&) overload reports an
error for the empty path, but using errc::no_such_file_or_directory, and
the other overload does not report an error. This patch makes them
consistntly report an errc::invalid_argument error for the empty path.

	PR libstdc++/90299
	* src/c++17/fs_ops.cc (absolute(const path&)): Report an error if the
	argument is an empty path.
	(absolute(const path&, error_code&)): Use invalid_argument as error
	code instead of no_such_file_or_directory.
	* testsuite/27_io/filesystem/operations/absolute.cc: Check handling
	of non-existent paths and empty paths with both overloads of absolute.

From-SVN: r270874
2019-05-04 15:35:33 +01:00
Jonathan Wakely 2f7f1aca29 Improve API docs for <system_error> header
* include/std/system_error (error_category, error_code)
	(error_condition): Improve docs.
	* libsupc++/exception: Add missing @addtogroup Doxygen command.
	* libsupc++/exception_ptr.h (exception_ptr): Link equality operators
	to class documentation. Suppress documentation for implementation
	details.
	* libsupc++/nested_exception.h (throw_with_nested, rethrow_if_nested):
	Suppress documentation for implementation details.

From-SVN: r270873
2019-05-04 15:35:29 +01:00
Jonathan Wakely fe6fb0d159 Fix std::hash<std::error_condition>
The hash value should be based on the identity (i.e. address) of the
error_category member, not its object representation (i.e. underlying
bytes).

	* include/std/system_error (error_code): Remove friend declaration
	for hash<error_code>.
	(hash<error_code>::operator()): Use public member functions to access
	value and category.
	(hash<error_condition>::operator()): Use address of category, not
	its object representation.
	* src/c++11/compatibility-c++0x.cc (hash<error_code>::operator()):
	Use public member functions to access value and category.
	* testsuite/19_diagnostics/error_condition/hash.cc: New test.

From-SVN: r270872
2019-05-04 15:35:25 +01:00
François Dumont 9db3f73dbf Add missing PR libstdc++/90277 reference.
From-SVN: r270870
2019-05-04 07:41:39 +00:00
François Dumont de6f5f5765 hashtable.h (_Hashtable<>::rehash): Review comment.
2019-05-04  François Dumont  <fdumont@gcc.gnu.org>

	* include/bits/hashtable.h (_Hashtable<>::rehash): Review comment.
	* include/bits/hashtable_policy.h
	(_Prime_rehash_policy::_M_bkt_for_elements): Use __builtin_ceill.
	(_Power2_rehash_policy::_M_bkt_for_elements): Likewise.
	(_Power2_rehash_policy::_M_next_bkt): Enforce returning a result not
	smaller than input value rather than always greater. Preserve
	_M_next_resize if called with 0 input. Use __builtin_floorl.
	(_Power2_rehash_policy::_M_need_rehash): Rehash only if number of
	elements + number of insertions is greater than _M_next_resize. Start
	with 11 buckets if not told otherwise. Use __builtin_floorl.
	(_Rehash_base<>::reserve): Use rehash policy _M_bkt_for_elements.
	* src/c++11/hashtable_c++0x.cc (_Prime_rehash_policy::_M_next_bkt):
	Preserve _M_next_resize if called with 0 input. Use __builtin_floorl.
	(_Prime_rehash_policy::_M_need_rehash): Start with 11 buckets if not
	told otherwise. Use __builtin_floorl.
	* testsuite/23_containers/unordered_set/hash_policy/71181.cc: Adapt test
	to also validate _Power2_rehash_policy.
	* testsuite/23_containers/unordered_set/hash_policy/power2_rehash.cc:
	Adapt.

From-SVN: r270868
2019-05-04 07:38:46 +00:00
Jonathan Wakely e339291fc1 Fix new testcase to not require std::copysign
Use __builtin_copysign{,f,l} when std::copysign isn't available.

	PR libstdc++/61761
	* testsuite/26_numerics/complex/proj.cc: Don't assume <cmath> defines
	std::copysign.

From-SVN: r270859
2019-05-03 20:25:05 +01:00
Jonathan Wakely 56e5b093de Avoid -Woverflow warning in __numeric_limits_integer
This is the same fix as was done for std::numeric_limits in r183905.

	PR libstdc++/52119
	* include/ext/numeric_traits.h (__glibcxx_min): Avoid integer
	overflow warning with -Wpedantic -Wsystem-headers.

From-SVN: r270858
2019-05-03 20:13:31 +01:00
Jonathan Wakely 315f8b5f18 PR libstdc++/90314 fix non-equivalent declarations of std::swap
In order to use the _GLIBCXX_NOEXCEPT_IF macro for an expression
containing commas I enclosed it in parentheses, so the preprocessor
wouldn't treat it as two arguments to the function-like macro. Clang
gives an error because now the noexcept-specifier noexcept((C)) is not
equivalent to the noexcept(C) one on the declaration of swap in
<type_traits>.

Instead of requiring extra parentheses around the expression, redefine
_GLIBCXX_NOEXCEPT_IF as a variadic macro (even though supporting that in
C++98 is a GNU extension).

	PR libstdc++/90314
	* include/bits/c++config (_GLIBCXX_NOEXCEPT_IF): Use variadic macro.
	* include/bits/move.h (swap): Remove extra parentheses.

From-SVN: r270827
2019-05-02 22:23:38 +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 efa9d8eef0 Improve smart pointer docs
* include/bits/shared_ptr.h: Improve docs.
	* include/bits/shared_ptr_atomic.h: Likewise.
	* include/bits/unique_ptr.h: Likewise. Adjust whitespace.

From-SVN: r270825
2019-05-02 22:23:25 +01:00
Jonathan Wakely 8c6a71e47c Miscellaneous API doc improvements
* include/bits/basic_string.h: Fix iterator/index confusion in
	Doxygen comments.
	* include/bits/range_access.h: Fix Doxygen warnings.
	* include/bits/refwrap.h: Do not document implementation details.
	(ref, cref): Group docs with reference_wrapper.
	* include/std/fstream: Fix Doxygen markup.
	* libsupc++/initializer_list (begin, end): Group docs with
	initializer_list.

From-SVN: r270814
2019-05-02 16:46:50 +01:00