Commit Graph

10980 Commits

Author SHA1 Message Date
Jonathan Wakely 65539b1ef3 Avoid -Wunused-parameter warnings from testsuite utility
* testsuite/util/testsuite_api.h: Remove names of unused parameters.

From-SVN: r271741
2019-05-29 15:45:50 +01:00
Jonathan Wakely b0c0d878a8 PR libstdc++/85494 use rdseed and rand_s in std::random_device
Add support for additional sources of randomness to std::random_device,
to allow using RDSEED for Intel CPUs and rand_s for Windows. When
supported these can be selected using the tokens "rdseed" and "rand_s".
For *-w64-mingw32 targets the "default" token will now use rand_s, and
for other i?86-*-* and x86_64-*-* targets it will try to use "rdseed"
first, then "rdrand", and finally "/dev/urandom".

To simplify the declaration of std::random_device in <bits/random.h> the
constructors now unconditionally call _M_init instead of _M_init_pretr1,
and the function call operator now unconditionally calls _M_getval. The
library code now decides whether _M_init and _M_getval should use a real
source of randomness or the mt19937 engine.

Existing code compiled against old libstdc++ headers will still call
_M_init_pretr1 and _M_getval_pretr1, but those functions now forward to
_M_init and _M_getval if a real source of randomness is available. This
means existing code compiled for mingw-w64 will start to use rand_s just
by linking to a new libstdc++.dll.

	* acinclude.m4 (GLIBCXX_CHECK_X86_RDSEED): Define macro to check if
	the assembler supports rdseed.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_CHECK_X86_RDSEED.
	* config/os/mingw32-w64/os_defines.h (_GLIBCXX_USE_CRT_RAND_S): Define.
	* doc/html/*: Regenerate.
	* doc/xml/manual/status_cxx2011.xml: Document new tokens.
	* include/bits/random.h (random_device::random_device()): Always call
	_M_init rather than _M_init_pretr1.
	(random_device::random_device(const string&)): Likewise.
	(random_device::operator()()): Always call _M_getval().
	(random_device::_M_file): Replace first member of union with an
	anonymous struct, with _M_file as its first member.
	* src/c++11/random.cc [_GLIBCXX_X86_RDRAND] (USE_RDRAND): Define.
	[_GLIBCXX_X86_RDSEED] (USE_RDSEED): Define.
	(USE_MT19937): Define if none of the above are defined.
	(USE_POSIX_FILE_IO): Define.
	(_M_strtoul): Remove.
	[USE_RDSEED] (__x86_rdseed): Define new function.
	[_GLIBCXX_USE_CRT_RAND_S] (__winxp_rand_s): Define new function.
	(random_device::_M_init(const string&)): Initialize new union members.
	Add support for "rdseed" and "rand_s" tokens. Decide what the
	"default" token does according to which USE_* macros are defined.
	[USE_POSIX_FILE_IO]: Store a file descriptor.
	[USE_MT19937]: Forward to _M_init_pretr1 instead.
	(random_device::_M_init_pretr1(const string&)) [USE_MT19937]: Inline
	code from _M_strtoul.
	[!USE_MT19937]: Call _M_init, transforming the old default token or
	numeric tokens to "default".
	(random_device::_M_fini()) [USE_POSIX_FILE_IO]: Use close not fclose.
	(random_device::_M_getval()): Use new union members to obtain a
	random number from the stored function pointer or file descriptor.
	[USE_MT19937]: Obtain a value from the mt19937 engine.
	(random_device::_M_getval_pretr1()): Call _M_getval().
	(random_device::_M_getentropy()) [USE_POSIX_FILE_IO]: Use _M_fd
	instead of fileno.
	[!USE_MT19937] (mersenne_twister): Do not instantiate when not needed.
	* testsuite/26_numerics/random/random_device/85494.cc: New test.

From-SVN: r271740
2019-05-29 15:45:35 +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 d9b401df8f Fix C++14-only code in testsuite utility
* testsuite/util/testsuite_fs.h (compare_paths): Use three-argument
	form of std::equals for C++11 compatibility.

From-SVN: r271716
2019-05-28 20:39:41 +01:00
Gerald Pfeifer 558f3941e9 appendix_contributing.xml: Update pointer to C++ standard at ansi.org.
* doc/xml/manual/appendix_contributing.xml: Update pointer to
	C++ standard at ansi.org.

From-SVN: r271635
2019-05-26 19:46:09 +00:00
Jonathan Wakely 09b4000c7c Fix std::midpoint(T*, T*) for reversed arguments
* include/std/numeric (midpoint(T*, T*)): Fix incorrect result.
	* testsuite/26_numerics/midpoint/pointer.cc: Change "compile" test
	to "run".

From-SVN: r271606
2019-05-24 16:39:35 +01:00
Jonathan Wakely 2fb1b29d37 Fix broken shared_ptr test
* testsuite/20_util/shared_ptr/cons/alias-rval.cc: Fix test.
	* testsuite/20_util/shared_ptr/cons/alias.cc: Remove unused function.

From-SVN: r271603
2019-05-24 14:00:26 +01:00
Jonathan Wakely 5f303216e5 Fix testsuite bugs
One of the static assertions in 20_util/function_objects/invoke/1.cc was
wrong, but didn't fail because by default it was compiled with
-std=gnu++14 which didn't use that static assertion. Split out the C++17
parts to a new file that always runs with -std=gnu++17, so those checks
are always done.

The 23_containers/unordered_set/allocator/ext_ptr.cc test is supposed to
be a run-time test but was unintentionally compile-only.

	* testsuite/20_util/function_objects/invoke/1.cc: Move C++17-specific
	tests to ...
	* testsuite/20_util/function_objects/invoke/3.cc: New test.
	* testsuite/23_containers/unordered_set/allocator/ext_ptr.cc: Change
	"compile" test to "run".

From-SVN: r271584
2019-05-23 22:41:08 +01:00
Jonathan Wakely fb3fc4bded LWG 2996 add rvalue overloads for shared_ptr aliasing and casting
* doc/xml/manual/intro.xml: Document LWG DR 2996 change.
	* doc/html/*: Regenerate.
	* include/bits/shared_ptr.h (shared_ptr(shared_ptr&&, T*)): Add
	rvalue aliasing constructor.
	(static_pointer_cast, const_pointer, dynamic_pointer_cast)
	(reinterpret_pointer_cast): Add overloads taking rvalues.
	* include/bits/shared_ptr_base.h (__shared_ptr(__shared_ptr&&, T*)):
	Add rvalue aliasing constructor.
	* testsuite/20_util/shared_ptr/casts/1.cc: Change "compile" test to
	"run" and check return values as well as types.
	* testsuite/20_util/shared_ptr/casts/reinterpret.cc: Likewise.
	* testsuite/20_util/shared_ptr/casts/rval.cc: New test.
	* testsuite/20_util/shared_ptr/cons/alias-rval.cc: New test.
	* testsuite/20_util/shared_ptr/cons/alias.cc: Remove unused return
	values.

From-SVN: r271583
2019-05-23 22:41:02 +01:00
Jonathan Wakely 9a0af7e3fb LWG 2921 remove packaged_task constructors taking allocators
* doc/xml/manual/evolution.xml: Document LWG DR 2921 change.
	* doc/xml/manual/intro.xml: Likewise.
	* include/std/future (__create_task_state): Add default arguments
	to make providing an allocator optional.
	(packaged_task::packaged_task(F&&)): Call __create_task_state directly
	instead of delegating to another constructor.
	(packaged_task::packaged_task(allocator_arg_t, const A&, ...)): Do not
	define allocator-extended constructors for C++17 and later.
	* testsuite/30_threads/packaged_task/cons/alloc.cc: Only run test for
	C++11 and C++14.
	* testsuite/30_threads/packaged_task/cons/alloc2.cc: Likewise.
	* testsuite/30_threads/packaged_task/cons/alloc_min.cc: Likewise.
	* testsuite/30_threads/packaged_task/uses_allocator.cc: Likewise.

From-SVN: r271582
2019-05-23 22:40:56 +01:00
Hans-Peter Nilsson 0ce91914ad From what I understand of the libstdc++/83237 thread at
<https://gcc.gnu.org/ml/gcc-patches/2017-12/msg00573.html>, the
high numbers are not arbitrary, so it seems wrong to try
lowering them, or we'd just waste cycles testing nothing, or
worse, ending up with a bogus error indication.  Better to just
plain disable this part of the test for simulator targets; I
assume the results should be the same on any IEEE-float target,
i.e. no target-specific things going on here that'd raise a need
to cover it everywhere.

With this part of the test disabled, I saw the test finishing in
(time) "124.74s user" where it was before "1120.26s user"
running the cris-elf-run simulator on a "i7-4770K CPU @ 3.50GHz"
host.  Most certainly that indidates that the remainder of the
test is still too much for *some* host+simulator combos, but I'm
happy with the runtime lowered to 1/5 of the timeout (10
minutes) on this particular combination, and I'd think this
fixes timeouts for many other simulator combos too.

This construct (disabling or lowering limits for simulators) is
used elsewhere in the libstdc++ test-suite and in particular the
SIMULATOR_TEST macro is used in the testsuite machinery (though
AFAICT not in testDiscreteDist).

        * testsuite/26_numerics/random/poisson_distribution/operators/values.cc:
        Don't run the libstdc++/83237 part on simulator targets.

From-SVN: r271574
2019-05-23 18:02:05 +00:00
Jonathan Wakely 1a4f7c1b05 Add missing feature test macro to C++17 status table
* doc/xml/manual/status_cxx2017.xml: Add feature test macro for
	P0040R3.
	* doc/html/*: Regenerate.

From-SVN: r271571
2019-05-23 17:01:18 +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 f9b22a0c24 PR libstdc++/90557 fix path assignment that alters source
PR libstdc++/90557
	* src/c++17/fs_path.cc (path::_List::operator=(const _List&)): Fix
	reversed arguments to uninitialized_copy_n.
	* testsuite/27_io/filesystem/path/assign/copy.cc: Check that source
	is unchanged by copy assignment.
	* testsuite/util/testsuite_fs.h (compare_paths): Use std::equal to
	compare path components.

From-SVN: r271527
2019-05-22 23:14:34 +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
Thomas Rodgers 34d878c7bc LWG 3062 - Unnecessary decay_t in is_execution_policy_v
* include/pstl/execution_defs.h (__enable_if_execution_policy):
    Use std::__remove_cvref_t when building with GCC.

From-SVN: r271489
2019-05-21 22:15:00 +00:00
Jonathan Wakely f445f0f06c PR libstdc++/90252 fix effective-target check for TBB
PR libstdc++/90252
	* testsuite/lib/libstdc++.exp (check_effective_target_tbb-backend):
	Use "additional_flags" to pass -ltbb to v3_target_compile command.
	Use check_v3_target_prop_cached to cache the result of the test.

From-SVN: r271466
2019-05-21 14:50:41 +01:00
Jonathan Wakely 049f115abb Fix names of _Lock_policy constants in libstdc++ manual
* doc/xml/manual/shared_ptr.xml: Fix names of lock policy constants.

From-SVN: r271465
2019-05-21 14:50:35 +01:00
Thomas Rodgers 838373111f tbb-backend effective target should check ability to link TBB
PR libstdc++/90252
	    * testsuite/lib/libstdc++.exp (check_effective_target_tbb-backend):
	    Changed v3_target_compile check from preprocess to executable.
	    Added "-ltbb" to v3_target_compile flags.

From-SVN: r271451
2019-05-21 04:37:45 +00:00
Thomas Rodgers d748c543b6 Check TBB version in tbb-backed effective target check
* testsuite/lib/libstdc++.exp (check_effective_target_tbb-backend):
      Add check for Thread Building Blocks 2018 or later.

From-SVN: r271450
2019-05-21 01:06:32 +00:00
Jonathan Wakely 4c7399e992 Fix test failure due to Networking TS headers using mutexes
Only include the Networking headers for targets with Gthreads, so that
the uses of std::mutex and std::condition_variable don't cause errors.

	* testsuite/experimental/names.cc: Only include Networking TS headers
	on targets with the necessary Gthreads support.

From-SVN: r271437
2019-05-20 21:21:15 +01:00
Marek Polacek be9e458d8b CWG 2094 - volatile scalars are trivially copyable.
PR c++/85679
	* tree.c (trivially_copyable_p): Don't check CP_TYPE_VOLATILE_P for
	scalar types.

	* g++.dg/ext/is_trivially_constructible1.C: Change the expected result
	for volatile int.
	* g++.dg/ext/is_trivially_copyable.C: New test.

	* testsuite/20_util/is_trivially_copyable/value.cc: Change the expected
	result for volatile int.

From-SVN: r271435
2019-05-20 19:10:57 +00:00
Jonathan Wakely 7f67becc98 Fix failing tests for use of non-reserved names
Defining 'ptr' fails on Solaris because it's used in <netdb.h>.

Including the Filesystem TS header fails if the TS support wasn't
enabled by configure.

	* testsuite/17_intro/names.cc: Do not check 'ptr' on Solaris.
	* testsuite/experimental/names.cc: Include <experimental/filesystem>
	conditionally.

From-SVN: r271421
2019-05-20 15:38:21 +01:00
Jonathan Wakely 58487c21b6 PR c++/90532 Ensure __is_constructible(T[]) is false
An array of an unknown bound is an incomplete type, so no object of such
a type can be constructed. This means __is_constructible should always
be false for an array of unknown bound.

This patch also changes the std::is_default_constructible trait to use
std::is_constructible, which now gives the right answer for arrays of
unknown bound.

gcc/cp:

	PR c++/90532 Ensure __is_constructible(T[]) is false
	* method.c (is_xible_helper): Return error_mark_node for construction
	of an array of unknown bound.

gcc/testsuite:

	PR c++/90532 Ensure __is_constructible(T[]) is false
	* g++.dg/ext/90532.C: New test.

libstdc++-v3:

	PR c++/90532 Ensure __is_constructible(T[]) is false
	* include/std/type_traits (__do_is_default_constructible_impl)
	(__is_default_constructible_atom, __is_default_constructible_safe):
	Remove.
	(is_default_constructible): Use is_constructible.
	* testsuite/20_util/is_constructible/value.cc: Check int[] case.
	* testsuite/20_util/is_default_constructible/value.cc: Likewise.
	* testsuite/20_util/is_trivially_constructible/value.cc: Likewise.
	* testsuite/20_util/is_trivially_default_constructible/value.cc:
	Likewise.

From-SVN: r271412
2019-05-20 12:32:51 +01:00
Pádraig Brady e5178b986a std::allocator::deallocate support sized-deallocation
Pass the size to the allocator so that it may optimize deallocation.
This was seen to significantly reduce the work required in jemalloc,
with about 40% reduction in CPU cycles in the free path.

Note jemalloc >= 5.2 is required to fix a crash with 0 sizes.

2019-05-20  Pádraig Brady  <pbrady@fb.com>

	* libstdc++-v3/include/ext/new_allocator.h (deallocate): Pass the size
	to the deallocator with -fsized-deallocation.

From-SVN: r271409
2019-05-20 12:15:03 +01:00
Jonathan Wakely eb530cab9a Fix test bug with mismatched alignment in allocate/deallocate
* testsuite/experimental/memory_resource/new_delete_resource.cc: Fix
	test by passing correct alignment to deallocate function.

From-SVN: r271408
2019-05-20 12:14:56 +01:00
Jonathan Wakely 1a0a374429 PR libstdc++/90520 adjust Xmethod for recent unique_ptr changes
PR libstdc++/90520
	* python/libstdcxx/v6/printers.py (UniquePointerPrinter.__init__):
	Raise exception if unique_ptr tuple member has unknown structure.
	* python/libstdcxx/v6/xmethods.py (UniquePtrGetWorker.__call__):
	Adjust worker to support new __uniq_ptr_data base class. Do not
	assume field called _M_head_impl is the first tuple element.

From-SVN: r271363
2019-05-18 00:08:00 +01:00
Martin Sebor a9c697b883 trans.c (check_inlining_for_nested_subprog): Quote reserved names.
gcc/ada/ChangeLog:

        * gcc-interface/trans.c (check_inlining_for_nested_subprog): Quote
        reserved names.

gcc/brig/ChangeLog:

        * brigfrontend/brig-control-handler.cc
        (brig_directive_control_handler::operator): Remove trailing newline
        from a diagnostic.
        * brigfrontend/brig-module-handler.cc
        (brig_directive_module_handler::operator): Remove a duplicated space
        from a diagnostic.

gcc/c/ChangeLog:

        * c-decl.c (start_decl): Quote keywords, operators, and
        types in diagnostics.
        (finish_decl): Same.
        * c-parser.c (c_parser_asm_statement): Same.
        (c_parser_conditional_expression): Same.
        (c_parser_transaction_cancel): Same.
        * c-typeck.c (c_common_type): Same.
        (build_conditional_expr): Same.
        (digest_init): Same.
        (process_init_element): Same.
        (build_binary_op): Same.

gcc/c-family/ChangeLog:

        * c-attribs.c (handle_no_sanitize_attribute): Quote identifiers,
        keywords, operators, and types in diagnostics.
        (handle_scalar_storage_order_attribute): Same.
        (handle_mode_attribute): Same.
        (handle_visibility_attribute): Same.
        (handle_assume_aligned_attribute): Same.
        (handle_no_split_stack_attribute): Same.
        * c-common.c (shorten_compare): Same.
        (c_common_truthvalue_conversion): Same.
        (cb_get_source_date_epoch): Same.
        * c-lex.c (cb_def_pragma): Quote keywords, operators, and types
        in diagnostics.
        (interpret_float): Same.
        * c-omp.c (c_finish_omp_for): Same.
        * c-opts.c (c_common_post_options): Same.
        * c-pch.c (c_common_pch_pragma): Same.
        * c-pragma.c (pop_alignment): Same.
        (handle_pragma_pack): Same.
        (apply_pragma_weak): Same.
        (handle_pragma_weak): Same.
        (handle_pragma_scalar_storage_order): Same.
        (handle_pragma_redefine_extname): Same.
        (add_to_renaming_pragma_list): Same.
        (maybe_apply_renaming_pragma): Same.
        (push_visibility): Same.
        (handle_pragma_visibility): Same.
        (handle_pragma_optimize): Same.
        (handle_pragma_message): Same.
        * c-warn.c (warn_for_omitted_condop): Same.
        (lvalue_error): Same.

gcc/cp/ChangeLog:

        * call.c (print_z_candidate): Wrap diagnostic text in a gettext
        macro.  Adjust.
        (print_z_candidates): Same.
        (build_conditional_expr_1): Quote keywords, operators, and types
        in diagnostics.
        (build_op_delete_call): Same.
        (maybe_print_user_conv_context): Wrap diagnostic text in a gettext
        macro.
        (convert_like_real): Same.
        (convert_arg_to_ellipsis): Quote keywords, operators, and types
        in diagnostics.
        (build_over_call): Same.
        (joust): Break up an overlong line.  Wrap diagnostic text in a gettext
        macro.
        * constexpr.c (cxx_eval_check_shift_p): Spell out >= in English.
        (cxx_eval_constant_expression): Quote keywords, operators, and types
        in diagnostics.
        (potential_constant_expression_1): Same.
        * cp-gimplify.c (cp_genericize_r): Same.
        * cvt.c (maybe_warn_nodiscard): Quote keywords, operators, and types
        in diagnostics.
        (type_promotes_to): Same.
        * decl.c (check_previous_goto_1): Same.
        (check_goto): Same.
        (start_decl): Same.
        (cp_finish_decl): Avoid parenthesizing a sentence for consistency.
        (grok_op_properties): Quote keywords, operators, and types
        in diagnostics.
        * decl2.c (grokfield): Same.
        (coerce_delete_type): Same.
        * except.c (is_admissible_throw_operand_or_catch_parameter): Same.
        * friend.c (do_friend): Quote C++ tokens.
        * init.c (build_new_1): Quote keywords, operators, and types
        in diagnostics.
        (build_vec_delete_1): Same.
        (build_delete): Same.
        * lex.c (parse_strconst_pragma): Same.
        (handle_pragma_implementation): Same.
        (unqualified_fn_lookup_error): Same.
        * mangle.c (write_type): Same.
        * method.c (defaulted_late_check): Avoid two consecutive punctuators.
        * name-lookup.c (cp_binding_level_debug): Remove a trailing newline.
        (pop_everything): Same.
        * parser.c (cp_lexer_start_debugging): Quote a macro name.
        in a diagnostic
        (cp_lexer_stop_debugging): Same.
        (cp_parser_userdef_numeric_literal): Quote a C++ header name
        in a diagnostic.
        (cp_parser_nested_name_specifier_opt): Quote keywords, operators,
        and types in diagnostics.
        (cp_parser_question_colon_clause): Same.
        (cp_parser_asm_definition): Same.
        (cp_parser_init_declarator): Same.
        (cp_parser_template_declaration_after_parameters): Avoid capitalizing
        a sentence in a diagnostic.
        (cp_parser_omp_declare_reduction): Quote keywords, operators, and types
        in diagnostics.
        (cp_parser_transaction): Same.
        * pt.c (maybe_process_partial_specialization): Replace second call
        to permerror with inform for consistency with other uses.
        (expand_integer_pack): Quote keywords, operators, and types
        in diagnostics.
        * rtti.c (get_typeid): Quote keywords, operators, and types
        in diagnostics.
        (build_dynamic_cast_1): Same.
        * semantics.c (finish_asm_stmt): Same.
        (finish_label_decl): Same.
        (finish_bases): Same.
        (finish_offsetof): Same.
        (cp_check_omp_declare_reduction): Same.
        (finish_decltype_type): Same.
        * tree.c (handle_init_priority_attribute): Same.  Add detail
        to diagnostics.
        (maybe_warn_zero_as_null_pointer_constant): Same.
        * typeck.c (cp_build_binary_op): Quote keywords, operators, and types
        in diagnostics.
        (cp_build_unary_op): Same.
        (check_for_casting_away_constness): Same.
        (build_static_cast): Same.
        (build_const_cast_1): Same.
        (maybe_warn_about_returning_address_of_local): Same.
        (check_return_expr): Same.
        * typeck2.c (abstract_virtuals_error_sfinae): Same.
        (digest_init_r): Replace a tab with spaces in a diagnostic.
        (build_functional_cast): Quote keywords, operators, and types
        in diagnostics.

gcc/d/ChangeLog:

        * d-builtins.cc (d_init_builtins): Quote keywords, operators,
        and types in diagnostics.
        * d-codegen.cc (get_array_length): Same.  Replace can't with cannot.
        * d-convert.cc (convert_expr): Same.
        * d-frontend.cc (getTypeInfoType): Quote an option name in
        a diagnostic.
        * d-lang.cc (d_handle_option): Same.
        (d_parse_file): Same.
        * decl.cc: Remove a trailing period from a diagnostic.
        * expr.cc: Use a directive for an apostrophe.
        * toir.cc: Quote keywords, operators, and types in diagnostics.
        * typeinfo.cc (build_typeinfo): Quote an option name in a diagnostic.

gcc/fortran/ChangeLog:

	* gfortranspec.c (append_arg): Spell out the word "argument."

gcc/ChangeLog:

        * config/i386/i386-expand.c (get_element_number): Quote keywords
        and other internal names in diagnostics.  Adjust other diagnostic
        formatting issues noted by -Wformat-diag.
        * config/i386/i386-features.c
        (ix86_mangle_function_version_assembler_name): Same.
        * config/i386/i386-options.c (ix86_handle_abi_attribute): Same.
        * config/i386/i386.c (ix86_function_type_abi): Same.
        (ix86_function_ms_hook_prologue): Same.
        (classify_argument): Same.
        (ix86_expand_prologue): Same.
        (ix86_md_asm_adjust): Same.
        (ix86_memmodel_check): Same.

gcc/ChangeLog:

        * builtins.c (expand_builtin_atomic_always_lock_free): Quote
        identifiers, keywords, operators, and types in diagnostics.  Correct
        quoting, spelling, and sentence capitalization issues.
        (expand_builtin_atomic_is_lock_free): Same.
        (fold_builtin_next_arg): Same.
        * cfgexpand.c (expand_one_var): Same.
        (tree_conflicts_with_clobbers_p): Same.
        (expand_asm_stmt): Same.
        (verify_loop_structure): Same.
        * cgraphunit.c (process_function_and_variable_attributes): Same.
        * collect-utils.c (collect_execute): Same.
        * collect2.c (maybe_run_lto_and_relink): Same.
        (is_lto_object_file): Same.
        (scan_prog_file): Same.
        * convert.c (convert_to_real_1): Same.
        * dwarf2out.c (dwarf2out_begin_prologue): Same.
        * except.c (verify_eh_tree): Same.
        * gcc.c (execute): Same.
        (eval_spec_function): Same.
        (run_attempt): Same.
        (driver::set_up_specs): Same.
        (compare_debug_auxbase_opt_spec_function): Same.
        * gcov-tool.c (unlink_gcda_file): Same.
        (do_merge): Same.
        (do_rewrite): Same.
        * gcse.c (gcse_or_cprop_is_too_expensive): Same.
        * gimplify.c (gimplify_asm_expr): Same.
        (gimplify_adjust_omp_clauses): Same.
        * hsa-gen.c (gen_hsa_addr_insns): Same.
        (gen_hsa_insns_for_load): Same.
        (gen_hsa_cmp_insn_from_gimple): Same.
        (gen_hsa_insns_for_operation_assignment): Same.
        (gen_get_level): Same.
        (gen_hsa_alloca): Same.
        (omp_simple_builtin::generate): Same.
        (gen_hsa_atomic_for_builtin): Same.
        (gen_hsa_insns_for_call): Same.
        * input.c (dump_location_info): Same.
        * ipa-devirt.c (compare_virtual_tables): Same.
        * ira.c (ira_setup_eliminable_regset): Same.
        * lra-assigns.c (lra_assign): Same.
        * lra-constraints.c (lra_constraints): Same.
        * lto-streamer-in.c (lto_input_mode_table): Same.
        * lto-wrapper.c (get_options_from_collect_gcc_options): Same.
        (merge_and_complain): Same.
        (compile_offload_image): Same.
        (compile_images_for_offload_targets): Same.
        (debug_objcopy): Same.
        (run_gcc): Same.
        (main): Same.
        * opts.c (print_specific_help): Same.
        (parse_no_sanitize_attribute): Same.
        (print_help): Same.
        (handle_param): Same.
        * plugin.c (add_new_plugin): Same.
        (parse_plugin_arg_opt): Same.
        (try_init_one_plugin): Same.
        * print-rtl.c (debug_bb_n_slim): Quote identifiers, keywords,
        operators, and types in diagnostics.  Correct quoting and spelling
        issues.
        * read-rtl-function.c (parse_edge_flag_token): Same.
        (function_reader::parse_enum_value): Same.
        * reg-stack.c (check_asm_stack_operands): Same.
        * regcprop.c (validate_value_data): Same.
        * sched-rgn.c (make_pass_sched_fusion): Same.
        * stmt.c (check_unique_operand_names): Same.
        * targhooks.c (default_target_option_pragma_parse): Same.
        * tlink.c (recompile_files): Same.
        * toplev.c (process_options): Same.
        (do_compile): Same.
        * trans-mem.c (diagnose_tm_1): Same.
        (ipa_tm_scan_irr_block): Same.
        (ipa_tm_diagnose_transaction): Same.
        * tree-cfg.c (verify_address): Same.  Use get_tree_code_name to
        format a tree code name in a diagnostic.
        (verify_types_in_gimple_min_lval): Same.
        (verify_types_in_gimple_reference): Same.
        (verify_gimple_call): Same.
        (verify_gimple_assign_unary): Same.
        (verify_gimple_assign_binary): Same.
        (verify_gimple_assign_ternary): Same.
        (verify_gimple_assign_single): Same.
        (verify_gimple_switch): Same.
        (verify_gimple_label): Same.
        (verify_gimple_phi): Same.
        (verify_gimple_in_seq): Same.
        (verify_eh_throw_stmt_node): Same.
        (collect_subblocks): Same.
        (gimple_verify_flow_info): Same.
        (do_warn_unused_result): Same.
        * tree-inline.c (expand_call_inline): Same.
        * tree-into-ssa.c (update_ssa): Same.
        * tree.c (tree_int_cst_elt_check_failed): Same.
        (tree_vec_elt_check_failed): Same.
        (omp_clause_operand_check_failed): Same.
        (verify_type_variant): Same.
        (verify_type): Same.
        * value-prof.c (verify_histograms): Same.
        * varasm.c (assemble_start_function): Same.

gcc/lto/ChangeLog:

        * lto-dump.c (lto_main): Same.
        * lto.c (stream_out): Same.

gcc/objc/ChangeLog:

        * objc-act.c (objc_begin_catch_clause): Quote keywords and options
        in diagnostics.
        (objc_build_throw_stmt): Same.
        (objc_finish_message_expr): Same.
        (get_super_receiver): Same.
        * objc-next-runtime-abi-01.c (objc_next_runtime_abi_01_init): Spell
        out "less than" in English./
        * objc-next-runtime-abi-02.c (objc_next_runtime_abi_02_init): Spell
        out "greater" in English.

gcc/testsuite/ChangeLog:

        * c-c++-common/Wbool-operation-1.c: Adjust text of expected diagnostics.
        * c-c++-common/Wvarargs-2.c: Same.
        * c-c++-common/Wvarargs.c: Same.
        * c-c++-common/pr51768.c: Same.
        * c-c++-common/tm/inline-asm.c: Same.
        * c-c++-common/tm/safe-1.c: Same.
        * g++.dg/asm-qual-1.C: Same.
        * g++.dg/asm-qual-3.C: Same.
        * g++.dg/conversion/dynamic1.C: Same.
        * g++.dg/cpp0x/constexpr-89599.C: Same.
        * g++.dg/cpp0x/constexpr-cast.C: Same.
        * g++.dg/cpp0x/constexpr-shift1.C: Same.
        * g++.dg/cpp0x/lambda/lambda-conv11.C: Same.
        * g++.dg/cpp0x/nullptr04.C: Same.
        * g++.dg/cpp0x/static_assert12.C: Same.
        * g++.dg/cpp0x/static_assert8.C: Same.
        * g++.dg/cpp1y/lambda-conv1.C: Same.
        * g++.dg/cpp1y/pr79393-3.C: Same.
        * g++.dg/cpp1y/static_assert1.C: Same.
        * g++.dg/cpp1z/constexpr-if4.C: Same.
        * g++.dg/cpp1z/constexpr-if5.C: Same.
        * g++.dg/cpp1z/constexpr-if9.C: Same.
        * g++.dg/eh/goto2.C: Same.
        * g++.dg/eh/goto3.C: Same.
        * g++.dg/expr/static_cast8.C: Same.
        * g++.dg/ext/flexary5.C: Same.
        * g++.dg/ext/utf-array-short-wchar.C: Same.
        * g++.dg/ext/utf-array.C: Same.
        * g++.dg/ext/utf8-2.C: Same.
        * g++.dg/gomp/loop-4.C: Same.
        * g++.dg/gomp/macro-4.C: Same.
        * g++.dg/gomp/udr-1.C: Same.
        * g++.dg/init/initializer-string-too-long.C: Same.
        * g++.dg/other/offsetof9.C: Same.
        * g++.dg/ubsan/pr63956.C: Same.
        * g++.dg/warn/Wbool-operation-1.C: Same.
        * g++.dg/warn/Wtype-limits-Wextra.C: Same.
        * g++.dg/warn/Wtype-limits.C: Same.
        * g++.dg/wrappers/pr88680.C: Same.
        * g++.old-deja/g++.mike/eh55.C: Same.
        * gcc.dg/Wsign-compare-1.c: Same.
        * gcc.dg/Wtype-limits-Wextra.c: Same.
        * gcc.dg/Wtype-limits.c: Same.
        * gcc.dg/Wunknownprag.c: Same.
        * gcc.dg/Wunsuffixed-float-constants-1.c: Same.
        * gcc.dg/asm-6.c: Same.
        * gcc.dg/asm-qual-1.c: Same.
        * gcc.dg/cast-1.c: Same.
        * gcc.dg/cast-2.c: Same.
        * gcc.dg/cast-3.c: Same.
        * gcc.dg/cpp/source_date_epoch-2.c: Same.
        * gcc.dg/debug/pr85252.c: Same.
        * gcc.dg/dfp/cast-bad.c: Same.
        * gcc.dg/format/gcc_diag-1.c: Same.
        * gcc.dg/format/gcc_diag-11.c: Same.New test.
        * gcc.dg/gcc_diag-11.c: Same.New test.
        * gcc.dg/gnu-cond-expr-2.c: Same.
        * gcc.dg/gnu-cond-expr-3.c: Same.
        * gcc.dg/gomp/macro-4.c: Same.
        * gcc.dg/init-bad-1.c: Same.
        * gcc.dg/init-bad-2.c: Same.
        * gcc.dg/init-bad-3.c: Same.
        * gcc.dg/pr27528.c: Same.
        * gcc.dg/pr48552-1.c: Same.
        * gcc.dg/pr48552-2.c: Same.
        * gcc.dg/pr59846.c: Same.
        * gcc.dg/pr61096-1.c: Same.
        * gcc.dg/pr8788-1.c: Same.
        * gcc.dg/pr90082.c: Same.
        * gcc.dg/simd-2.c: Same.
        * gcc.dg/spellcheck-params-2.c: Same.
        * gcc.dg/spellcheck-params.c: Same.
        * gcc.dg/strlenopt-49.c: Same.
        * gcc.dg/tm/pr52141.c: Same.
        * gcc.dg/torture/pr51106-1.c: Same.
        * gcc.dg/torture/pr51106-2.c: Same.
        * gcc.dg/utf-array-short-wchar.c: Same.
        * gcc.dg/utf-array.c: Same.
        * gcc.dg/utf8-2.c: Same.
        * gcc.dg/warn-sprintf-no-nul.c: Same.
        * gcc.target/i386/asm-flag-0.c: Same.
        * gcc.target/i386/inline_error.c: Same.
        * gcc.target/i386/pr30848.c: Same.
        * gcc.target/i386/pr39082-1.c: Same.
        * gcc.target/i386/pr39678.c: Same.
        * gcc.target/i386/pr57756.c: Same.
        * gcc.target/i386/pr68843-1.c: Same.
        * gcc.target/i386/pr79804.c: Same.
        * gcc.target/i386/pr82673.c: Same.
        * obj-c++.dg/class-protocol-1.mm: Same.
        * obj-c++.dg/exceptions-3.mm: Same.
        * obj-c++.dg/exceptions-4.mm: Same.
        * obj-c++.dg/exceptions-5.mm: Same.
        * obj-c++.dg/exceptions-6.mm: Same.
        * obj-c++.dg/method-12.mm: Same.
        * obj-c++.dg/method-13.mm: Same.
        * obj-c++.dg/method-6.mm: Same.
        * obj-c++.dg/method-7.mm: Same.
        * obj-c++.dg/method-9.mm: Same.
        * obj-c++.dg/method-lookup-1.mm: Same.
        * obj-c++.dg/proto-lossage-4.mm: Same.
        * obj-c++.dg/protocol-qualifier-2.mm: Same.
        * objc.dg/call-super-2.m: Same.
        * objc.dg/class-protocol-1.m: Same.
        * objc.dg/desig-init-1.m: Same.
        * objc.dg/exceptions-3.m: Same.
        * objc.dg/exceptions-4.m: Same.
        * objc.dg/exceptions-5.m: Same.
        * objc.dg/exceptions-6.m: Same.
        * objc.dg/method-19.m: Same.
        * objc.dg/method-2.m: Same.
        * objc.dg/method-5.m: Same.
        * objc.dg/method-6.m: Same.
        * objc.dg/method-7.m: Same.
        * objc.dg/method-lookup-1.m: Same.
        * objc.dg/proto-hier-1.m: Same.
        * objc.dg/proto-lossage-4.m: Same.

From-SVN: r271338
2019-05-17 11:55:43 -06:00
François Dumont 6f1becb660 2019-05-17 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_deque.h
	(_Deque_iterator<>::__ptr_to): Remove, use std::__ptr_rebind.
	(_Deque_base(_Deque_base&&, const allocator_type&)): New.
	(_Deque_base::_Deque_impl_data): New.
	(_Deque_base::_Deque_impl): Inherit latter.
	(_Deque_base::_Deque_impl::_M_swap_data): Move...
	(_Deque_base::_Deque_impl_data::_M_swap_data): ... here.
	(_Deque_base::_Deque_impl()): Add noexcept qualification.
	(_Deque_base::_Deque_impl(_Deque_impl&&, _Tp_alloc_type&&)): New.
	(_Deque_base::_Deque_impl::_M_get_Tp_allocator()): Remove static_cast.
	(deque<>::deque()): Default.
	(deque<>::deque(deque&&)): Default.
	(deque<>::deque(deque&&, const allocator_type&, false_type)): New.
	(deque<>::deque(deque&&, const allocator_type&, true_type)): New.
	(deque<>::deque(deque&&, const allocator_type&)): Delegate to latters.
	(deque<>::deque<_It>(_It, _It, const allocator_type&)): Use
	_M_range_initialize.
	(deque<>::assign<_It>(_It, _It)): Use _M_assign_aux.
	(deque<>::resize(size_type, const value_type&)): Share a single
	implementation.
	(deque<>::insert<_It>(const_iterator, _It, _It)): Use
	_M_range_insert_aux.
	[__cplusplus >= 201103L](_M_initialize_dispatch): Remove.
	[__cplusplus >= 201103L](_M_assign_dispatch): Remove.
	[__cplusplus >= 201103L](_M_insert_dispatch): Remove.
	* testsuite/23_containers/deque/allocator/default_init.cc: New.

From-SVN: r271330
2019-05-17 16:27:54 +00:00
Jonathan Wakely c43c3af2c5 PR libstdc++/90246 Improve text of std::variant exceptions and assertions
PR libstdc++/90246
	* include/std/variant (holds_alternative, get, get_if): Improve
	static assertion messages.
	(bad_variant_access::bad_variant_access()): Change default message.
	(__throw_bad_variant_access(bool)): New overload.
	(get): Use new overload.
	(visit, visit<R>): Improve exception message.

From-SVN: r271326
2019-05-17 15:36:37 +01:00
Jonathan Wakely ac781bc880 Fix std::variant test for ILP32 targets
* testsuite/20_util/variant/compile.cc: Fix narrowing test for ILP32
	targets. Add more cases from P0608R3.
	* testsuite/20_util/variant/run.cc: Add more cases from P0608R3.

From-SVN: r271325
2019-05-17 15:13:43 +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
Jonathan Wakely e625ccc21a PR libstdc++/85965 move is_invocable assertions again
This is another attempt to reduce how often the assertions are
evaluated, so that code which doesn't try to use the function objects
doesn't need them to be invocable.

For _Rb_tree we access the _M_key_compare object directly, so can't put
the assertions in an accessor function for it. However, every invocation
of _M_key_compare is accompanied by a use of _S_key, so the assertions
can be put in there.  For _Hashtable there are member functions that are
consistently used to obtain a hash code or test for equality, so the
assertions can go in those members.

	PR libstdc++/85965
	* include/bits/hashtable.h (_Hashtable::~_Hashtable()): Remove static
	assertions from the destructor.
	* include/bits/hashtable_policy.h (_Hash_code_base::_M_hash_code):
	Move static_assert for hash function to here.
	(_Hash_table_base::_M_equals): Move static_assert for equality
	predicate to here.
	* include/bits/stl_tree.h (_Rb_tree::_S_value(_Const_Link_type)):
	Remove.
	(_Rb_tree::_S_key(_Const_Link_type)): Move assertions here. Access
	the value directly instead of calling _S_value.
	(_Rb_tree::_S_value(_Const_Base_ptr)): Remove.
	(_Rb_tree::_S_key(_Const_Base_ptr)): Do downcast and forward to
	_S_key(_Const_Link_type).
	* testsuite/23_containers/set/85965.cc: Check construction,
	destruction, assignment and size() do not trigger the assertions.
	* testsuite/23_containers/unordered_set/85965.cc: Likewise.
	* testsuite/23_containers/map/48101_neg.cc: Call find and adjust
	expected errors.
	* testsuite/23_containers/multimap/48101_neg.cc: Likewise.
	* testsuite/23_containers/multiset/48101_neg.cc: Likewise.
	* testsuite/23_containers/set/48101_neg.cc: Likewise.
	* testsuite/23_containers/unordered_map/48101_neg.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/48101_neg.cc: Likewise.
	* testsuite/23_containers/unordered_multiset/48101_neg.cc: Likewise.
	* testsuite/23_containers/unordered_set/48101_neg.cc: Likewise.

From-SVN: r271323
2019-05-17 15:13:32 +01:00
Jonathan Wakely c471fb2f94 Fix __invoke_r<void> to be valid in C++11
* include/bits/invoke.h [__cplusplus < 201703L] (__invoke_r<void>):
	Use _GLIBCXX14_CONSTEXPR because void functions cannot be constexpr
	in C++11.

From-SVN: r271317
2019-05-17 10:28:17 +01:00
Jonathan Wakely 32a1aa7095 Add missing piece of P0777R1 and update C++20 status docs
* doc/xml/manual/status_cxx2020.xml: Update P0608R3, P0777R1, and
	P1165R1 entries.
	* doc/html/*: Regenerate.
	* include/std/tuple (make_from_tuple): Use remove_reference_t instead
	of decay_t (P0777R1).

From-SVN: r271316
2019-05-17 10:28:13 +01:00
François Dumont 935469daaa Move from state of allocators (LWG2593)
2019-05-17  François Dumont  <fdumont@gcc.gnu.org>

	Move from state of allocators (LWG2593)
	* include/bits/stl_deque.h
	(_Deque_base(_Deque_base&&, false_type)): Remove.
	(_Deque_base(_Deque_base&&, true_type)): Remove.
	(_Deque_base(_Deque_base&&)): Adapt.
	(_Deque_base::_M_move_impl()): Remove.
	* testsuite/util/testsuite_allocator.h
	(propagating_allocator(propagating_allocator&&)): Preserve move from
	state.
	* testsuite/23_containers/deque/allocator/move_assign.cc (test02):
	Adapt.
	* testsuite/23_containers/forward_list/allocator/move_assign.cc (test02):
	Adapt.
	* testsuite/23_containers/list/allocator/move_assign.cc (test02): Adapt.
	* testsuite/23_containers/map/allocator/move_assign.cc (test02): Adapt.
	* testsuite/23_containers/multimap/allocator/move_assign.cc (test02):
	Adapt.
	* testsuite/23_containers/multiset/allocator/move_assign.cc (test02):
	Adapt.
	* testsuite/23_containers/set/allocator/move_assign.cc (test02): Adapt.
	* testsuite/23_containers/unordered_map/allocator/move_assign.cc
	(test02): Adapt.
	* testsuite/23_containers/unordered_multimap/allocator/move_assign.cc
	(test02): Adapt.
	* testsuite/23_containers/unordered_multiset/allocator/move_assign.cc
	(test02): Adapt.
	* testsuite/23_containers/unordered_set/allocator/move_assign.cc
	(test02): Adapt.
	* testsuite/23_containers/vector/allocator/move_assign.cc (test02):
	Adapt.
	* testsuite/23_containers/vector/bool/allocator/move_assign.cc (test02):
	Adapt.
	* testsuite/21_strings/basic_string/allocator/char/move_assign.cc
	(test02): Adapt.
	* testsuite/21_strings/basic_string/allocator/wchar_t/move_assign.cc
	(test02): Adapt.

From-SVN: r271309
2019-05-17 04:55:37 +00:00
Jonathan Wakely 7110128236 Remove incorrect assertion from filesystem::absolute
The assertion is wrong, it should be *s.end() == 0, but that's not
allowed. Just remove it, but keep the comment.

	* src/c++17/fs_ops.cc (absolute(const path&, error_code&))
	[_GLIBCXX_FILESYSTEM_IS_WINDOWS]: Remove bogus assertion.

From-SVN: r271300
2019-05-16 23:52:10 +01:00
Jonathan Wakely d069df01ed Implement sane variant converting constructor (P0608R3)
* include/std/variant (__overload_set): Remove.
	(_Arr): New helper.
	(_Build_FUN): New class template to define a single FUN overload,
	with specializations to prevent unwanted conversions, as per P0608R3.
	(_Build_FUNs): New class template to build an overload set of FUN.
	(_FUN_type): New alias template to perform overload resolution.
	(__accepted_type): Use integer_constant base for failure case. Use
	_FUN_type for successful case.
	(variant::__accepted_index): Use _Tp instead of _Tp&&.
	(variant::variant(_Tp&&)): Likewise.
	(variant::operator=(_Tp&&)): Likewise.

From-SVN: r271296
2019-05-16 21:30:35 +01:00
Jonathan Wakely b62dcd16aa Changes to std::variant to reduce code size
* include/std/variant (_Variant_storage<false, _Types...>::_M_reset):
	Replace raw visitation with a runtime check for the valueless state
	and a non-raw visitor.
	(_Variant_storage<false, _Types...>::_M_reset_impl): Remove.
	(variant::index()): Remove branch.
	(variant::swap(variant&)): Use valueless_by_exception() instead of
	comparing the index to variant_npos, and add likelihood attribute.

From-SVN: r271295
2019-05-16 21:30:27 +01:00
Jonathan Wakely eba20412b4 Replace _Equal_helper with simpler class template
By defining the new helper inside _Hashtable_base it doesn't need all
the template parameters to be provided, and by making it only
responsible for checking a possibly-cached hash code it only has to do
one thing.  The caller can use the equality predicate itself instead of
duplicating that in the helper template.

	* include/bits/hashtable_policy.h (_Equal_helper): Remove.
	(_Hashtable_base::_Equal_hash_code): Define new class template.
	(_Hashtable_base::_M_equals): Use _Equal_hash_code instead of
	_Equal_helper.

From-SVN: r271291
2019-05-16 15:18:50 +01:00
Jonathan Wakely 1f6ea96860 Change EBO accessors from static to non-static member functions
* include/bits/hashtable_policy.h (_Hashtable_ebo_helper::_S_get):
	Replace with _M_get non-static member function.
	(_Hashtable_ebo_helper::_S_cget): Replace with _M_cget non-static
	member function.
	(_Hash_code_base, _Local_iterator_base, _Hashtable_base):
	(_Hashtable_alloc): Adjust to use non-static members of EBO helper.

From-SVN: r271290
2019-05-16 15:18:45 +01:00
Jonathan Wakely 0bc229dbbe Remove unnecessary non-const accessors in hash table bases
The const accessors are OK (and arguably more correct) for most callers
to use. The _M_swap functions that use the non-const overloads can just
directly use the _S_get members of the EBO helpers.

	* include/bits/hashtable_policy.h (_Hash_code_base::_M_swap): Use
	_S_get accessors for members in EBO helpers.
	(_Hash_code_base::_M_extract(), _Hash_code_base::_M_ranged_hash())
	(_Hash_code_base::_M_h1(), _Hash_code_base::_M_h2()): Remove non-const
	overloads.
	(_Hashtable_base::_M_swap): Use _S_get accessors for members in EBO
	helpers.
	(_Hashtable_base::_M_eq()): Remove non-const overload.

From-SVN: r271286
2019-05-16 11:04:50 +01:00
Jonathan Wakely e5d7010bb3 Qualify calls in std::visit and std::visit<R>
* include/std/variant (visit, visit<R>): Qualify calls to __do_visit.

From-SVN: r271268
2019-05-15 22:19:39 +01:00
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
Jonathan Wakely 50d5fcf5e2 Allow Markdown formatting in Doxygen comments
* doc/doxygen/user.cfg.in: Set MARKDOWN_SUPPORT=YES.

From-SVN: r270813
2019-05-02 16:46:46 +01:00
Jonathan Wakely 725708ab75 Improve docs for mutexes
* include/bits/unique_lock.h: Fix/improve doxygen markup.
	* include/std/mutex: Likewise.
	* include/std/shared_mutex: Likewise.

From-SVN: r270812
2019-05-02 16:46:42 +01:00
Jonathan Wakely d727fdc42b Improve docs for C++17 Filesystem library
* include/bits/fs_dir.h: Fix/improve doxygen markup.
	* include/bits/fs_fwd.h: Likewise.
	* include/bits/fs_ops.h: Likewise.
	* include/bits/fs_path.h: Likewise.
	* include/std/filesystem: Likewise.

From-SVN: r270811
2019-05-02 16:46:38 +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 c05ab418b3 Improve API docs for <memory> and <scoped_allocator>
* config/allocator/new_allocator_base.h (__allocator_base): Add
	workaround for Doxygen bug #6945.
	* include/std/memory: Improve docs. Define group for pointer safety.
	* include/std/scoped_allocator: Improve docs. Use "undocumented"
	conditional to suppress documentation for implementation details.

From-SVN: r270807
2019-05-02 16:45:04 +01:00
Jonathan Wakely d16250de4a Improve API docs for mathematical special functions
This prevents "Mathematical Special Functions" appearing in the
top-level menu of the generated HTML docs, and adds "TR1" to the title
for the TR1 docs, to avoid duplicate titles.

	* include/bits/specfun.h: Improve docs.
	* include/tr1/cmath: Likewise. Fix nesting of preprocessor conditions
	and namespaces.

From-SVN: r270806
2019-05-02 16:44:59 +01:00
Jonathan Wakely 19aaf81412 Improve Doxygen docs for nested namespaces
* doc/doxygen/doxygroups.cc (std::tr2, std::__gnu_cxx): Improve docs.
	(std::experimental): Add docs.
	* doc/doxygen/user.cfg.in (PREDEFINED): Expand macros for __cxx11
	namespace to nothing when generating docs.
	* include/bits/regex_constants.h (std::regex_constants): Improve docs.
	* include/std/chrono (std::chrono): Likewise.
	* include/std/functional (std::placeholders): Likewise.
	* include/std/thread (std::this_thread): Likewise.

From-SVN: r270805
2019-05-02 16:44:55 +01:00
Jonathan Wakely 69b1efc787 Fix markup for Parallel Mode docs
* include/parallel/settings.h: Fix Doxygen markup.

From-SVN: r270804
2019-05-02 16:44:51 +01:00
Jonathan Wakely 574dfb67be Adjust Doxygen processing of pb_ds containers
Several of the pb_ds headers are intended to be included multiple times,
within the definition of various class templates. The including files
define macros like PB_DS_CLASS_C_DEC and PB_DS_GEN_POS before including
these headers.

In some cases the types defined in the headers are actually nested types
within other classes, and so should not have been documented as though
they are declared in the global namespace, as in:
https://gcc.gnu.org/onlinedocs/gcc-8.3.0/libstdc++/api/a12028.html

In other cases the headers provide inline member function definitions,
but when processed by Doxygen the class name "PB_DS_CLASS_C_DEC" is not
recognised.

This patch makes Doxygen ignore definitions that only make sense when
included in the right context with the right macros defined.

	* include/ext/pb_ds/detail/bin_search_tree_/*_imps.hpp: Do not define
	anything unless PB_DS_CLASS_C_DEC is defined.
	* include/ext/pb_ds/detail/binary_heap_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/binomial_heap_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/binomial_heap_base_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/cc_hash_table_map_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/gp_hash_table_map_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/hash_fn/*_imp.hpp: Likewise.
	* include/ext/pb_ds/detail/left_child_next_sibling_heap_/*_imps.hpp:
	Likewise.
	* include/ext/pb_ds/detail/list_update_map_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/ov_tree_map_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/pairing_heap_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/pat_trie_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/rb_tree_map_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/rc_binomial_heap_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/resize_policy*_imp.hpp: Likewise.
	* include/ext/pb_ds/detail/splay_tree_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/thin_heap_/*_imps.hpp: Likewise.
	* include/ext/pb_ds/detail/trie_policy*_imp.hpp: Likewise.
	* include/ext/pb_ds/detail/unordered_iterator/const_iterator.hpp:
	Likewise.
	* include/ext/pb_ds/detail/unordered_iterator/iterator.hpp: Likewise.
	* include/ext/pb_ds/detail/unordered_iterator/point_const_iterator.hpp:
	Likewise.
	* include/ext/pb_ds/detail/unordered_iterator/point_iterator.hpp:
	Likewise.

From-SVN: r270803
2019-05-02 16:44:46 +01:00
Jonathan Wakely acd482ba72 Update libstdc++ Doxygen config
The GROUP_NESTED_COMPOUNDS option means that types nested inside inline
namespaces or other classes will be automatically added to a Doxygen
group, e.g. this actually works as intended:

  /**
   * @defgroup chrono Time
   * @ingroup utilities
   *
   * Classes and functions for time.
   * @{
   */

  namespace chrono
  {
    template<typename _Rep, typename _Period = ratio<1>>
      struct duration;

    template<typename _Clock, typename _Dur = typename _Clock::duration>
      struct time_point;
  }

  /// @}

Currently chrono::duration and chrono::time_point are not added to the
"chrono" group. They would need an explicit @ingroup tag added to them
individually. With GROUP_NESTED_COMPOUNDS=YES they get added to the
enclosing group.

The SORT_BY_SCOPE_NAME option means that the list of classes will sort
by class name, not the full qualified-id. Currently the alphabetical
Class List for classes beginning with 'c' looks like:

  char_traits (__gnu_cxx)
  character (__gnu_cxx)
  condition_base (__gnu_cxx)
  const_iterator_
  condition_variable_any (std::_V2)
  cauchy_distribution (std)
  char_traits (std)

i.e. the list is sorted by the namespaces first, then the class names.
This is not helpful when you don't know which namespace a class might be
in, and inline namespaces with reserved names are not hidden (see
https://github.com/doxygen/doxygen/issues/5914 for a feature request to
allow that).

With SORT_BY_SCOPE_NAME=NO the list looks like:

  cauchy_distribution (std)
  char_traits (__gnu_cxx)
  char_traits (std)
  character (__gnu_cxx)
  condition_base (__gnu_cxx)
  condition_variable_any (std::_V2)
  const_iterator_

This allows you to find a class by name more easily.

Also add PREDEFINED macros so that __attribute__ and various macros like
_GLIBCXX_NO_DISCARD, _GLIBCXX14_CONSTEXPR don't appear in the generated
docs.

	* doc/doxygen/user.cfg.in: Regenerate with Doxygen 1.8.14 and set
	GROUP_NESTED_COMPOUNDS=YES and SORT_BY_SCOPE_NAME=NO. Add various
	_GLIBCXX_xxx macros and __attribute__(X) to PREDEFINED macros that
	Doxygen expands.

From-SVN: r270802
2019-05-02 16:44:16 +01:00
Rainer Orth 7ee7c29355 Update Solaris baselines for GCC 9.1
* config/abi/post/i386-solaris2.10/baseline_symbols.txt: Regenerate.
	* config/abi/post/i386-solaris2.10/amd64/baseline_symbols.txt: Likewise.
	* config/abi/post/i386-solaris2.11/baseline_symbols.txt: Likewise.
	* config/abi/post/i386-solaris2.11/amd64/baseline_symbols.txt: Likewise.
	* config/abi/post/sparc-solaris2.10/baseline_symbols.txt: Likewise.
	* config/abi/post/sparc-solaris2.10/sparcv9/baseline_symbols.txt:
	Likewise.
	* config/abi/post/sparc-solaris2.11/baseline_symbols.txt: Likewise.
	* config/abi/post/sparc-solaris2.11/sparcv9/baseline_symbols.txt:
	Likewise.

From-SVN: r270773
2019-05-01 16:14:30 +00:00
Jonathan Wakely 4f75543dc4 PR libstdc++/61761 fix std::proj for targets without C99 cproj
The current generic implementation of __complex_proj used when cproj is
not available calculates the wrong projection, giving a different result
than given by C99's cproj.

When C99 cproj is not available but isinf and copysign are, use those to
give correct results for float, double and long double. Otherwise, and
for other specializations of std::complex, just use a generic version
that returns its argument, and so doesn't support infinities.

We might want to consider adding additional overloads of __complex_proj
to support extended types such as _Float64x, _Float128 etc.

	PR libstdc++/61761
	* include/std/complex (__complex_proj): Return parameter unchanged.
	[_GLIBCXX_USE_C99_COMPLEX] (__complex_proj): Change overloads for
	floating-point types to take std::complex arguments.
	[_GLIBCXX_USE_C99_MATH_TR1] (__complex_proj): Add overloads for
	floating-point types.
	* testsuite/26_numerics/complex/proj.cc: New test.

From-SVN: r270759
2019-05-01 01:08:36 +01:00
Jakub Jelinek 9e3501f765 gnu.ver (GLIBCXX_3.4.26): Change _Lock_policyE2 exports to _Lock_policyE[012].
* config/abi/pre/gnu.ver (GLIBCXX_3.4.26): Change _Lock_policyE2 exports
	to _Lock_policyE[012].
	* config/abi/post/riscv64-linux-gnu/baseline_symbols.txt: Update.

From-SVN: r270687
2019-04-30 13:40:28 +02:00
Jonathan Wakely 95767c6597 Fix filesystem::path tests
The root_path.cc test had some debugging macros left in accidentally, so
didn't FAIL correctly if an assertion failed.

The string-char8_t.cc tests didn't compile on Windows.

	* testsuite/27_io/filesystem/path/decompose/root_path.cc: Remove
	macros accidentally left in.
	* testsuite/27_io/filesystem/path/native/string-char8_t.cc: Remove
	unnecessary -lstdc++fs option. Fix test for mingw.
	* testsuite/experimental/filesystem/path/native/string-char8_t.cc:
	Fix test for mingw.

From-SVN: r270685
2019-04-30 11:39:59 +01:00
Jakub Jelinek 379637d5e2 * config/abi/post/riscv64-linux-gnu/baseline_symbols.txt: Update.
From-SVN: r270678
2019-04-30 10:55:12 +02:00
Jonathan Wakely f373ad68cf Adjust doxygen comment for std::generate_n
* include/bits/stl_algo.h (generate_n): Adjust doxygen comment.

From-SVN: r270651
2019-04-29 14:31:50 +01:00
Jonathan Wakely 81912fb385 Use _GLIBCXX_NOEXCEPT_IF for std::swap
* include/bits/move.h (swap(T&, T&), swap(T (&)[N], T (&)[N])): Use
	_GLIBCXX_NOEXCEPT_IF to simplify declarations.

From-SVN: r270650
2019-04-29 14:25:38 +01:00
Jonathan Wakely 7bbdd8d13e PR libstdc++/71312 Increase alignment of pooled mutexes
PR libstdc++/71312
	* src/c++11/shared_ptr.cc (get_mutex): Align pool mutexes to 64 bytes.

From-SVN: r270649
2019-04-29 13:55:29 +01:00
Jonathan Wakely ad1f468736 Add nodiscard to std::vector<bool>::empty()
We already added it to the std::vector primary template.

	* include/bits/stl_bvector.h (vector<bool>::empty()): Add nodiscard
	attribute.

From-SVN: r270648
2019-04-29 13:35:24 +01:00
Jonathan Wakely 82b6276fb3 Remove unused std::_Iter_base class template
This class template has been unused since __gnu_debug::__base was
removed in r263786.

	* include/bits/stl_iterator_base_types.h (_Iter_base): Remove unused
	class template and partial specialization.

From-SVN: r270647
2019-04-29 13:12:46 +01:00
Jonathan Wakely 846541dd15 PR libstdc++/87982 Fix generate_n and fill_n use of _Size parameter
The standard only requires that _Size can be converted to an integral
type, not that it can be used for arithmetic. Add a new set of
__size_to_integer helper functions to do the conversion (which will be
ambiguous if there is no one conversion that is better than any others).

Also add tests for DR 426 which requires these algorithms and search_n
to handle negative values of n.

	PR libstdc++/87982
	* include/bits/stl_algo.h (generate_n): Convert _Size parameter to
	an integral type.
	* include/bits/stl_algobase.h (__size_to_integer): New overloaded
	functions to convert a value to an integral type.
	(__fill_n_a, __fill_n_a): Assert that __n is already an integral type.
	(fill_n): Convert _Size parameter to an integral type.
	* testsuite/25_algorithms/fill_n/dr426.cc: New test.
	* testsuite/25_algorithms/generate_n/87982.cc: New test.
	* testsuite/25_algorithms/generate_n/dr426.cc: New test.

From-SVN: r270646
2019-04-29 13:12:43 +01:00
Jonathan Wakely ecc7ed8aae Fix ChangeLog format
From-SVN: r270633
2019-04-28 22:38:19 +01:00
Nina Dinka Ranns ec087ba34e Adding noexcept-specification on tuple constructors (LWG 2899)
2019-04-28 Nina Dinka Ranns <dinka.ranns@gmail.com>

* libstdc++-v3/include/std/tuple:
(tuple()): Add noexcept-specification.
(tuple(const _Elements&...)): Likewise
(tuple(_UElements&&...)): Likewise
(tuple(const tuple<_UElements...>&)): Likewise
(tuple(tuple<_UElements...>&&)): Likewise
(tuple(const _T1&, const _T2&)): Likewise
(tuple(_U1&&, _U2&&)): Likewise
(tuple(const tuple<_U1, _U2>&): Likewise
(tuple(tuple<_U1, _U2>&&): Likewise
(tuple(const pair<_U1, _U2>&): Likewise
(tuple(pair<_U1, _U2>&&): Likewise
* libstdc++-v3/testsuite/20_util/tuple/cons/noexcept_specs.cc: New

From-SVN: r270632
2019-04-29 00:17:50 +03:00
Marc Glisse 2b326d53c2 Use __restrict for __relocate_object_a
2019-04-27  Marc Glisse  <marc.glisse@inria.fr>

	PR libstdc++/87106
	* include/bits/stl_uninitialized.h (__relocate_object_a): Mark the
	arguments with __restrict.

From-SVN: r270624
2019-04-27 14:09:20 +00:00
H.J. Lu ca2efef75d x32: Update baseline_symbols.txt
* config/abi/post/x86_64-linux-gnu/x32/baseline_symbols.txt: Updated.

From-SVN: r270613
2019-04-26 09:53:54 -07: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 53e6927367 Fix tests that fail with _GLIBCXX_USE_CXX11_ABI=0
The pmr::string typedef isn't available for the old COW string, so some
tests that use it were failing.

	* testsuite/20_util/variant/run.cc: Use a new Hashable type to test
	hashing, because pmr::string depends on _GLIBCXX_USE_CXX11_ABI==1.
	* testsuite/21_strings/basic_string/hash/hash.cc
	[!_GLIBCXX_USE_CXX11_ABI]: Don't test pmr strings.
	* testsuite/21_strings/basic_string/hash/hash_char8_t.cc
	[!_GLIBCXX_USE_CXX11_ABI]: Likewise.

From-SVN: r270604
2019-04-26 16:02:02 +01:00
Jonathan Wakely 8281e3b8ea Reduce code instantiated by filesystem::path::_S_convert_loc
Jakub noted in https://gcc.gnu.org/ml/libstdc++/2019-04/msg00140.html
that an unwanted std::wstring::_M_replace_dispatch symbol has started to
be exported from the Fedora shared library. This symbol is triggered by
the instantiation of std::wstring::assign(const char*, const char*) from
std::__str_codecvt_in which is called from path::_S_convert_loc. The
branch that triggers that instantiation can't actually happen in that
case, because codecvt facets will only return noconv when the input and
output types are the same. Guarding the assign call with an if-constexpr
check that the types are the same avoids instantiating template
specializations that will never actually be needed.

	* config/abi/pre/gnu.ver (GLIBCXX_3.4): Replace wildcard that matches
	wstring::_M_replace_dispatch with more specific patterns.
	* include/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.
	* include/bits/locale_conv.h (__do_str_codecvt): Use if-constexpr to
	avoid unnecessary basic_string::assign instantiations.

From-SVN: r270602
2019-04-26 15:04:45 +01:00
Jonathan Wakely 3addb7b937 Tweak C++2a uses-allocator construction utilities
The 20_util/scoped_allocator/69293_neg.cc test was failing in C++2a mode
because the expected static_assert text wasn't matched. The code is
still ill-formed in C++2a, but uses the new __uses_alloc_args function
and so fails a different static_assert. This patch adds the same string
to the new static_assert, so the test passes.

Now that G++ allows concepts to be declared without 'bool' we can use
the correct C++2a syntax for the _Std_pair concept used to constrain the
uses-allocator construction utilities.

Also add a new test to verify that pmr::polymorphic_allocator correctly
performs recursive uses-allocator construction for nested pairs in
C++2a.

	* include/std/memory (__uses_alloc_args): Add string-literal to
	static_assert, to match the one in __uses_alloc.
	[__cpp_concepts] (_Std_pair): Use C++2a syntax for concept.
	* testsuite/20_util/polymorphic_allocator/construct_c++2a.cc: Check
	for recursive uses-allocator construction of nested pairs.
	* testsuite/20_util/scoped_allocator/construct_pair_c++2a.cc:: Add
	comment.

From-SVN: r270600
2019-04-26 14:15:54 +01:00
Jakub Jelinek f8790a498e baseline_symbols.txt: Update.
* config/abi/post/s390x-linux-gnu/32/baseline_symbols.txt: Update.
	* config/abi/post/s390-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/powerpc-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/powerpc64-linux-gnu/32/baseline_symbols.txt: Update.

From-SVN: r270598
2019-04-26 14:08:58 +02:00
Jakub Jelinek 849ab78ab0 baseline_symbols.txt: Update.
* config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt: Update.
	* config/abi/post/i386-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/i486-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/aarch64-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Update.
	* config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt: Update.

From-SVN: r270595
2019-04-26 13:13:04 +02:00
Jonathan Wakely ee2f721c2f PR libstdc++/90239 use uses_allocator_construction_args in <scoped_allocator>
PR libstdc++/90239
	* doc/xml/manual/status_cxx2020.xml: Amend P0591R4 status.
	* include/std/scoped_allocator [__cplusplus > 201703L]
	(scoped_allocator_adaptor::construct): Define in terms of
	uses_allocator_construction_args, as per P0591R4.
	* testsuite/20_util/scoped_allocator/construct_pair_c++2a.cc: New test.
	* testsuite/util/testsuite_allocator.h: Remove name of unused
	parameter.

From-SVN: r270588
2019-04-25 23:43:15 +01:00
Jonathan Wakely 7c3e085e44 Update C++17 library status tables
* doc/xml/manual/status_cxx2017.xml: Document P0024R2 status.
	* doc/html/*: Regenerate.

From-SVN: r270559
2019-04-24 23:16:45 +01:00
Jonathan Wakely f90b16c429 Make filesystem::path comparison operators hidden friends (LWG 3065)
This change revealed two testsuite bugs where some string comparisons
only compiled by converting the strings to filesystem::path objects.

	* include/bits/fs_path.h (operator<, operator<=, operator>)
	(operator>=, operator==, operator!=): Make hidden friends, as per
	LWG 3065.
	* testsuite/27_io/filesystem/path/native/string-char8_t.cc: Fix
	string type in test.
	* testsuite/27_io/filesystem/path/native/string.cc: Likewise.

From-SVN: r270558
2019-04-24 22:35:26 +01:00
Jonathan Wakely 303b226457 Use __and_v<...> instead of __and_<...>::value
* include/std/any (any::any(ValueType&&)): Use __and_v.
	* include/std/numeric (midpoint(T, T, T), midpoint(T*, T*, T*)):
	Likewise.

From-SVN: r270552
2019-04-24 17:25:21 +01:00
Jonathan Wakely 81c7cf71bf Finish implementing "Treating Unnecessary decay" (P0777R1)
* include/std/tuple (apply): Use remove_reference_t instead of decay_t
	as per P0777R1.
	* include/std/type_traits (__result_of_memfun): Use remove_reference
	instead of __remove_cvref_t and remove redundant is_same check.
	(__inv_unwrap): Use __remove_cvref_t instead of decay_t.

From-SVN: r270551
2019-04-24 17:25:17 +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 92750002ef PR libstdc++/90220 Fix std::any_cast for array types
Although the std::any constructors use decay_t to determine the type of
the contained value, std::any_cast should use the un-decayed type (and
so always fail for function and array types that decay to pointers).

Using remove_cv_t is correct, because the condition for std::any_cast
to return non-null is operand.type() == typeid(T) and typeid ignores
top-level cv-qualifiers.

	PR libstdc++/90220
	* include/std/any (__any_caster): Use remove_cv_t instead of decay_t.
	Avoid a runtime check for types that can never be stored in std::any.
	* testsuite/20_util/any/misc/any_cast.cc: Test std::any_cast with
	array types.

From-SVN: r270547
2019-04-24 16:17:43 +01:00
Jonathan Wakely f9bfdfa202 PR libstdc++/90220 Fix std::any_cast for function pointers
PR libstdc++/90220 (partial)
	* include/std/any (any_cast<T>(any*), any_cast<T>(const any*)): Do
	not attempt ill-formed static_cast to pointers to non-object types.
	* testsuite/20_util/any/misc/any_cast.cc: Test std::any_cast with
	function types.

From-SVN: r270538
2019-04-24 10:46:07 +01:00
Jonathan Wakely e0657c24ae Avoid -Wcatch-value warning in testsuite
* testsuite/20_util/variant/run.cc: Catch exception by reference to
	prevent -Wcatch-value warning.

From-SVN: r270527
2019-04-24 00:17:52 +01:00
Jonathan Wakely 9588a07c96 Fix whitespace in ChangeLog
From-SVN: r270526
2019-04-24 00:01:35 +01:00
Jonathan Wakely 86a57ce103 Implement LWG 2904 for std::variant assignment
* include/std/variant (__variant_construct): Use template parameter
	type instead of equivalent decltype-specifier.
	(_Move_ctor_base<false, Types...>::_Move_ctor_base(_Move_ctor_base&&)):
	Replace forward with move.
	(_Move_ctor_base<false, Types...>::_M_destructive_move)
	(_Move_ctor_base<false, Types...>::_M_destructive_copy)
	(_Move_ctor_base<true, Types...>::_M_destructive_move)
	(_Move_ctor_base<true, Types...>::_M_destructive_copy): Only set the
	index after construction succeeds.
	(_Copy_assign_base<false, Types...>::operator=): Remove redundant
	if-constexpr checks that are always true. Use __remove_cvref_t instead
	of remove_reference so that is_nothrow_move_constructible check
	doesn't use a const rvalue parameter. In the potentially-throwing case
	construct a temporary and move assign it, as per LWG 2904.
	(_Move_assign_base<false, Types...>::operator=): Remove redundant
	if-constexpr checks that are always true. Use emplace as per LWG 2904.
	(variant::operator=(T&&)): Only use emplace conditionally, otherwise
	construct a temporary and move assign from it, as per LWG 2904.
	* testsuite/20_util/variant/exception_safety.cc: Check that
	assignment operators have strong exception safety guarantee.

From-SVN: r270525
2019-04-24 00:01:12 +01:00
Thomas Rodgers 1bacd25b0c Document PSTL linker flags
* doc/xml/manual/using.xml: Add PSTL linker flags to table
        3.1.

From-SVN: r270521
2019-04-23 21:03:24 +00:00
Jonathan Wakely 038bc9bfd6 Implement correct std::variant triviality rules from P0602R4
The std::variant move assignment operator should not be trivial if the
variant is not trivially move constructible.

	* include/std/variant (__detail::__variant::_Traits): Make
	_S_trivial_copy_assign depend on _S_trivial_copy_ctor and make
	_S_trivial_move_assign depend on _S_trivial_move_ctor, as per
	P0602R4.
	(__detail::__variant::_Copy_assign_alias): Only depend on
	_S_trivial_copy_assign, which subsumes _S_trivial_copy_ctor now.
	* testsuite/20_util/variant/compile.cc: Correct checks for trivial
	move assignment operators.

From-SVN: r270510
2019-04-23 13:48:28 +01:00
Jonathan Wakely 06715e1cfb PR libstdc++/90165 constrain variant(T&&) constructor
Also refactor some constraints slightly to be more readable.

	PR libstdc++/90165
	* include/std/variant (variant::__not_self): New helper for the
	is_same_v<remove_cvref_t<T>, variant>==false constraints.
	(variant::__to_type_impl): Remove.
	(variant::__to_type): Add default argument to check pack size, instead
	of using __to_type_impl.
	(variant::__accepted_type): Add default argument using __not_self.
	(variant::__is_in_place_tag, variant::__not_in_place_tag): New helpers
	for variant(T&&) constructor constraint.
	(variant::variant(T&&)): Use __not_in_place_tag in constraints.
	Extract __accepted_type into a named template parameter for reuse in
	other constraints and in the exception specification.
	(variant::variant(in_place_type_t<T>, Args&&...))
	(variant::variant(in_place_type_t<T>, initializer_list<U>, Args&&...))
	(variant::variant(in_place_index_t<T>, Args&&...))
	(variant::variant(in_place_index_t<T>, initializer_list<U>, Args&&...))
	(variant::operator=T&&)): Remove redundant && from trait arguments.
	* testsuite/20_util/variant/compile.cc: Check variant(T&&) constructor
	isn't used for in_place_type or in_place_index arguments.

From-SVN: r270509
2019-04-23 13:48:18 +01:00
Jonathan Wakely 82e8c3da74 Corrections for C++2a std::unwrap_reference traits
The P0318R1 paper added to the C++2a draft recently was not the latest
version of the paper, and should have included these changes. These
changes will be made to the working draft via a Defect Report, so I'm
applying them to libstdc++ now.

	* include/std/type_traits (unwrap_reference_t): Define for C++2a.
	(unwrap_ref_decay): Remove inheritance from unwrap_reference.
	* testsuite/20_util/unwrap_reference/1.cc: Adjust test to use alias.

From-SVN: r270506
2019-04-23 11:27:14 +01:00
Ramana Radhakrishnan 48528842bd re PR target/89093 (C++ exception handling clobbers d8 VFP register)
PR target/89093
	* config/arm/arm.c (aapcs_vfp_is_call_or_return_candidate): Diagnose
	if used with general-regs-only.
	(arm_conditional_register_usage): Don't add non-general regs if
	general-regs-only.
	(arm_valid_target_attribute_rec): Handle general-regs-only.
	* config/arm/arm.h (TARGET_HARD_FLOAT): Return false if
	general-regs-only.
	(TARGET_HARD_FLOAT_SUB): Define.
	(TARGET_SOFT_FLOAT): Define as negation of TARGET_HARD_FLOAT_SUB.
	(TARGET_REALLY_IWMMXT): Add && !TARGET_GENERAL_REGS_ONLY.
	(TARGET_REALLY_IWMMXT2): Likewise.
	* config/arm/arm.opt: Add -mgeneral-regs-only.
	* doc/extend.texi: Document ARM general-regs-only target.
	* doc/invoke.texi: Document ARM -mgeneral-regs-only.
libgcc/
	* config/arm/pr-support.c: Add #pragma GCC target("general-regs-only").
	* config/arm/unwind-arm.c: Likewise.
	* unwind-c.c (PERSONALITY_FUNCTION): Add general-regs-only target
	attribute for ARM.
libobjc/
	* exception.c (PERSONALITY_FUNCTION): Add general-regs-only target
	attribute for ARM.
libphobos/
	* libdruntime/gcc/deh.d: Import gcc.attribute.
	(personality_fn_attributes): New enum.
	(scanLSDA, CONTINUE_UNWINDING, gdc_personality, __gdc_personality):
	Add @personality_fn_attributes.
libstdc++-v3/
	* libsupc++/eh_personality.cc (PERSONALITY_FUNCTION): Add
	general-regs-only target attribute for ARM.

Co-Authored-By: Bernd Edlinger <bernd.edlinger@hotmail.de>
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>

From-SVN: r270504
2019-04-23 12:03:41 +02:00
Jonathan Wakely 70265a0c5b Fix whitespace in ChangeLog
From-SVN: r270503
2019-04-23 10:55:36 +01:00
Jonathan Wakely 47a468bdbe Fix std::variant regression caused by never-valueless optimization
A regression was introduced by the recent changes to provide the strong
exception safety guarantee for "never valueless" types that have O(1),
non-throwing move assignment. The problematic code is:

  else if constexpr (__detail::__variant::_Never_valueless_alt<type>())
    {
      // This construction might throw:
      variant __tmp(in_place_index<_Np>, __il,
                    std::forward<_Args>(__args)...);
      // But _Never_valueless_alt<type> means this won't:
      *this = std::move(__tmp);
    }

When the variant is not assignable, the assignment is ill-formed, so
should not be attempted. When the variant has a copy assignment operator
but not a move assignment operator, the assignment performs a copy
assignment and that could throw, so should not be attempted.

The solution is to only take that branch when the variant has a move
assignment operator, which is determined by the _Traits::_S_move_assign
constant. When that is false the strong exception safety guarantee is
not possible, and so the __never_valueless function should also depend
on _S_move_assign.

While testing the fixes for this I noticed that the partial
specialization _Never_valueless_alt<basic_string<C,T,A>> incorrectly
assumed that is_nothrow_move_constructible<basic_string<C,T,A>> is
always true, but that's wrong for fully-dynamic COW strings. Fix the
partial specialization, and improve the comment describing
_Never_valueless_alt to be clear it depends on move construction as well
as move assignment.

Finally, I also observed that _Variant_storage<false, T...>::_M_valid()
was not taking advantage of the __never_valueless<T...>() function to
avoid a runtime check. Only the _Variant_storage<true, T...>::_M_valid()
function was using __never_valueless. That is also fixed.

	PR libstdc++/87431
	* include/bits/basic_string.h (_Never_valueless_alt): Make partial
	specialization also depend on is_nothrow_move_constructible.
	* include/std/variant (__detail::__variant::__never_valueless()):
	Only true if the variant would have a move assignment operator.
	(__detail::__variant::_Variant_storage<false, T...>::_M_valid()):
	Check __never_valueless<T...>().
	(variant::emplace): Only perform non-throwing move assignments
	for never-valueless alternatives if the variant has a move assignment
	operator.
	* testsuite/20_util/variant/compile.cc: Check that never-valueless
	types can be emplaced into non-assignable variants.
	* testsuite/20_util/variant/run.cc: Check that never-valueless types
	don't get copied when emplaced into non-assignable variants.

From-SVN: r270502
2019-04-23 10:55:33 +01:00
Jonathan Wakely be46043e07 Make some std::variant helper functions noexcept
* include/std/variant (__detail::__variant::__ref_cast): Remove
	unused function.
	(__detail::__variant::_Uninitialized::_M_get)
	(__detail::__variant::__get)
	(__gen_vtable_impl::__element_by_index_or_cookie): Add noexcept.

From-SVN: r270501
2019-04-23 10:55:28 +01:00
Iain Sandoe 375eb99a55 libstdc++-v3 Skip tests on Darwin8-10.
These earlier Darwin versions have “FP_≈” inside a
comment in architecture/{ppc,i386}/math.h, which is
included by math.h which causes the tests to fail.

The intent of the tests (i.e. to ensure that the
library itself does not emit non-ascii) is covered
by other platforms, including later Darwin editions.

2019-04-21  Iain Sandoe  <iain@sandoe.co.uk>

	* testsuite/17_intro/headers/c++1998/charset.cc: Skip for Darwin8
	to Darwin10.
	* testsuite/17_intro/headers/c++2011/charset.cc: Likewise.
	* testsuite/17_intro/headers/c++2014/charset.cc: Likewise.
	* testsuite/17_intro/headers/c++2017/charset.cc: Likewise.
	* testsuite/17_intro/headers/c++2020/charset.cc: Likewise.

From-SVN: r270479
2019-04-21 08:14:47 +00:00
Thomas Rodgers 1dc5a184ac Delegate PSTL configuration to pstl/pstl_config.h
* include/bits/c++config: Remove explicit PSTL configuration
	 macros and use definitions from <pstl/pstl_config.h>.

From-SVN: r270472
2019-04-20 23:20:03 +00:00
Thomas Rodgers 9762ea561d Cleanup algorithm implementations
* include/pstl/glue_algorithm_impl.h (stable_sort): Forward
        execution policy.
	(mismatch): Forward execution policy.
	(equal): Qualify call to std::equal().
	(partial_sort): Forward execution policy.
	(inplace_merge): Forward execution policy.

From-SVN: r270471
2019-04-20 22:45:58 +00:00
Thomas Rodgers a34d6343a7 Improve implementation of parallel equal()
* include/pstl/algorithm_impl.h
	(__internal::__brick_equal): use "4 iterator" version of
	std::equal().
	(__internal::__brick_equal): use simd for random access
	iterators on unsequenced execution policies.
	(__internal::__pattern_equal): add "4 iterator" version
	(__internal::__pattern_equal): dispatch to simd __brick_equal
	for vector-only execution policies.
	(__internal::__pattern_equal): dispatch to __parallel_or for
	parallel execution policies.
	* include/pstl/glue_algorithm_impl.h
	(std::equal): dispatch to "4 iterator" version of
	__internal::__pattern_equal().

From-SVN: r270463
2019-04-19 22:44:11 +00:00
Jason Merrill 5a58e967b5 PR c++/90047 - ICE with enable_if alias template.
In order to make alias templates useful for SFINAE we instantiate them under
the prevailing 'complain' argument, so an error encountered while
instantiating during SFINAE context is silent.  The problem in this PR comes
when we later look up the erroneous instantiation and don't give an error at
that point.  Fixed by not adding an erroneous instantiation to the hash
table, so we instantiate it again when needed and get the error.  This
required changes to a number of tests, which previously said "substitution
failed:" with no explanation of what the failure was; now we properly
explain.

	* pt.c (tsubst_decl) [TYPE_DECL]: Don't put an erroneous decl in the
	hash table when we're in SFINAE context.

From-SVN: r270433
2019-04-17 23:32:24 -04:00
Jonathan Wakely 8c7100650e PR libstdc++/90105 make forward_list::sort stable
While testing the fix I also discovered that operator== assumes the
elements are comparable with operator!= which is not required.

	PR libstdc++/90105
	* include/bits/forward_list.h (operator==): Do not use operator!= to
	compare elements.
	(forward_list<T, A>::sort(Comp)): When elements are equal take the one
	earlier in the list, so that sort is stable.
	* testsuite/23_containers/forward_list/operations/90105.cc: New test.
	* testsuite/23_containers/forward_list/comparable.cc: Test with
	types that meet the minimum EqualityComparable and LessThanComparable
	requirements. Remove irrelevant comment.

From-SVN: r270427
2019-04-17 22:47:20 +01:00
Jonathan Wakely 5f00d0d5c2 Fix condition for std::variant to be copy constructible
The standard says the std::variant copy constructor is defined as
deleted unless all alternative types are copy constructible, but we were
making it also depend on move constructible. Fix the condition and
enhance the tests to check the semantics with pathological copy-only
types (i.e. supporting copying but having deleted moves).

The enhanced tests revealed a regression in copy assignment for
non-trivial alternative types, where the assignment would not be
performed because the condition in the _Copy_assign_base visitor is
false: is_same_v<remove_reference_t<T&>, remove_reference_t<const T&>>.

	* include/std/variant (__detail::__variant::_Traits::_S_copy_assign):
	Do not depend on whether all alternative types are move constructible.
	(__detail::__variant::_Copy_assign_base::operator=): Remove cv-quals
	from the operand when deciding whether to perform the assignment.
	* testsuite/20_util/variant/compile.cc (DeletedMoves): Define type
	with deleted move constructor and deleted move assignment operator.
	(default_ctor, copy_ctor, move_ctor, copy_assign, move_assign): Check
	behaviour of variants with DeletedMoves as an alternative.
	* testsuite/20_util/variant/run.cc (DeletedMoves): Define same type.
	(move_ctor, move_assign): Check that moving a variant with a
	DeletedMoves alternative falls back to copying instead of moving.

From-SVN: r270425
2019-04-17 20:27:27 +01:00
Jonathan Wakely 990666d05a Remove unnecessary string literals from static_assert in C++17 tests
The string literal is optional in C++17 and all these are empty so add
no value.

	* testsuite/20_util/variant/compile.cc: Remove empty string literals
	from static_assert declarations.

From-SVN: r270424
2019-04-17 20:27:23 +01:00
Jonathan Wakely 9d3e662d29 Fix tests for std::variant to match original intention
* testsuite/20_util/variant/compile.cc (MoveCtorOnly): Fix type to
	actually match its name.
	(MoveCtorAndSwapOnly): Define new type that adds swap to MoveCtorOnly.
	(test_swap()): Fix result for MoveCtorOnly and check
	MoveCtorAndSwapOnly.

From-SVN: r270423
2019-04-17 20:27:19 +01:00
Jonathan Wakely 02c9b9ccff Add constexpr to std::optional::value_or(U&&)&&
In C++1z drafts up to N4606 the constexpr keyword was missing from the
detailed description of this function, despite being shown in the class
synopsis.  That was fixed editorially for N4618, but our implementation
was not corrected to match.

	* include/std/optional (optional::value_or(U&&) &&): Add missing
	constexpr specifier.
	* testsuite/20_util/optional/constexpr/observers/4.cc: Check value_or
	for disengaged optionals and rvalue optionals.
	* testsuite/20_util/optional/observers/4.cc: Likewise.

From-SVN: r270409
2019-04-17 14:13:30 +01:00
Thomas Rodgers 71905b8a44 Uglify identifiers missed in previous commit(s)
* include/pstl/algorithm_impl.h: Uglify identfiers.
       * include/pstl/numeric_impl.h:  Uglify identfiers.
       * include/pstl/parallel_backend_tbb.h: Uglify identfiers.

From-SVN: r270332
2019-04-13 00:13:46 +00:00
Jonathan Wakely ab54102445 Remove spurious empty line from ChangeLog
From-SVN: r270307
2019-04-12 09:04:56 +01:00
Thomas Rodgers 9eda9f9231 Replace direct PSTL uses of assert() with a macro
This also replaces calls to __TBB_ASSERT so that there are two macro
definitions provided by c++config -
	    __PSTL_ASSERT(_Condition)
	    __PSTL_ASSERT_MSG(_Condition, _Message)

	    * include/bits/c++config:
	    Add definition for __PSTL_ASSERT.
	    Add definition for __PSTL_ASSERT_MSG.
	    * include/pstl/algorithm_impl.h: Replace use of assert().
	    * include/pstl/numeric_impl.h: Replace use of assert().
	    * include/pstl/parallel_backend_tbb.h:
	    Replace use of assert().
	    Replace use of __TBB_ASSERT().

	    * include/pstl/parallel_backend_utils.h: Replace use of assert().

From-SVN: r270293
2019-04-11 20:40:40 +00:00
Jonathan Wakely 2c390a483b PR libstdc++/90046 fix build failure on epiphany-elf
The epiphany-elf target aligns structs to 8 bytes, which causes the
static_assert(alignof(_Chunk) == 1) to fail.

Instead of requiring _Chunks to be positionable at any alignment, ensure
new buffers are aligned to alignof(_Chunk). Because the buffer size is a
power of two, we know that both the buffer size and sizeof(_Chunk) are
multiples of alignof(_Chunk). So is p is aligned to alignof(_Chunk) then
so is (p + size - sizeof(_Chunk)). So just ensure the new buffer is
aligned to at least alignof(_Chunk), which should already be true
because the caller requests at least alignof(max_align_t).

	PR libstdc++/90046
	* src/c++17/memory_resource.cc
	(monotonic_buffer_resource::_Chunk::allocate): Increase alignment if
	needed to allow placing a _Chunk at the end of the buffer.
	(monotonic_buffer_resource::_M_new_buffer): Remove static_assert.

From-SVN: r270291
2019-04-11 20:58:14 +01:00
Jonathan Wakely 51d3c11a7c Update documentation regarding bogus memory leaks in libstdc++
* doc/xml/faq.xml: Add information about emergency EH pool.
	* doc/xml/manual/debug.xml: Update list of memory debugging tools.
	Move outdated information on mt_allocator to a separate section.
	* doc/xml/manual/evolution.xml: Clarify that GLIBCXX_FORCE_NEW
	doesn't affect the default allocator.

From-SVN: r270264
2019-04-10 20:24:04 +01:00
Jonathan Wakely 9cadd6bd4d Fix typo in effective-target check
* testsuite/lib/libstdc++.exp (check_v3_target_parallel_mode): Fix
	typo.

From-SVN: r270259
2019-04-10 15:46:03 +01:00
Jonathan Wakely 4a3f7992d2 PR libstdc++/89851 Add testcase for std::variant equality
Add a test for the regression introduced with r269422 and fixed with
r270056.

	PR libstdc++/89851
	* testsuite/20_util/variant/89851.cc: New test.

From-SVN: r270249
2019-04-10 11:43:39 +01:00
Jonathan Wakely 9d89b73c06 Add comments and style fixes to <variant>
* include/std/variant: Adjust whitespace. Add comments.
	(_Multi_array): Leave primary template undefined.
	(_Multi_array<_Tp>): Define partial specialization for base case of
	recursion.
	(__gen_vtable_impl, __gen_vtable): Remove redundant && from type
	which is always a reference.
	(__gen_vtable::_S_apply()): Remove function, inline body into
	default member initializer.
	* testsuite/20_util/variant/visit.cc: Test with noncopyable types.

From-SVN: r270238
2019-04-09 19:50:48 +01:00
Jonathan Wakely 8701cb5e0d Fix std::visit to support arbitrary callables
The __visitor_result_type helper didn't use std::invoke and so didn't
compile when the visitor was a pointer-to-member rather than a function
object. Use std::invoke_result instead.

	* include/std/variant (__variant_idx_cookie): Add member type.
	(__visitor_result_type): Remove.
	(__do_visit): Use invoke_result instead of __visitor_result_type.
	* testsuite/20_util/variant/visit.cc: New test.

From-SVN: r270237
2019-04-09 19:50:43 +01:00
Jonathan Wakely bc203bf0da PR libstdc++/90008 remove unused capture from variant rel ops
PR libstdc++/90008
	* include/std/variant (_VARIANT_RELATION_FUNCTION_TEMPLATE): Remove
	unused capture.
	* testsuite/20_util/variant/90008.cc: New test.

From-SVN: r270236
2019-04-09 19:50:39 +01:00
Thomas Rodgers 0360f9ad40 Add PSTL internal namespace qualifications
* include/pstl/algorithm_impl.h: Add namespace qualification.
	* include/pstl/execution_defs.h: Add namespace qualification.
	* include/pstl/execution_impl.h: Add namespace qualification.
	* include/pstl/numeric_impl.h: Add namespace qualification.
	* include/pstl/parallel_backend_tbb.h: Add namespace qualification.
	* include/pstl/unseq_backend_simd.h: Add namespace qualification.
	* include/pstl/parallel_backend_utils.h: Include <cassert>.

From-SVN: r270231
2019-04-09 15:45:26 +00:00
Ville Voutilainen 3d01c7c2f2 Fix visit<R> for variant.
* include/std/variant (__do_visit): Add a template parameter
for enforcing same return types for visit.
(__gen_vtable_impl): Likewise.
(_S_apply_single_alt): Adjust.
(__visit_invoke_impl): New. Handle casting to void.
(__do_visit_invoke): New. Enforces same return types.
(__do_visit_invoke_r): New. Converts return types.
(__visit_invoke): Adjust.
(__gen_vtable):  Add a template parameter for enforcing
same return types for visit.
* testsuite/20_util/variant/visit_r.cc: Add a test for a visitor with
different return types.
* testsuite/20_util/variant/visit_neg.cc: New. Ensures that
visitors with different return types don't accidentally
compile with regular visitation.

From-SVN: r270216
2019-04-08 22:45:48 +03:00
Christophe Lyon 66d8ee9ce0 [testsuite,libstdc++-v3] Fix 27_io/filesystem/iterators/caching.cc
2019-04-08  Christophe Lyon  <christophe.lyon@linaro.org>

	* testsuite/27_io/filesystem/iterators/caching.cc: Add
	dg-require-filesystem-ts.

From-SVN: r270199
2019-04-08 09:17:30 +02:00
Jonathan Wakely 199b20e3cb Implement std::visit<R> for C++2a (P0655R1)
* doc/xml/manual/status_cxx2020.xml: Update status.
	* include/std/variant (visit<R>): Define for C++2a (P0655R1).
	* testsuite/20_util/variant/visit_r.cc: New test.

From-SVN: r270176
2019-04-05 19:06:02 +01:00
Jonathan Wakely dd4a309e05 Use hidden friends for directory iterator comparisons
The equality operators for directory iterators are not explicitly
specified in the standard, they're only required to meet the iterator
requirements. This means we don't need to declare them at namespace
scope and can implement them as hidden friends.

Also add 'noexcept' to directory_iterator's dereference operators.

	* include/bits/fs_dir.h (directory_iterator::operator*)
	(directory_iterator::operator->): Add noexcept.
	(operator==, operator!=): Replace namespace-scope equality operators
	for directory iterators with hidden friends.

From-SVN: r270175
2019-04-05 17:56:31 +01:00
Jonathan Wakely 67087c7e53 PR libstdc++/89986 export directory_iterator::increment
PR libstdc++/89986
	* config/abi/pre/gnu.ver: Add missing exports.
	* testsuite/27_io/filesystem/iterators/directory_iterator.cc: Test
	increment member.

From-SVN: r270174
2019-04-05 17:56:27 +01:00
Jonathan Wakely c7dde4a90a Share all recursive_directory_iterator state [LWG 2708]
Implement the proposed resolution of LWG 2708 by moving the _M_options
and _M_pending members out of the recursive_directory_iterator into the
shared _Dir_stack object. Because _Dir_stack is an opaque type, the
member functions that access the _M_options and _M_pending variables
cannot be inline. Move them into the library.

As a drive-by fix, add noexcept to the non-throwing member functions of
recursive_directory_iterator.

	* config/abi/pre/gnu.ver: Export new symbols.
	* include/bits/fs_dir.h (recursive_directory_iterator::options())
	(recursive_directory_iterator::recursion_pending())
	(recursive_directory_iterator::disable_recursion_pending()): Remove
	inline definitions. Make noexcept.
	(recursive_directory_iterator::depth())
	(recursive_directory_iterator::operator*())
	(recursive_directory_iterator::operator->()): Make noexcept.
	(recursive_directory_iterator::_M_options)
	(recursive_directory_iterator::_M_pending): Remove data members.
	* src/c++17/fs_path.cc (_Dir_stack): Add constructor and data members.
	(recursive_directory_iterator::recursive_directory_iterator): Remove
	ctor-initializer. Use new constructor for _Dir_stack.
	(recursive_directory_iterator::options())
	(recursive_directory_iterator::recursion_pending())
	(recursive_directory_iterator::disable_recursion_pending()): Add
	non-inline definitions.
	(recursive_directory_iterator::depth()): Make noexcept.
	(recursive_directory_iterator::increment(error_code&))
	(recursive_directory_iterator::pop(error_code&)): Adjust to new
	location of options and recursion_pending members.
	* testsuite/27_io/filesystem/iterators/recursion_pending.cc: New test.
	* testsuite/util/testsuite_fs.h (__gnu_test::scoped_file): Add
	user-declared move constructor and assignment operator, to make the
	type move-only.

From-SVN: r270173
2019-04-05 17:56:23 +01:00
Jonathan Wakely 5ed5c0da8b Fix directory_iterator handling of DT_UNKNOWN
We need to handle DT_UNKNOWN earlier, not only during directory
recursion, so that the cached file_type value in the directory_entry
won't be used.

	* src/c++17/fs_dir.cc (_Dir::advance(bool, error_code&)): Handle
	d_type == DT_UNKNOWN immediately.
	(_Dir::should_recurse(bool, error_code&)): Remove file_type::unknown
	handling here.
	* testsuite/27_io/filesystem/iterators/caching.cc: New test.

From-SVN: r270172
2019-04-05 17:56:18 +01:00
Jonathan Wakely d96f11a272 Make filesystem::path safe for self assignment
The standard says "If *this and p are the same object, has no effect."
Previously we ended up clearing the path.

	* include/bits/fs_path.h (path::operator=(path&&)): Check for self
	assignment.
	* src/c++17/fs_path.cc (path::operator=(const path&)): Likewise.
	* testsuite/27_io/filesystem/path/assign/copy.cc: Test self
	assignment.

From-SVN: r270171
2019-04-05 17:56:14 +01:00
Jonathan Wakely 10f26de915 PR libstdc++/87431 re-adjust never-valueless optimizations
Avoid creating arbitrarily large objects on the stack when emplacing
trivially copyable objects into a variant. Currently we provide the
strong exception-safety guarantee for all trivially copyable types, by
constructing a second variant and then doing a non-throwing move
assignment from the temporary. This patch restricts that behaviour to
trivially copyable types that are no larger than 256 bytes. For larger
types the object will be emplaced directly into the variant, and if its
initialization throws then the variant becomes valueless.

Also implement Antony Polukhin's suggestion to whitelist specific types
that are not trivially copyable but can be efficiently move-assigned.
Emplacing those types will never cause a variant to become valueless.
The whitelisted types are: std::shared_ptr, std::weak_ptr,
std::unique_ptr, std::function, and std::any. Additionally,
std::basic_string, std::vector, and __gnu_debug::vector are whitelisted
if their allocator traits give them a non-throwing move assignment
operator. Specifically, this means std::string is whitelisted, but
std::pmr::string is not.

As part of this patch, additional if-constexpr branches are added for
the cases where the initialization is known to be non-throwing (so the
overhead of the try-catch block can be avoided) and where a scalar is
being produced by a potentially-throwing conversion operator (so that
the overhead of constructing and move-assigning a variant is avoided).
These changes should have no semantic effect, just better codegen.

	PR libstdc++/87431 (again)
	* include/bits/basic_string.h (__variant::_Never_valueless_alt):
	Define partial specialization for basic_string.
	* include/bits/shared_ptr.h (_Never_valueless_alt): Likewise for
	shared_ptr and weak_ptr.
	* include/bits/std_function.h (_Never_valueless_alt): Likewise for
	function.
	* include/bits/stl_vector.h (_Never_valueless_alt): Likewise for
	vector.
	* include/bits/unique_ptr.h (_Never_valueless_alt): Likewise for
	unique_ptr.
	* include/debug/vector (_Never_valueless_alt): Likewise for debug
	vector.
	* include/std/any (_Never_valueless_alt): Define explicit
	specialization for any.
	* include/std/variant (_Never_valueless_alt): Define primary template.
	(__never_valueless): Use _Never_valueless_alt instead of
	is_trivially_copyable.
	(variant::emplace<N>(Args&&...)): Add special case for non-throwing
	initializations to avoid try-catch overhead. Add special case for
	scalars produced by potentially-throwing conversions. Use
	_Never_valueless_alt instead of is_trivially_copyable for the
	remaining strong exception-safety cases.
	(variant::emplace<N>(initializer_list<U>, Args&&...)): Likewise.
	* testsuite/20_util/variant/87431.cc: Run both test functions.
	* testsuite/20_util/variant/exception_safety.cc: New test.
	* testsuite/20_util/variant/run.cc: Use pmr::string instead of string,
	so the variant becomes valueless.

From-SVN: r270170
2019-04-05 17:56:09 +01:00
Jonathan Wakely 487efcfdac Fix previous ChangeLog entry
From-SVN: r270121
2019-04-03 11:11:30 +01:00
Jonathan Wakely 59e36c85e7 PR libstdc++/85184 remove debug assertions from std::variant
The __glibcxx_assert macro should be used to check preconditions that
users must meet, not to check postconditions that the implementation
must meet. We have tests to verify std::variant meets its
postconditions, users shouldn't pay for those checks at runtime.

	PR libstdc++/85184
	* include/std/variant (_Copy_assign_base, _Move_assign_base, variant):
	Remove assertions.
	(variant::emplace<_Tp>): Remove result of emplace<N> directly.

From-SVN: r270117
2019-04-03 10:47:51 +01:00
Jonathan Wakely 0cb78ef4bc Define std::hash specializations for C++17 PMR strings
These hash specializations should have been added when the pmr::string
and related typedefs were added.

	* include/std/string (__hash_string_base): New class template defining
	operator() for hashing strings.
	(hash<pmr::string>, hash<pmr::u8string>, hash<pmr::u16string>)
	(hash<pmr::u32string>, hash<pmr::wstring>): Define for C++17.
	* testsuite/21_strings/basic_string/hash/hash.cc: New test.
	* testsuite/21_strings/basic_string/hash/hash_char8_t.cc: New test.

From-SVN: r270116
2019-04-03 10:47:47 +01:00
Ville Voutilainen f1ba6c5a51 Use single-visitation in variant assignment and swap and relops.
Also use indices instead of types when checking whether
variants hold the same thing.
* include/std/variant (__do_visit): Add a template parameter
for index visitation, invoke with indices if index visitation
is used.
(__variant_idx_cookie): New.
(__visit_with_index): Likewise.
(_Copy_assign_base::operator=): Do single-visitation with
an index visitor.
(_Move_assign_base::operator=): Likewise.
(_Extra_visit_slot_needed): Adjust.
(__visit_invoke): Call with indices if it's an index visitor.
(relops): Do single-visitation with an index visitor.
(swap): Likewise.
(__visitor_result_type): New.

From-SVN: r270056
2019-04-01 16:57:41 +03:00
Eric Botcazou 29b129b855 * src/c++17/fs_ops.cc (fs::permissions): Use std::errc::not_supported.
From-SVN: r270033
2019-03-30 13:36:16 +00:00
Ville Voutilainen 337d1fec36 Don't revisit a variant we are already visiting.
* include/std/variant (__variant_construct_single): New.
(__variant_construct): Use it.
(_M_destructive_move): Likewise.
(_M_destructive_copy): Likewise.
(_Copy_assign_base::operator=): Adjust.
(_Move_assign_base::operator=): Likewise.
(swap): Likewise.

From-SVN: r269996
2019-03-28 18:18:49 +02:00
Jonathan Wakely 7ac205673c PR libstdc++/85965 delay static assertions until types are complete
The static assertions added for PR libstdc++/48101 were at class scope
and so were evaluated too eagerly, when it might not be possible to
determine whether the function objects are invocable with the key types.
The problematic cases are where the key type is not known to be
convertible to the argument type(s) of the function object until later,
after a type has been completed. Specifically, if the key type is a
pointer to a derived class and the function object's argument type is a
pointer to a base class, then the derived-to-base conversion is only
valid once the derived type is complete.

By moving the static assertions to the destructor they will only be
evaluated when the destructor is instantiated, at which point whether
the key type can be passed to the function object should be knowable.
The ideal place to do the checks would be only when the function objects
are actually invoked, but that would mean adding the checks in numerous
places, so the destructor is used instead.

The tests need to be adjusted because the "required from here" line is
now the location of the destructor, not the point of instantiation in
the test file. For the map and multimap tests which check two
specializations, the dg-error matching the assertion text matches both
cases. Also check the diagnostic output for the template arguments, to
ensure both specializations trigger the assertion.

	PR libstdc++/85965
	* include/bits/hashtable.h (_Hashtable): Move static assertions to
	destructor so they are not evaluated until the _Key type is complete.
	* include/bits/stl_tree.h (_Rb_tree): Likewise.
	* testsuite/23_containers/set/85965.cc: New test.
	* testsuite/23_containers/unordered_set/85965.cc: New test.
	* testsuite/23_containers/map/48101_neg.cc: Replace "here" errors
	with regexp matching the corresponding _Rb_tree specialization.
	* testsuite/23_containers/multimap/48101_neg.cc: Likewise.
	* testsuite/23_containers/multiset/48101_neg.cc: Remove "here" error.
	* testsuite/23_containers/set/48101_neg.cc: Likewise.
	* testsuite/23_containers/unordered_map/48101_neg.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/48101_neg.cc: Likewise.
	* testsuite/23_containers/unordered_multiset/48101_neg.cc: Likewise.
	* testsuite/23_containers/unordered_set/48101_neg.cc: Likewise.

From-SVN: r269949
2019-03-26 15:28:48 +00:00
Ville Voutilainen da97b98ad3 re PR libstdc++/89825 (Jump table for variant visitation could be shortened for never empty variants)
PR libstdc++/89825

Fix based on a suggestion by Antony Polukhin.
* include/std/variant (_Extra_visit_slot_needed): New.
(_Multi_array): Use it.
(_S_apply_all_alts): Likewise.

From-SVN: r269947
2019-03-26 17:00:05 +02:00
Ville Voutilainen 11767f80f0 re PR libstdc++/89824 (Variant jump table reserves space for __variant_cookie twice)
PR libstdc++/89824

Fix based on a suggestion by Antony Polukhin.
* include/std/variant (__gen_vtable): Don't reserve an
additional table slot, _Multi_array already does that.

From-SVN: r269941
2019-03-26 14:41:59 +02:00
Ville Voutilainen 8be4d02ba9 re PR libstdc++/89816 (std::variant move construction regressed since GCC 8.3)
PR libstdc++/89816

Fix based on a suggestion by Antony Polukhin.
* include/std/variant (__variant_construct): Capture a pointer
to the storage and visit just one variant.

From-SVN: r269940
2019-03-26 14:07:26 +02:00
Jonathan Wakely fb5550a068 Remove broken links from libstdc++ manual to Doxygen pages
The Doxygen docs do not have stable URLs, so linking to specific pages
doesn't work well.

	* doc/xml/manual/backwards_compatibility.xml: Remove link to
	Doxygen-generated pages with unstable URL.
	* doc/xml/manual/concurrency_extensions.xml: Likewise.
	* doc/xml/manual/extensions.xml: Likewise.
	* doc/xml/manual/parallel_mode.xml: Likewise.
	* doc/xml/manual/support.xml: Likewise.

From-SVN: r269881
2019-03-22 20:57:35 +00:00
Jonathan Wakely eca5f9254b Avoid -Wconversion warnings when -Wsystem-headers is used
* include/bits/stl_algobase.h (__lg): Do arithmetic on type int to
	avoid -Wconversion warnings.

From-SVN: r269876
2019-03-22 16:45:48 +00:00
Thomas Rodgers 061f457868 Integrate C++17 parallel algorithms
This is the Intel implementation of the C++17 parallel
algorithms, which has been donated to both GCC and LLVM. The upstream
project is at -

	https://reviews.llvm.org/source/pstl/

The new files in the include/pstl sub-directory are covered by the
LICENSE.txt in that sub-directory, as are the tests in
testsuite/**/pstl/*

	* include/Makefile.am (std_header): Add ${std_srcdir}/execution.
	(pstl_srcdir, pstl_builddir, pstl_headers): New variables.
	(allstamped): Add stamp-pstl.
	(install-headers): Add ptsl_builddir.
	* include/Makefile.in: Regenerate.
	* include/bits/c++config: Add pstl configuration.
	* include/pstl/LICENSE.txt: New file.
	* include/pstl/algorithm_fwd.h: New file.
	* include/pstl/algorithm_impl.h: New file.
	* include/pstl/execution_defs.h: New file.
	* include/pstl/execution_impl.h: New file.
	* include/pstl/glue_algorithm_defs.h: New file.
	* include/pstl/glue_algorithm_impl.h: New file.
	* include/pstl/glue_execution_defs.h: New file.
	* include/pstl/glue_memory_defs.h: New file.
	* include/pstl/glue_memory_impl.h: New file.
	* include/pstl/glue_numeric_defs.h: New file.
	* include/pstl/glue_numeric_impl.h: New file.
	* include/pstl/memory_impl.h: New file.
	* include/pstl/numeric_fwd.h: New file.
	* include/pstl/numeric_impl.h: New file.
	* include/pstl/parallel_backend.h: New file.
	* include/pstl/parallel_backend_tbb.h: New file.
	* include/pstl/parallel_backend_utils.h: New file.
	* include/pstl/parallel_impl.h: New file.
	* include/pstl/pstl_config.h: New file.
	* include/pstl/unseq_backend_simd.h: New file.
	* include/pstl/utils.h: New file.
	* include/std/algorithm: Include parallel algorithm implementations.
	* include/std/execution: New file.
	* include/std/memory: Include parallel algorithm implementations.
	* include/std/numeric: Include parallel algorithm implementations.
	* include/std/version: Add parallel algorithms feature test macro.
	* testsuite/util/pstl/pstl_test_config.h: New file.
	* testsuite/util/pstl/test_utils.h: New file.
	* testsuite/20_util/specialized_algorithms/pstl/uninitialized_construct.cc: New file.
	* testsuite/20_util/specialized_algorithms/pstl/uninitialized_copy_move.cc: New file.
	* testsuite/20_util/specialized_algorithms/pstl/uninitialized_fill_destroy.cc: New file.
	* testsuite/25_algorithms/pstl/alg_merge/inplace_merge.cc: New file.
	* testsuite/25_algorithms/pstl/alg_merge/merge.cc: New file.
	* testsuite/25_algorithms/pstl/alg_modifying_operations/copy_if.cc: New file.
	* testsuite/25_algorithms/pstl/alg_modifying_operations/copy_move.cc: New file.
	* testsuite/25_algorithms/pstl/alg_modifying_operations/fill.cc: New file.
	* testsuite/25_algorithms/pstl/alg_modifying_operations/generate.cc: New file.
	* testsuite/25_algorithms/pstl/alg_modifying_operations/is_partitioned.cc: New file.
	* testsuite/25_algorithms/pstl/alg_modifying_operations/partition.cc: New file.
	* testsuite/25_algorithms/pstl/alg_modifying_operations/partition_copy.cc: New file.
	* testsuite/25_algorithms/pstl/alg_modifying_operations/remove.cc: New file.
	* testsuite/25_algorithms/pstl/alg_modifying_operations/remove_copy.cc: New file.
	* testsuite/25_algorithms/pstl/alg_modifying_operations/replace.cc: New file.
	* testsuite/25_algorithms/pstl/alg_modifying_operations/replace_copy.cc: New file.
	* testsuite/25_algorithms/pstl/alg_modifying_operations/rotate.cc: New file.
	* testsuite/25_algorithms/pstl/alg_modifying_operations/rotate_copy.cc: New file.
	* testsuite/25_algorithms/pstl/alg_modifying_operations/swap_ranges.cc: New file.
	* testsuite/25_algorithms/pstl/alg_modifying_operations/transform_binary.cc: New file.
	* testsuite/25_algorithms/pstl/alg_modifying_operations/transform_unary.cc: New file.
	* testsuite/25_algorithms/pstl/alg_modifying_operations/unique.cc: New file.
	* testsuite/25_algorithms/pstl/alg_modifying_operations/unique_copy_equal.cc: New file.
	* testsuite/25_algorithms/pstl/alg_nonmodifying/adjacent_find.cc: New file.
	* testsuite/25_algorithms/pstl/alg_nonmodifying/all_of.cc: New file.
	* testsuite/25_algorithms/pstl/alg_nonmodifying/any_of.cc: New file.
	* testsuite/25_algorithms/pstl/alg_nonmodifying/count.cc: New file.
	* testsuite/25_algorithms/pstl/alg_nonmodifying/equal.cc: New file.
	* testsuite/25_algorithms/pstl/alg_nonmodifying/find.cc: New file.
	* testsuite/25_algorithms/pstl/alg_nonmodifying/find_end.cc: New file.
	* testsuite/25_algorithms/pstl/alg_nonmodifying/find_first_of.cc: New file.
	* testsuite/25_algorithms/pstl/alg_nonmodifying/find_if.cc: New file.
	* testsuite/25_algorithms/pstl/alg_nonmodifying/for_each.cc: New file.
	* testsuite/25_algorithms/pstl/alg_nonmodifying/mismatch.cc: New file.
	* testsuite/25_algorithms/pstl/alg_nonmodifying/none_of.cc: New file.
	* testsuite/25_algorithms/pstl/alg_nonmodifying/nth_element.cc: New file.
	* testsuite/25_algorithms/pstl/alg_nonmodifying/reverse.cc: New file.
	* testsuite/25_algorithms/pstl/alg_nonmodifying/reverse_copy.cc: New file.
	* testsuite/25_algorithms/pstl/alg_nonmodifying/search_n.cc: New file.
	* testsuite/25_algorithms/pstl/alg_sorting/includes.cc: New file.
	* testsuite/25_algorithms/pstl/alg_sorting/is_heap.cc: New file.
	* testsuite/25_algorithms/pstl/alg_sorting/is_sorted.cc: New file.
	* testsuite/25_algorithms/pstl/alg_sorting/lexicographical_compare.cc: New file.
	* testsuite/25_algorithms/pstl/alg_sorting/minmax_element.cc: New file.
	* testsuite/25_algorithms/pstl/alg_sorting/partial_sort.cc: New file.
	* testsuite/25_algorithms/pstl/alg_sorting/partial_sort_copy.cc: New file.
	* testsuite/25_algorithms/pstl/alg_sorting/set.cc: New file.
	* testsuite/25_algorithms/pstl/alg_sorting/sort.cc: New file.
	* testsuite/26_numerics/pstl/numeric_ops/adjacent_difference.cc: New file.
	* testsuite/26_numerics/pstl/numeric_ops/reduce.cc: New file.
	* testsuite/26_numerics/pstl/numeric_ops/scan.cc: New file.
	* testsuite/26_numerics/pstl/numeric_ops/transform_reduce.cc: New file.
	* testsuite/26_numerics/pstl/numeric_ops/transform_scan.cc: New file.
	* testsuite/testsuite/20_util/specialized_algorithms/pstl/uninitialized_construct.cc: New file.
	* testsuite/testsuite/20_util/specialized_algorithms/pstl/uninitialized_copy_move.cc: New file.
	* testsuite/testsuite/20_util/specialized_algorithms/pstl/uninitialized_fill_destroy.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_merge/inplace_merge.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_merge/merge.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_modifying_operations/copy_if.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_modifying_operations/copy_move.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_modifying_operations/fill.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_modifying_operations/generate.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_modifying_operations/is_partitioned.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_modifying_operations/partition.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_modifying_operations/partition_copy.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_modifying_operations/remove.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_modifying_operations/remove_copy.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_modifying_operations/replace.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_modifying_operations/replace_copy.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_modifying_operations/rotate.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_modifying_operations/rotate_copy.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_modifying_operations/swap_ranges.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_modifying_operations/transform_binary.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_modifying_operations/transform_unary.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_modifying_operations/unique.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_modifying_operations/unique_copy_equal.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_nonmodifying/adjacent_find.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_nonmodifying/all_of.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_nonmodifying/any_of.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_nonmodifying/count.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_nonmodifying/equal.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_nonmodifying/find.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_nonmodifying/find_end.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_nonmodifying/find_first_of.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_nonmodifying/find_if.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_nonmodifying/for_each.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_nonmodifying/mismatch.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_nonmodifying/none_of.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_nonmodifying/nth_element.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_nonmodifying/reverse.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_nonmodifying/reverse_copy.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_nonmodifying/search_n.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_sorting/includes.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_sorting/is_heap.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_sorting/is_sorted.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_sorting/lexicographical_compare.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_sorting/minmax_element.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_sorting/partial_sort.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_sorting/partial_sort_copy.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_sorting/set.cc: New file.
	* testsuite/testsuite/25_algorithms/pstl/alg_sorting/sort.cc: New file.
	* testsuite/testsuite/26_numerics/pstl/numeric_ops/adjacent_difference.cc: New file.
	* testsuite/testsuite/26_numerics/pstl/numeric_ops/reduce.cc: New file.
	* testsuite/testsuite/26_numerics/pstl/numeric_ops/scan.cc: New file.
	* testsuite/testsuite/26_numerics/pstl/numeric_ops/transform_reduce.cc: New file.
	* testsuite/testsuite/26_numerics/pstl/numeric_ops/transform_scan.cc: New file.

From-SVN: r269863
2019-03-21 23:48:49 +00:00
Jonathan Wakely e2186cd88e In C++17 <math.h> should not put special functions in global namespace
IS 29124 8.2 [sf.mathh] says that <math.h> should add the names of the
special functions to the global namespace.  However, C++17 Annex D
[depr.c.headers] excludes those functions explicitly, so they should not
be placed in the global namespace unconditionally for C++17.

Only add them to the global namespace when IS 29124 is explicitly
requested via the __STDCPP_WANT_MATH_SPEC_FUNCS__ macro.

	* include/c_compatibility/math.h [!__STDCPP_WANT_MATH_SPEC_FUNCS__]
	(assoc_laguerre, assoc_laguerref, assoc_laguerrel, assoc_legendre)
	(assoc_legendref, assoc_legendrel, beta, betaf, betal, comp_ellint_1)
	(comp_ellint_1f, comp_ellint_1l, comp_ellint_2, comp_ellint_2f)
	(comp_ellint_2l, comp_ellint_3, comp_ellint_3f, comp_ellint_3l)
	(cyl_bessel_i, cyl_bessel_if, cyl_bessel_il, cyl_bessel_j)
	(cyl_bessel_jf, cyl_bessel_jl, cyl_bessel_k, cyl_bessel_kf)
	(cyl_bessel_kl, cyl_neumann, cyl_neumannf, cyl_neumannl, ellint_1)
	(ellint_1f, ellint_1l, ellint_2, ellint_2f, ellint_2l, ellint_3)
	(ellint_3f, ellint_3l, expint, expintf, expintl, hermite, hermitef)
	(hermitel, laguerre, laguerref, laguerrel, legendre, legendref)
	(legendrel, riemann_zeta, riemann_zetaf, riemann_zetal, sph_bessel)
	(sph_besself, sph_bessell, sph_legendre, sph_legendref, sph_legendrel)
	(sph_neumann, sph_neumannf, sph_neumannl): Only add using-declarations
	when the special functions IS is enabled, not for C++17.
	* testsuite/26_numerics/headers/cmath/functions_global_c++17.cc:
	Replace with ...
	* testsuite/26_numerics/headers/cmath/functions_global.cc: New test,
	without checks for special functions in C++17.
	* testsuite/26_numerics/headers/cmath/special_functions_global.cc:
	New test.

From-SVN: r269837
2019-03-21 14:03:56 +00:00
Jonathan Wakely 42d9f14bab PR libstdc++/88066 Use <> for includes not ""
These headers were missed in the previous commit for this bug.

There are also several "" includes in the profile mode headers, but
because they're deprecated I'm not fixing them.

	* include/backward/hash_map: Use <> for includes not "".
	* include/backward/hash_set: Likewise.
	* include/backward/strstream: Likewise.
	* include/tr1/bessel_function.tcc: Likewise.
	* include/tr1/exp_integral.tcc: Likewise.
	* include/tr1/legendre_function.tcc: Likewise.
	* include/tr1/modified_bessel_func.tcc: Likewise.
	* include/tr1/riemann_zeta.tcc: Likewise.

From-SVN: r269835
2019-03-21 12:07:10 +00:00
Jonathan Wakely cad3fc8c59 Update libstdc++ API Evolution documentation
* doc/xml/manual/allocator.xml: Link to table documenting evolution
	of extension allocators.
	* doc/xml/manual/evolution.xml: Use angle brackets for header names.
	Document new headers in 7.2, 8.1 and 9.1 releases.
	* doc/xml/manual/using.xml: Adjust link target for new_allocator.
	* doc/html/*: Regenerate.

From-SVN: r269794
2019-03-19 09:38:41 +00:00
John David Anglin 2ff656f421 re PR libstdc++/89461 (FAIL: experimental/net/timer/waitable/cons.cc)
PR libstdc++/89461
	* testsuite/lib/libstdc++.exp: Locate libatomic.
	* testsuite/lib/dg-options.exp (add_options_for_libatomic): New.
	* testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc: Add
	libatomic options.
	* testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc: Likewise.
	* testsuite/experimental/net/timer/waitable/cons.cc: Likewise.
	* testsuite/experimental/net/timer/waitable/dest.cc: Likewise.
	* testsuite/experimental/net/timer/waitable/ops.cc: Likewise.

From-SVN: r269628
2019-03-12 23:13:36 +00:00
Jason Merrill c7e936dbc7 PR c++/86521 - wrong overload resolution with ref-qualifiers.
Here we were wrongly treating binding a const lvalue ref to an xvalue as
direct binding, which is wrong under [dcl.init.ref] and [over.match.ref].

	* call.c (build_user_type_conversion_1): Don't use a conversion to a
	reference of the wrong rvalueness for direct binding.

From-SVN: r269602
2019-03-11 23:19:22 -04: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
Jonathan Wakely 355d4eb36a Change test to use const variables instead of macros
This is C++ so there's no reason to use macros here.

	* testsuite/29_atomics/atomic_flag/test_and_set/explicit-hle.cc: Use
	const variables instead of macros.

From-SVN: r269585
2019-03-11 13:46:09 +00:00
Jonathan Wakely 1a823c9ae9 PR libstdc++/89629 fix _Hash_bytes for lengths > INT_MAX
PR libstdc++/89629
	* libsupc++/hash_bytes.cc [__SIZEOF_SIZE_T__ == 8] (_Hash_bytes):
	Use correct type for len_aligned.
	* testsuite/20_util/hash/89629.cc: New test.

From-SVN: r269584
2019-03-11 13:46:05 +00:00
Jakub Jelinek 8b9482b2d7 re PR libstdc++/89641 (std::atomic<T> no longer works)
PR libstdc++/89641
	* include/std/atomic (atomic<T>::store, atomic<T>::load,
	atomic<T>::exchange, atomic<T>::compare_exchange_weak,
	atomic<T>::compare_exchange_strong): Cast __m or __s and __f to int.
	* include/bits/atomic_base.h (__atomic_base<T>::operator++,
	__atomic_base<T>::operator--, __atomic_base<T>::operator+=,
	__atomic_base<T>::operator-=, __atomic_base<T>::operator&=,
	__atomic_base<T>::operator|=, __atomic_base<T>::operator^=,
	__atomic_base<T*>::operator++, __atomic_base<T*>::operator--,
	__atomic_base<T*>::operator+=, __atomic_base<T*>::operator-=): Cast
	memory_order_seq_cst to int.

From-SVN: r269582
2019-03-11 12:49:13 +01:00
Jonathan Wakely c7904d9e08 Fix text of hyperlink in manual
* doc/xml/manual/using.xml: Use link element instead of xref.
	* doc/html/*: Regenerate.

From-SVN: r269494
2019-03-08 13:56:53 +00:00
Jonathan Wakely 43aaf5ab73 Add fixed underlying type to enum path::format
* include/bits/fs_path.h (path::format): Add fixed underlying type.

From-SVN: r269493
2019-03-08 13:56:48 +00:00