Commit Graph

4242 Commits

Author SHA1 Message Date
Jonathan Wakely 45a8d80fec Define __cpp_lib_erase_if feature test macro
The C++2a draft specifies the value 201811L for this, but as an
extension we return the number of elements erased. This is expected to
be standardised, so the macro has the value 201900L until a proper value
is specified in the draft.

	* include/bits/erase_if.h: Define __cpp_lib_erase_if.
	* include/std/deque: Likewise.
	* include/std/forward_list: Likewise.
	* include/std/list: Likewise.
	* include/std/string: Likewise.
	* include/std/vector: Likewise.
	* include/std/version: Likewise.
	* testsuite/21_strings/basic_string/erasure.cc: Test macro.
	* testsuite/23_containers/deque/erasure.cc: Likewise.
	* testsuite/23_containers/forward_list/erasure.cc: Likewise.
	* testsuite/23_containers/list/erasure.cc: Likewise.
	* testsuite/23_containers/map/erasure.cc: Likewise.
	* testsuite/23_containers/set/erasure.cc: Likewise.
	* testsuite/23_containers/unordered_map/erasure.cc: Likewise.
	* testsuite/23_containers/unordered_set/erasure.cc: Likewise.
	* testsuite/23_containers/vector/erasure.cc: Likewise.

From-SVN: r267810
2019-01-10 13:49:31 +00:00
Jonathan Wakely cbe0bca404 Check AI_NUMERICSERV is defined before using it
The AI_NUMERICSERV constant is missing from old Darwin systems, so only
use it if it's supported.

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

From-SVN: r267809
2019-01-10 13:21:54 +00:00
Ville Voutilainen c3799b164f Implement LWG 2221: formatted output operator for nullptr
2019-01-10  Ville Voutilainen  <ville.voutilainen@gmail.com>
	    Jonathan Wakely  <jwakely@redhat.com>

	Implement LWG 2221
	* config/abi/pre/gnu.ver (GLIBCXX_3.4): Tighten patterns.
	(GLIBCXX_3.4.26): Add new exports.
	* include/Makefile.am: Add ostream-inst.cc. Move string-inst.cc to
	correct list of sources.
	* include/Makefile.in: Regenerate.
	* include/std/ostream (operator<<(nullptr_t)): New member function.
	* src/c++17/ostream-inst.cc: New file.
	* testsuite/27_io/basic_ostream/inserters_other/char/lwg2221.cc: New
	test.

Co-Authored-By: Jonathan Wakely <jwakely@redhat.com>

From-SVN: r267808
2019-01-10 13:14:57 +00:00
Jonathan Wakely 7c4979b2b2 Include name of test in filesystem-test.XXXXXX filenames
Also fix some tests that were not cleaning up after themselves, as
identified by the change to nonexistent_path.

	* testsuite/util/testsuite_fs.h (nonexistent_path): Include name
	of the source file containing the caller.
	* testsuite/27_io/filesystem/iterators/directory_iterator.cc: Remove
	directories created by test.
	* testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc:
	Likewise.
	* testsuite/experimental/filesystem/iterators/directory_iterator.cc:
	Likewise.
	* testsuite/experimental/filesystem/iterators/
	recursive_directory_iterator.cc: Likewise.

From-SVN: r267801
2019-01-10 11:12:00 +00:00
Jonathan Wakely d3c8a7cfdb Fix failing prettyprinter test
The failure for "p2" went unnoticed due to the pre-existing failures for
variables with similar names, like "p" and "q". This fixes the failure,
and gives the filesystem::path variables better names.

	* testsuite/libstdc++-prettyprinters/cxx17.cc: Fix expected output
	for filesystem::path. Give variables more distinctive names.

From-SVN: r267762
2019-01-09 10:46:52 +00:00
Jonathan Wakely c86fab9d08 PR libstdc++/88204 disable std::complex<long double> tests
The IBM128 long double format isn't foldable in constant expressions, so
conditionally skip the std::complex<long double> cases when they'll
fail.

	PR libstdc++/88204
	* testsuite/26_numerics/complex/operators/more_constexpr.cc: Do not
	test std::complex<long double> if long double format is IBM128.
	* testsuite/26_numerics/complex/requirements/more_constexpr.cc:
	Likewise.

From-SVN: r267757
2019-01-09 09:37:34 +00:00
Jonathan Wakely 416f555930 Pretty printer test fixes and improvements
Test that StdUniquePtrPrinter correctly prints std::unique_ptr objects
using the old layout, prior to the PR libstdc++/77990 changes.

The printer test for a valueless std::variant started to fail because
the PR libstdc++/87431 fix meant it no longer became valueless. Change
the test to use a type that is not trivially copyable, so that the
exception causes it to become valueless.

	* testsuite/libstdc++-prettyprinters/compat.cc: Test printer support
	for old std::unique_ptr layout.
	* testsuite/libstdc++-prettyprinters/cxx17.cc: Fix std::variant test
	to become valueless. Add filesystem::path tests.

From-SVN: r267743
2019-01-08 23:15:49 +00:00
Jonathan Wakely d942bc80e4 PR libstdc++/87855 fix optional for types with non-trivial copy/move
When the contained value is not trivially copy (or move) constructible
the union's copy (or move) constructor will be deleted, and so the
_Optional_payload delegating constructors are invalid. G++ fails to
diagnose this because it incorrectly performs copy elision in the
delegating constructors. Clang does diagnose it (llvm.org/PR40245).

The solution is to avoid performing any copy (or move) when the
contained value's copy (or move) constructor isn't trivial. Instead the
contained value can be constructed by calling _M_construct. This is OK,
because the relevant constructor doesn't need to be constexpr when the
contained value isn't trivially copy (or move) constructible.

Additionally, this patch removes a lot of code duplication in the
_Optional_payload partial specializations and the _Optional_base partial
specialization, by hoisting it into common base classes.

The Python pretty printer for std::optional needs to be adjusted to
support the new layout. Retain support for the old layout, and add a
test to verify that the support still works.

	PR libstdc++/87855
	* include/std/optional (_Optional_payload_base): New class template
	for common code hoisted from _Optional_payload specializations. Use
	a template for the union, to allow a partial specialization for
	types with non-trivial destructors. Add constructors for in-place
	initialization to the union.
	(_Optional_payload(bool, const _Optional_payload&)): Use _M_construct
	to perform non-trivial copy construction, instead of relying on
	non-standard copy elision in a delegating constructor.
	(_Optional_payload(bool, _Optional_payload&&)): Likewise for
	non-trivial move construction.
	(_Optional_payload): Derive from _Optional_payload_base and use it
	for everything except the non-trivial assignment operators, which are
	defined as needed.
	(_Optional_payload<false, C, M>): Derive from the specialization
	_Optional_payload<true, false, false> and add a destructor.
	(_Optional_base_impl::_M_destruct, _Optional_base_impl::_M_reset):
	Forward to corresponding members of _Optional_payload.
	(_Optional_base_impl::_M_is_engaged, _Optional_base_impl::_M_get):
	Hoist common members from _Optional_base.
	(_Optional_base): Make all members and base class public.
	(_Optional_base::_M_get, _Optional_base::_M_is_engaged): Move to
	_Optional_base_impl.
	* python/libstdcxx/v6/printers.py (StdExpOptionalPrinter): Add
	support for new std::optional layout.
	* testsuite/libstdc++-prettyprinters/compat.cc: New test.

From-SVN: r267742
2019-01-08 23:00:46 +00:00
Jonathan Wakely cf4b581f2e Fix build for systems without POSIX truncate
Older versions of newlib do not provide truncate so add a configure
check for it, and provide a fallback definition.

There were also some missing exports in the linker script, which went
unnoticed because there are no tests for some functions. A new link-only
test checks that every filesystem operation function is defined by the
library.

	* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for truncate.
	* config.h.in: Regenerate.
	* config/abi/pre/gnu.ver: Order patterns for filesystem operations
	alphabetically and add missing entries for copy_symlink,
	hard_link_count, rename, and resize_file.
	* configure: Regenerate.
	* src/c++17/fs_ops.cc (resize_file): Remove #if so posix::truncate is
	used unconditionally.
	* src/filesystem/ops-common.h (__gnu_posix::truncate)
	[!_GLIBCXX_HAVE_TRUNCATE]: Provide fallback definition that only
	supports truncating to zero length.
	* testsuite/27_io/filesystem/operations/all.cc: New test.
	* testsuite/27_io/filesystem/operations/resize_file.cc: New test.

From-SVN: r267647
2019-01-07 12:38:51 +00:00
Jonathan Wakely de4db54fd9 PR libstdc++/86756 Move rest of std::filesystem to libstdc++.so
Move std::filesystem directory iterators and operations from
libstdc++fs.a to main libstdc++ library. These components have many
dependencies on OS support, which is not available on all targets. Some
additional autoconf checks and conditional compilation is needed to
ensure the files will build for all targets. Previously this code was
not compiled without --enable-libstdcxx-filesystem-ts but the C++17
components should be available for all hosted builds.

The tests for these components no longer need to link to libstdc++fs.a,
but are not expected to pass on all targets. To avoid numerous failures
on targets which are not expected to pass the tests (due to missing OS
functionality) leave the dg-require-filesystem-ts directives in place
for now. This will ensure the tests only run for builds where the
filesystem-ts library is built, which presumably means some level of OS
support is present.

	PR libstdc++/86756
	* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for utime and
	lstat and define _GLIBCXX_USE_UTIME and _GLIBCXX_USE_LSTAT.
	* config.h.in: Regenerate.
	* config/abi/pre/gnu.ver (GLIBCXX_3.4.26): Export symbols for
	remaining std::filesystem types and functions.
	* configure: Regenerate.
	* src/c++17/Makefile.am: Add C++17 filesystem sources.
	* src/c++17/Makefile.in: Regenerate.
	* src/c++17/cow-fs_dir.cc: Move src/filesystem/cow-std-dir.cc to
	here, and change name of included file.
	* src/c++17/cow-fs_ops.cc: Move src/filesystem/cow-std-ops.cc to
	here, and change name of included file.
	* src/c++17/fs_dir.cc: Move src/filesystem/std-dir.cc to here. Change
	path to dir-common.h.
	* src/c++17/fs_ops.cc: Move src/filesystem/std-ops.cc to here. Change
	path to ops-common.h. Disable -Wunused-parameter warnings.
	(internal_file_clock): Define unconditionally.
	[!_GLIBCXX_HAVE_SYS_STAT_H] (internal_file_clock::from_stat): Do not
	define.
	(do_copy_file, do_space): Move definitions to ops.common.h.
	(copy, file_size, hard_link_count, last_write_time, space): Only
	perform operation when _GLIBCXX_HAVE_SYS_STAT_H is defined, otherwise
	report an error.
	(last_write_time, read_symlink): Remove unused attributes from
	parameters.
	* src/filesystem/Makefile.am: Remove C++17 filesystem sources.
	* src/filesystem/Makefile.in: Regenerate.
	* src/filesystem/cow-std-dir.cc: Move to src/c++17/cow-fs_dir.cc.
	* src/filesystem/cow-std-ops.cc: Move to src/c++17/cow-fs_ops.cc.
	* src/filesystem/std-dir.cc: Move to src/c++17/fs_dir.cc.
	* src/filesystem/std-ops.cc: Move to src/c++17/fs_ops.cc.
	* src/filesystem/dir-common.h [!_GLIBCXX_HAVE_DIRENT_H]: Define
	dummy types and functions instead of using #error.
	* src/filesystem/dir.cc [!_GLIBCXX_HAVE_DIRENT_H]: Use #error.
	* src/filesystem/ops-common.h [!_GLIBCXX_USE_LSTAT] (lstat): Define
	in terms of stat.
	[!_GLIBCXX_HAVE_UNISTD_H]: Define dummy types and functions.
	(do_copy_file, do_space): Move definitions here from std-ops.cc.
	* src/filesystem/ops.cc: Adjust calls to do_copy_file and do_space
	to account for new namespace.
	* testsuite/27_io/filesystem/directory_entry/86597.cc: Remove
	-lstdc++fs from dg-options.
	* testsuite/27_io/filesystem/directory_entry/lwg3171.cc: Likewise.
	* testsuite/27_io/filesystem/file_status/1.cc: Likewise.
	* testsuite/27_io/filesystem/filesystem_error/cons.cc: Likewise.
	* testsuite/27_io/filesystem/filesystem_error/copy.cc: Likewise.
	* testsuite/27_io/filesystem/iterators/directory_iterator.cc:
	Likewise.
	* testsuite/27_io/filesystem/iterators/pop.cc: Likewise.
	* testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc:
	Likewise.
	* testsuite/27_io/filesystem/operations/absolute.cc: Likewise.
	* testsuite/27_io/filesystem/operations/canonical.cc: Likewise.
	* testsuite/27_io/filesystem/operations/copy.cc: Likewise.
	* testsuite/27_io/filesystem/operations/copy_file.cc: Likewise.
	* testsuite/27_io/filesystem/operations/create_directories.cc:
	Likewise.
	* testsuite/27_io/filesystem/operations/create_directory.cc: Likewise.
	* testsuite/27_io/filesystem/operations/create_symlink.cc: Likewise.
	* testsuite/27_io/filesystem/operations/current_path.cc: Likewise.
	* testsuite/27_io/filesystem/operations/equivalent.cc: Likewise.
	* testsuite/27_io/filesystem/operations/exists.cc: Likewise.
	* testsuite/27_io/filesystem/operations/file_size.cc: Likewise.
	* testsuite/27_io/filesystem/operations/is_empty.cc: Likewise.
	* testsuite/27_io/filesystem/operations/last_write_time.cc: Likewise.
	* testsuite/27_io/filesystem/operations/permissions.cc: Likewise.
	* testsuite/27_io/filesystem/operations/proximate.cc: Likewise.
	* testsuite/27_io/filesystem/operations/read_symlink.cc: Likewise.
	* testsuite/27_io/filesystem/operations/relative.cc: Likewise.
	* testsuite/27_io/filesystem/operations/remove.cc: Likewise.
	* testsuite/27_io/filesystem/operations/remove_all.cc: Likewise.
	* testsuite/27_io/filesystem/operations/space.cc: Likewise.
	* testsuite/27_io/filesystem/operations/status.cc: Likewise.
	* testsuite/27_io/filesystem/operations/symlink_status.cc: Likewise.
	* testsuite/27_io/filesystem/operations/temp_directory_path.cc:
	Likewise.
	* testsuite/27_io/filesystem/operations/weakly_canonical.cc: Likewise.

From-SVN: r267616
2019-01-06 22:34:37 +00:00
Jonathan Wakely 2b5225352e PR libstdc++/86756 add std::filesystem::path to libstdc++.so
Move the C++17 std::filesystem::path definitions from the libstdc++fs.a
archive to the main libstdc++ library. The path classes do not depend on
any OS functions, so can be defined unconditionally on all targets
(rather than depending on --enable-libstdcxx-filesystem-ts). The tests
should pass on all targets too.

	PR libstdc++/86756
	* config/abi/pre/gnu.ver (GLIBCXX_3.4): Make various patterns for
	typeinfo and vtables less greedy.
	(GLIBCXX_3.4.26): Export symbols for std::filesystem::path.
	* src/c++17/Makefile.am: Add fs_path.cc and cow-fs_path.cc.
	* src/c++17/Makefile.in: Regenerate.
	* src/c++17/cow-fs_path.cc: Move src/filesystem/cow-std-path.cc to
	here, and change name of included file.
	* src/c++17/fs_path.cc: Move src/filesystem/std-path.cc to here.
	* src/filesystem/Makefile.am: Remove std-path.cc and cow-std-path.cc
	from sources.
	* src/filesystem/Makefile.in: Regenerate.
	* src/filesystem/cow-std-path.cc: Move to src/c++17/cow-fs_path.cc.
	* src/filesystem/std-path.cc: Move to src/c++17/fs_path.cc.
	* testsuite/27_io/filesystem/path/append/path.cc: Remove -lstdc++fs
	from dg-options and remove dg-require-filesystem-ts.
	* testsuite/27_io/filesystem/path/append/source.cc: Likewise.
	* testsuite/27_io/filesystem/path/assign/assign.cc: Likewise.
	* testsuite/27_io/filesystem/path/assign/copy.cc: Likewise.
	* testsuite/27_io/filesystem/path/compare/compare.cc: Likewise.
	* testsuite/27_io/filesystem/path/compare/lwg2936.cc: Likewise.
	* testsuite/27_io/filesystem/path/compare/path.cc: Likewise.
	* testsuite/27_io/filesystem/path/compare/strings.cc: Likewise.
	* testsuite/27_io/filesystem/path/concat/path.cc: Likewise.
	* testsuite/27_io/filesystem/path/concat/strings.cc: Likewise.
	* testsuite/27_io/filesystem/path/construct/80762.cc: Likewise.
	* testsuite/27_io/filesystem/path/construct/copy.cc: Likewise.
	* testsuite/27_io/filesystem/path/construct/default.cc: Likewise.
	* testsuite/27_io/filesystem/path/construct/format.cc: Likewise.
	* testsuite/27_io/filesystem/path/construct/locale.cc: Likewise.
	* testsuite/27_io/filesystem/path/construct/range.cc: Likewise.
	* testsuite/27_io/filesystem/path/construct/string_view.cc: Likewise.
	* testsuite/27_io/filesystem/path/decompose/extension.cc: Likewise.
	* testsuite/27_io/filesystem/path/decompose/filename.cc: Likewise.
	* testsuite/27_io/filesystem/path/decompose/parent_path.cc: Likewise.
	* testsuite/27_io/filesystem/path/decompose/relative_path.cc: Likewise.
	* testsuite/27_io/filesystem/path/decompose/root_directory.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/decompose/root_name.cc: Likewise.
	* testsuite/27_io/filesystem/path/decompose/root_path.cc: Likewise.
	* testsuite/27_io/filesystem/path/decompose/stem.cc: Likewise.
	* testsuite/27_io/filesystem/path/generation/normal.cc: Likewise.
	* testsuite/27_io/filesystem/path/generation/normal2.cc: Likewise.
	* testsuite/27_io/filesystem/path/generation/proximate.cc: Likewise.
	* testsuite/27_io/filesystem/path/generation/relative.cc: Likewise.
	* testsuite/27_io/filesystem/path/generic/generic_string.cc: Likewise.
	* testsuite/27_io/filesystem/path/itr/components.cc: Likewise.
	* testsuite/27_io/filesystem/path/itr/traversal.cc: Likewise.
	* testsuite/27_io/filesystem/path/modifiers/clear.cc: Likewise.
	* testsuite/27_io/filesystem/path/modifiers/make_preferred.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/modifiers/remove_filename.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/modifiers/replace_extension.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/modifiers/replace_filename.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/modifiers/swap.cc: Likewise.
	* testsuite/27_io/filesystem/path/native/string.cc: Likewise.
	* testsuite/27_io/filesystem/path/nonmember/append.cc: Likewise.
	* testsuite/27_io/filesystem/path/nonmember/hash_value.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/empty.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/has_extension.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/has_filename.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/has_parent_path.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/has_relative_path.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/has_root_directory.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/query/has_root_name.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/has_root_path.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/has_stem.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/is_absolute.cc: Likewise.
	* testsuite/27_io/filesystem/path/query/is_relative.cc: Likewise.

From-SVN: r267615
2019-01-06 22:34:29 +00:00
Jonathan Wakely caf80d87b5 PR libstdc++/87431 fix regression introduced by r264574
The previous patch for PR 87431 assumed that initialing a scalar type
could not throw, but it can obtain its value via a conversion operator,
which could throw. This meant the variant could get into a valueless
state, but the valueless_by_exception() member function would always
return false.

This patch fixes it by changing the emplace members to have strong
exception safety when initializing a contained value of trivially
copyable type. The _M_valid() member gets a corresponding change to
always return true for trivially copyable types, not just scalar types.

Strong exception safety (i.e. never becoming valueless) is achieved by
only replacing the current contained value once any potentially throwing
operations have completed. If constructing the new contained value can
throw then a new std::variant object is constructed to hold it, and then
move-assigned to *this (which won't throw).

	PR libstdc++/87431
	* include/std/variant (_Variant_storage<true, _Types...>::_M_valid):
	Check is_trivially_copyable instead of is_scalar.
	(variant::emplace<N, Args>(Args&&...)): If construction of the new
	contained value can throw and its type is trivially copyable then
	construct into a temporary variant and move from it, to provide the
	strong exception safety guarantee.
	(variant::emplace<N, U, Args>(initializer_list<U>, Args&&...)):
	Likewise.
	* testsuite/20_util/variant/87431.cc: New test.
	* testsuite/20_util/variant/run.cc: Adjust test so that throwing
	conversion causes valueless state.

From-SVN: r267614
2019-01-06 20:52:34 +00:00
Jonathan Wakely ecaad8d5cf PR libstdc++/88607 add tests using -finput-charset=ascii
This verifies that the <bits/extc++.h> header can be compiled with ASCII
as the input character set.

	PR libstdc++/88607
	* testsuite/17_intro/headers/c++1998/charset.cc: New test.
	* testsuite/17_intro/headers/c++2011/charset.cc: New test.
	* testsuite/17_intro/headers/c++2014/charset.cc: New test.
	* testsuite/17_intro/headers/c++2017/charset.cc: New test.
	* testsuite/17_intro/headers/c++2020/charset.cc: New test.

From-SVN: r267607
2019-01-06 00:49:11 +00:00
Jonathan Wakely 4ff3e65090 Add allocator-extended copy/move ctors to COW string
Add these constructors from C++11 which were missing from the COW
basic_string. Additionally simplify the definitions of the
basic_string::reference and basic_string::const_reference types as
required by C++11.

This allows filesystem::path::string<Allocator>() to be simplified, so
that the same code is used for both basic_string implementations.

	* config/abi/pre/gnu.ver (GLIBCXX_3.4.26): Export allocator-extended
	copy/move constructors for old std::basic_string.
	* include/bits/basic_string.h [!_GLIBCXX_USE_CXX11_ABI]
	(basic_string::reference, basic_string::const_reference): Define
	as plain references for C++11 and later.
	(basic_string::basic_string()): Put constructor body outside
	preprocessor conditional groups.
	(basic_string::basic_string(basic_string&&)): Move _Alloc_hider
	instead of copying it.
	(basic_string::basic_string(const basic_string&, const _Alloc&)):
	Define.
	(basic_string::basic_string(basic_string&&, const _Alloc&)):
	Define.
	* include/bits/fs_path.h [!_GLIBCXX_USE_CXX11_ABI]: Remove special
	cases for old basic_string.
	* testsuite/21_strings/basic_string/cons/char/8.cc: Test
	allocator-extended constructors unconditionally. Add extra members to
	allocator type when using old string ABI.
	* testsuite/21_strings/basic_string/allocator/71964.cc: Enable test
	for old string ABI.
	* testsuite/21_strings/basic_string/cons/wchar_t/8.cc: Likewise.

From-SVN: r267584
2019-01-04 23:23:17 +00:00
Jonathan Wakely 6908c1dc6f Fix test failure when -fno-inline is used
This currently checks _GLIBCXX_USE_DUAL_ABI which is incorrect, as that
can be true when _GLIBCXX_USE_CXX11_ABI == 0. The correct check would be
_GLIBCXX_USE_CXX11_ABI == 1, but that's made redundant by the cxx11-abi
effective target that the test requires. However, the test will fail if
-fno-inline is used, so check __NO_INLINE__ instead.

	* testsuite/23_containers/list/61347.cc: Avoid spurious failure when
	-fno-inline added to test flags.

From-SVN: r267582
2019-01-04 18:56:26 +00:00
Jonathan Wakely 9fc5a9a144 Remove XFAIL from test that no longer fails
This test started passing with the old ABI with r263808, so doesn't need
to be marked XFAIL now.

	* testsuite/21_strings/basic_string/requirements/
	explicit_instantiation/debug.cc: Remove XFAIL for old ABI.

From-SVN: r267578
2019-01-04 16:07:06 +00:00
Jonathan Wakely 66f3122436 Fix test failure with old Copy-On-Write std::string
* testsuite/27_io/filesystem/filesystem_error/copy.cc: Fix static
	assertion failures with old std::string ABI.

From-SVN: r267577
2019-01-04 15:42:33 +00:00
Jonathan Wakely 73d968d945 Fix bugs in filesystem::path::lexically_normal()
Using path::_List::erase(const_iterator) to remove a non-final component
in path::lexically_normal() is a bug, because it leaves the following
component with an incorrect _M_pos value.

Instead of providing erase members that allow removing components from
the middle, replace them with pop_back() and
_M_erase_from(const_iterator) which only allow removing elements at the
end. Most uses of erase are unaffected, because they only remove
elements from the end anyway. The one use of erasure from the middle in
lexically_normal() is replaced by calls to pop_back() and/or clearing
the last component to leave it as an empty final filename.

Also replace the "???" comment in lexically_normal() to document when
that branch is taken.

	* include/bits/fs_path.h (path::_List::erase): Replace both overloads
	with ...
	(path::pop_back(), path::_M_erase_from(const_iterator)): New member
	functions that will only erase elements at the end.
	* src/filesystem/std-path.cc (path::_List::_Impl::pop_back()): Define.
	(path::_List::_Impl::_M_erase_from(const_iterator)): Define.
	(path::_List::operator=(const _List&)): Use _M_erase_from(p) instead
	of erase(p, end()).
	(path::_List::pop_back()): Define.
	(path::_List::_M_erase_from(const_iterator)): Define.
	(path::operator/=(const path&)): Use pop_back to remove last component
	and _M_erase_from to remove multiple components.
	(path::_M_append(basic_string_view<value_type>)): Likewise.
	(path::operator+=(const path&)): Likewise.
	(path::_M_concat(basic_string_view<value_type>)): Likewise.
	(path::remove_filename()): Likewise.
	(path::lexically_normal()): Use _List::_Impl iterators instead of
	path::iterator. Use pop_back to remove components from the end. Clear
	trailing filename, instead of using erase(const_iterator) to remove
	a non-final component.
	* testsuite/27_io/filesystem/path/generation/normal.cc: Test
	additional cases.
	* testsuite/27_io/filesystem/path/generation/normal2.cc: New test.

From-SVN: r267576
2019-01-04 14:03:59 +00:00
Jonathan Wakely b30802179a Fix concatenation bug in filesystem::path
When erasing a trailing empty filename component, the output iterator
was not decremented, causing the next component to be created at the
wrong position.

	* src/filesystem/std-path.cc (path::operator+=(const path&)): Fix
	incorrect treatment of empty filename after trailing slash.
	* testsuite/27_io/filesystem/path/concat/path.cc: Test problem case.

From-SVN: r267574
2019-01-04 11:43:09 +00:00
Jonathan Wakely 5db78cac10 Avoid spurious test failures when -fno-inline in test flags
These tests rely on inlining, so if -fno-inline is added to the compiler
flags the tests fail. Use the predefined __NO_INLINE__ macro to detect
that situation, and don't bother testing the move assignment.

	* testsuite/21_strings/basic_string/modifiers/assign/char/
	move_assign_optim.cc: Avoid spurious failure when -fno-inline added
	to test flags.
	* testsuite/21_strings/basic_string/modifiers/assign/wchar_t/
	move_assign_optim.cc: Likewise.

From-SVN: r267573
2019-01-04 11:06:49 +00:00
Jonathan Wakely dd87c5c228 PR libstdc++/88681 export missing symbols
These new facet functions were added to GCC 5.1 but the versions for the
old std::string ABI were never exported from the shared library.

	PR libstdc++/88681
	* config/abi/pre/gnu.ver: Add missing exports.
	* testsuite/22_locale/collate_byname/88681.cc: New test.
	* testsuite/22_locale/time_get/get/char/88681.cc: New test.
	* testsuite/22_locale/time_get/get/wchar_t/88681.cc: New test.

From-SVN: r267563
2019-01-03 20:38:04 +00:00
Jonathan Wakely b3e2dc1ed9 Add more testcases for class template argument deduction of maps
This adds additional tests for std::map and std::multimap CTAD. The
tests ensure that deduction works for braced-init-list of value_type
objects, and for pairs of input iterators (with both std::pair<Key, T>
and value_type as the iterator's value_type). This ensures deduction
from value_type still works, as well as the non-value_type cases in LWG
3025.

Similar tests for unordered maps do not work, apparently because the
constructor taking an initializer_list<value_type> is not usable for
deduction, and the deduction guide taking initializer_list<pair<Key, T>>
deduces key_type to be const. I am not addressing that.

	* testsuite/23_containers/map/cons/deduction.cc: Test deduction from
	initializer_list<value_type> and from input iterator ranges.
	* testsuite/23_containers/multimap/cons/deduction.cc: Likewise.

From-SVN: r267518
2019-01-02 16:30:49 +00:00
Jonathan Wakely 362eea7cbf Fix year range in copyright header
* testsuite/experimental/string_view/element_access/char/empty.cc:
	Fix year range in copyright header.

From-SVN: r267508
2019-01-02 10:44:35 +00:00
Joel Brobecker 2667a5d04a Fix year range in libstdc++v3/testsuite/.../empty.cc copyright header
libstdc++-v3/ChangeLog:

        * testsuite/21_strings/basic_string_view/element_access/char/empty.cc:
        Fix year range in copyright header.

From-SVN: r267504
2019-01-02 06:04:51 +00:00
Jakub Jelinek a554497024 Update copyright years.
From-SVN: r267494
2019-01-01 13:31:55 +01:00
François Dumont 4483dd3fa3 2018-12-23 François Dumont <fdumont@gcc.gnu.org>
* libstdc++-v3/testsuite/util/testsuite_allocator.h
	(CustomPointerAlloc<>::allocate(size_t, pointer)): Replace by...
	(CustomPointerAlloc<>::allocate(size_t, const_void_pointer)): ...this.

From-SVN: r267381
2018-12-23 18:11:38 +00:00
Jonathan Wakely 080cec7f9a Fix filesystem::path tests that fail on Windows
* testsuite/27_io/filesystem/operations/proximate.cc: Fix test for
	MinGW.
	* testsuite/27_io/filesystem/path/append/source.cc: Likewise.
	* testsuite/27_io/filesystem/path/compare/lwg2936.cc: Likewise.

From-SVN: r267308
2018-12-20 18:12:11 +00:00
Jonathan Wakely 26bf4e3134 Add missing test from previous commit
* testsuite/27_io/filesystem/directory_entry/lwg3171.cc: New test
	(missed from previous commit).

From-SVN: r267297
2018-12-20 12:32:17 +00:00
Jonathan Wakely 36313a6bce LWG 2936: update path::compare logic and optimize string comparisons
The resolution for LWG 2936 defines the comparison more precisely, which
this patch implements. The patch also defines comparisons with strings
to work without constructing a temporary path object (so avoids any
memory allocations).

	* include/bits/fs_path.h (path::compare(const string_type&))
	(path::compare(const value_type*)): Add noexcept and construct a
	string view to compare to instead of a path.
	(path::compare(basic_string_view<value_type>)): Add noexcept. Remove
	inline definition.
	* src/filesystem/std-path.cc (path::_Parser): Track last type read
	from input.
	(path::_Parser::next()): Return a final empty component when the
	input ends in a non-root directory separator.
	(path::_M_append(basic_string_view<value_type>)): Remove special cases
	for trailing non-root directory separator.
	(path::_M_concat(basic_string_view<value_type>)): Likewise.
	(path::compare(const path&)): Implement LWG 2936.
	(path::compare(basic_string_view<value_type>)): Define in terms of
	components returned by parser, consistent with LWG 2936.
	* testsuite/27_io/filesystem/path/compare/lwg2936.cc: New.
	* testsuite/27_io/filesystem/path/compare/path.cc: Test more cases.
	* testsuite/27_io/filesystem/path/compare/strings.cc: Likewise.

From-SVN: r267235
2018-12-18 15:52:33 +00:00
Jonathan Wakely 2017595dfa PR libstdc++/71044 fix off-by-one errors introduced recently
The recent changes to append/concat directly from strings (without
constructing paths) introduced regressions where one of the components
could be omitted from the iteration sequence in the result.

	PR libstdc++/71044
	* src/filesystem/std-path.cc (path::_M_append): Fix off-by-one error
	that caused a component to be lost from the iteration sequence.
	(path::_M_concat): Likewise.
	* testsuite/27_io/filesystem/path/append/source.cc: Test appending
	long strings.
	* testsuite/27_io/filesystem/path/concat/strings.cc: Test
	concatenating long strings.
	* testsuite/27_io/filesystem/path/construct/string_view.cc: Test
	construction from long string.

From-SVN: r267222
2018-12-17 22:43:31 +00:00
Jonathan Wakely 2b462958e2 Fix handling of POSIX paths containing a root-name
Fix path appending and concatenating to work correctly for a leading
root-name. Check a new macro, SLASHSLASH_IS_ROOT_NAME, instead of making
the behaviour depend directly on __CYGWIN__.

	* src/filesystem/std-path.cc (SLASHSLASH_IS_ROOT_NAME): New macro to
	control whether interpret paths with two slashes as a root-name.
	(path::operator/=(const path&)) [SLASHSLASH_IS_ROOT_NAME]: Add a
	root-directory when appending to a root-name.
	(path::_M_append(basic_string_view<value_type>))
	[SLASHSLASH_IS_ROOT_NAME]: Likewise.
	(path::operator/=(const path&)) [SLASHSLASH_IS_ROOT_NAME]: Likewise.
	(path::_M_concat(basic_string_view<value_type>))
	[SLASHSLASH_IS_ROOT_NAME]: Likewise.
	(path::lexically_normal()) [SLASHSLASH_IS_ROOT_NAME]: Use += instead
	of /= to add a root-directory to the result.
	* testsuite/27_io/filesystem/path/decompose/root_directory.cc: Fix
	expected result for Cygwin.

From-SVN: r267107
2018-12-13 20:34:10 +00:00
Jonathan Wakely 4f87bb8d6e PR libstdc++/71044 optimize std::filesystem::path construction
This new implementation has a smaller footprint than the previous
implementation, due to replacing std::vector<_Cmpt> with a custom pimpl
type that only needs a single pointer. The _M_type enumeration is also
combined with the pimpl type, by using a tagged pointer, reducing
sizeof(path) further still.

Construction and modification of paths is now done more efficiently, by
splitting the input into a stack-based buffer of string_view objects
instead of a dynamically-allocated vector containing strings. Once the
final size is known only a single allocation is needed to reserve space
for it.  The append and concat operations no longer require constructing
temporary path objects, nor re-parsing the entire native pathname.

This results in algorithmic improvements to path construction, and
working with large paths is much faster.

	PR libstdc++/71044
	* include/bits/fs_path.h (path::path(path&&)): Add noexcept when
	appropriate. Move _M_cmpts instead of reparsing the native pathname.
	(path::operator=(const path&)): Do not define as defaulted.
	(path::operator/=, path::append): Call _M_append.
	(path::concat): Call _M_concat.
	(path::path(string_type, _Type): Change type of first parameter to
	basic_string_view<value_type>.
	(path::_M_append(basic_string_view<value_type>)): New member function.
	(path::_M_concat(basic_string_view<value_type>)): New member function.
	(_S_convert(value_type*, __null_terminated)): Return string view.
	(_S_convert(const value_type*, __null_terminated)): Return string view.
	(_S_convert(value_type*, value_type*))
	(_S_convert(const value_type*, const value_type*)): Add overloads for
	pairs of pointers.
	(_S_convert(_InputIterator, __null_terminated)): Construct string_type
	explicitly, for cases where _S_convert returns a string view.
	(path::_S_is_dir_sep): Replace with non-member is_dir_sep.
	(path::_M_trim, path::_M_add_root_name, path::_M_add_root_dir)
	(path::_M_add_filename): Remove.
	(path::_M_type()): New member function to replace _M_type data member.
	(path::_List): Define new struct type instead of using std::vector.
	(path::_Cmpt::_Cmpt(string_type, _Type, size_t)): Change type of
	first parameter to basic_string_view<value_type>.
	(path::operator+=(const path&)): Do not define inline.
	(path::operator+=(const string_type&)): Call _M_concat.
	(path::operator+=(const value_type*)): Likewise.
	(path::operator+=(value_type)): Likewise.
	(path::operator+=(basic_string_view<value_type>)): Likewise.
	(path::operator/=(const path&)): Do not define inline.
	(path::_M_append(path)): Remove.
	* python/libstdcxx/v6/printers.py (StdPathPrinter): New printer that
	understands the new path::_List type.
	* src/filesystem/std-path.cc (is_dir_sep): New function to replace
	path::_S_is_dir_sep.
	(path::_Parser): New helper class to parse strings as paths.
	(path::_List::_Impl): Define container type for path components.
	(path::_List): Define members.
	(path::operator=(const path&)): Define explicitly, to provide the
	strong exception safety guarantee.
	(path::operator/=(const path&)): Implement manually by processing
	each component of the argument, rather than using _M_split_cmpts
	to parse the entire string again.
	(path::_M_append(string_type)): Likewise.
	(path::operator+=(const path&)): Likewise.
	(path::_M_concat(string_type)): Likewise.
	(path::remove_filename()): Perform trim directly instead of calling
	_M_trim().
	(path::_M_split_cmpts()): Rewrite in terms of _Parser class.
	(path::_M_trim, path::_M_add_root_name, path::_M_add_root_dir)
	(path::_M_add_filename): Remove.
	* testsuite/27_io/filesystem/path/append/source.cc: Test appending a
	string view that aliases the path.
	testsuite/27_io/filesystem/path/concat/strings.cc: Test concatenating
	a string view that aliases the path.

From-SVN: r267106
2018-12-13 20:33:55 +00:00
Jonathan Wakely a7a6c14a55 Fix [fs.path.gen] tests to use backslashes for mingw
The normalized paths contain backslashes so fix the expected values to
use backslashes too.

	* testsuite/27_io/filesystem/path/generation/proximate.cc: Use
	preferred directory separators for normalized paths.
	* testsuite/27_io/filesystem/path/generation/relative.cc: Likewise.

From-SVN: r267090
2018-12-13 12:26:52 +00:00
Jonathan Wakely ebfaf34570 Fix test to work when path::native() returns wstring
* testsuite/27_io/filesystem/path/itr/traversal.cc: Fix test for
	mingw.

From-SVN: r267089
2018-12-13 12:09:33 +00:00
Jonathan Wakely bc51a764a3 Disable new tests for configurations with no libstdc++fs.a
* testsuite/27_io/filesystem/path/construct/80762.cc: Skip test if
	the Filesystem TS support is not configured.
	* testsuite/experimental/filesystem/path/construct/80762.cc: Likewise.

From-SVN: r267082
2018-12-13 11:01:03 +00:00
Jonathan Wakely 9e16052644 Overload std::distance and std::advance for path::iterator
Although filesystem::path::iterator is only a bidirectional iterator,
the underlying sequence has random access iterators (specifically, raw
pointers). This means std::distance and std::advance can be implemented
more efficiently than the generic versions which apply ++ and --
repeatedly.

	PR libstdc++/71044 (partial)
	* include/bits/fs_path.h (__path_iter_distance, __path_iter_advance):
	New friend functions to implement std::distance and std::advance more
	efficiently.
	(distance, advance): Add overloads for path::iterator.
	* testsuite/27_io/filesystem/path/itr/components.cc: Test new
	overload.

From-SVN: r267057
2018-12-12 16:13:49 +00:00
Jonathan Wakely 6b7c0b5559 PR libstdc++/80762 avoid ambiguous __constructible_from<void, void>
Ensure we don't try to instantiate __is_constructible_from<void, void>,
because there are two partial specializations that are equally good
matches.

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

From-SVN: r267056
2018-12-12 16:13:43 +00:00
Jakub Jelinek 0d7924f2e7 P0595R2 - is_constant_evaluated
P0595R2 - is_constant_evaluated
	* include/bits/c++config (_GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED):
	Define if __builtin_is_constant_evaluated is available.
	* include/std/type_traits (std::is_constant_evaluated): New constexpr
	inline function.
	* testsuite/20_util/is_constant_evaluated/1.cc: New test.
	* testsuite/20_util/is_constant_evaluated/noexcept.cc: New test.

From-SVN: r267045
2018-12-12 09:31:01 +01:00
Jonathan Wakely 87e4fbdd9a Make test for Filesystem TS actually use the Filesystem TS
This test was copied from 27_io/filesystem/path/query/is_absolute.cc but
should have been modified to test the path type from the TS instead of
std::filesystem::path.

	* testsuite/experimental/filesystem/path/query/is_absolute.cc: Fix
	test to use TS, not C++17.

From-SVN: r266957
2018-12-10 15:25:02 +00:00
Jonathan Wakely 881e947ebd Fix PR libstdc++/64883 Darwin headers use always_inline so don't test that
Because darwin system headers use always_inline rather than
    __always_inline__ the libstdc++ test will fail, even if our headers only
    use the reserved form of the attribute. Don't test it on Darwin, and
    assume that testing on other targets will catch any accidental misuses
    in libstdc++ headers.
 
2018-12-06  Jonathan Wakely  <jwakely@redhat.com>
	    Iain Sandoe  <iain@sandoe.co.uk>

            PR libstdc++/64883
            * testsuite/17_intro/headers/c++1998/all_attributes.cc: Don't test
            always_inline on Darwin.
            * testsuite/17_intro/headers/c++2011/all_attributes.cc: Likewise.
            * testsuite/17_intro/headers/c++2014/all_attributes.cc: Likewise.
            * testsuite/17_intro/headers/c++2017/all_attributes.cc: Likewise.
            * testsuite/17_intro/headers/c++2020/all_attributes.cc: Likewise.


Co-Authored-By: Iain Sandoe <iain@sandoe.co.uk>

From-SVN: r266863
2018-12-06 19:21:32 +00:00
Edward Smith-Rowland d012ab6057 PR libstdc++/88341 - Complex norm doesn't compile with C++11
2018-12-03  Edward Smith-Rowland  <3dw4rd@verizon.net>

	PR libstdc++/88341 - Complex norm doesn't compile with C++11
	* include/std/complex (_S_do_it): Make C++20 constexpr.
	* testsuite/26_numerics/complex/value_operations/pr88341.cc: New test.

From-SVN: r266788
2018-12-04 16:26:39 +00:00
Edward Smith-Rowland 5bd624fbde Implement P0457R2 String Prefix and Suffix Checking.
2018-11-30  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Implement P0457R2 String Prefix and Suffix Checking.
	* include/bits/basic_string.h: Add starts_with, ends_with members.
	* include/std/string_view: Ditto.
	* testsuite/21_strings/basic_string/operations/starts_with/
	char/1.cc: New test.
	* testsuite/21_strings/basic_string/operations/starts_with/
	wchar_t/1.cc: New test.
	* testsuite/21_strings/basic_string/operations/ends_with/
	char/1.cc: New test.
	* testsuite/21_strings/basic_string/operations/ends_with/
	wchar_t/1.cc: New test.
	* testsuite/21_strings/basic_string_view/operations/starts_with/
	char/1.cc: New test.
	* testsuite/21_strings/basic_string_view/operations/starts_with/
	wchar_t/1.cc: New test.
	* testsuite/21_strings/basic_string_view/operations/ends_with/
	char/1.cc: New test.
	* testsuite/21_strings/basic_string_view/operations/ends_with/
	wchar_t/1.cc: New test.

From-SVN: r266674
2018-11-30 16:26:02 +00:00
Edward Smith-Rowland 0b44b4b807 Pre-emptively support P0646R1 for std container erasure.
2018-11-30  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Pre-emptively support P0646R1 for std container erasure.
	* include/bits/erase_if.h: Accumulate and return number of erased nodes.
	* include/std/forward_list (): Return number of erased items.
	* include/std/list (): Ditto.
	* include/std/map (): Ditto.
	* include/std/set (): Ditto.
	* include/std/string (): Ditto.
	* include/std/unordered_map (): Ditto.
	* include/std/unordered_set (): Ditto.
	* include/std/vector (): Ditto.
	* testsuite/21_strings/basic_string/erasure.cc: Test number of erasures.
	* testsuite/23_containers/deque/erasure.cc: Ditto.
	* testsuite/23_containers/forward_list/erasure.cc: Ditto.
	* testsuite/23_containers/list/erasure.cc: Ditto.
	* testsuite/23_containers/map/erasure.cc: Ditto.
	* testsuite/23_containers/set/erasure.cc: Ditto.
	* testsuite/23_containers/unordered_map/erasure.cc: Ditto.
	* testsuite/23_containers/unordered_set/erasure.cc: Ditto.
	* testsuite/23_containers/vector/erasure.cc: Ditto.

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

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

From-SVN: r266616
2018-11-29 13:43:55 +00:00
Jonathan Wakely 8c9b385288 PR libstdc++/88119 use alignof in std::alignment_of, not __alignof__
Now that __alignof__ and alignof sometimes disagree it matters which one
we use. The standard says that std::alignment_of<T>::value equals
alignof(T), so we need to use that.

Change the only uses of alignment_of to use __alignof__ to avoid a
change in alignment.

	PR libstdc++/88119
	* include/ext/aligned_buffer.h (__aligned_membuf): Add comment.
	(__aligned_buffer): Use __alignof__ instead of std::alignment_of.
	* include/std/type_traits (alignment_of): Use alignof instead of
	__alignof__.
	* testsuite/20_util/alignment_of/value.cc: Fix test to check values
	match alignof not __alignof__, as required by the standard.

From-SVN: r266613
2018-11-29 12:32:57 +00:00
Jonathan Wakely ffe2c05539 PR libstdc++/86910 fix filesystem::create_directories
Implement the proposed semantics from P1164R0, which reverts the changes
of LWG 2935. This means that failure to create a directory because a
non-directory already exists with that name will be reported as an
error.

While rewriting the function, also fix PR 87846, which is a result of
the C++17 changes to how a trailing slash on a path affects the last
component of a path.

	PR libstdc++/86910
	PR libstdc++/87846
	* src/filesystem/ops.cc (experimental::create_directories): Report
	an error when the path resolves to an existing non-directory (P1164).
	* src/filesystem/std-ops.cc (create_directories): Likewise. Handle
	empty filenames due to trailing slashes.
	* testsuite/27_io/filesystem/operations/create_directories.cc: Test
	when some component of the path exists and is not a directory. Test
	trailing slashes.
	* testsuite/experimental/filesystem/operations/create_directories.cc:
	Likewise.

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

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

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

From-SVN: r266567
2018-11-28 16:44:25 +00:00
Jonathan Wakely bd6ccc290a Apply resolution for LWG DR 3096
Add fix for "path::lexically_relative is confused by trailing slashes".

	* doc/xml/manual/intro.xml: Document LWG 3096 change.
	* src/filesystem/std-path.cc (path::lexically_relative(const path&)):
	Treat a final empty element equivalently to a final dot element.
	* testsuite/27_io/filesystem/path/generation/relative.cc: Add checks
	for the examples in the DR.

From-SVN: r266566
2018-11-28 15:36:56 +00:00
Jonathan Wakely 24d9b090fb PR libstdc++/83306 make filesystem_error no-throw copyable
The class API provides no way to modify the members, so we can share
them between copies of the same object. Copying becomes a simple
reference count update, which doesn't throw.

Also adjust the what() string to allow distinguishing between an empty
path passed to the constructor, and no path.

	PR libstdc++/83306
	* include/bits/fs_path.h (filesystem_error): Move data members into
	pimpl class owned by shared_ptr. Remove inline definitions of member
	functions.
	* src/filesystem/std-path.cc (filesystem_error::_Impl): Define.
	(filesystem_error): Define member functions.
	* testsuite/27_io/filesystem/filesystem_error/cons.cc: New test.
	* testsuite/27_io/filesystem/filesystem_error/copy.cc: New test.

From-SVN: r266565
2018-11-28 15:27:11 +00:00
Jonathan Wakely c718ff4183 Clean up temporary files created by std::filesystem testsuite
* testsuite/27_io/filesystem/operations/canonical.cc: Remove
	directory created by test.
	* testsuite/27_io/filesystem/operations/symlink_status.cc: Remove
	symlink created by test.

From-SVN: r266535
2018-11-27 23:35:17 +00:00
François Dumont 010211394d re PR libstdc++/88199 (memory leak on unordered container move assignment)
2018-11-27  François Dumont  <fdumont@gcc.gnu.org>

	PR libstdc++/88199
	* include/bits/hashtable.h (_Hashtable<>::_M_assign_elements): New.
	(_Hashtable<>::operator=(const _Hashtable&)): Use latter.
	(_Hashtable<>::_M_move_assign(_Hashtable&&, false_type)): Likewise.
	* testsuite/23_containers/unordered_set/allocator/move_assign.cc
	(test03): New.

From-SVN: r266528
2018-11-27 21:21:51 +00:00
Jonathan Wakely f4d3e3cca5 Only use __float128 in test if available
* testsuite/26_numerics/complex/requirements/more_constexpr.cc: Fix
	failure on targets without __float128.

From-SVN: r266450
2018-11-26 11:12:11 +00:00
Edward Smith-Rowland e987fb1ebe Implement P0415 More constexpr for std::complex.
2018-11-23  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Implement P0415 More constexpr for std::complex.
	* include/std/complex (conj(complex<Tp>), norm(complex<Tp>)): Constexpr;
	(real(Tp), imag(Tp)): Constexpr;
	(operator@=(Tp), operator@=(complex<Tp>)): Constexpr;
	(operator@(Tp,complex<Tp>), operator@(complex<Tp>,Tp)
	operator@(complex<Tp>,complex<Tp>)): Constexpr.
	* testsuite/26_numerics/complex/comparison_operators/
	more_constexpr.cc: New test.
	* testsuite/26_numerics/complex/operators/more_constexpr.cc: New test.
	* testsuite/26_numerics/complex/requirements/
	more_constexpr.cc: New test.
	* testsuite/26_numerics/complex/value_operations/
	more_constexpr.cc: New test.
	* testsuite/26_numerics/headers/complex/synopsis.cc:
	Add _GLIBCXX20_CONSTEXPR to applicable operators; Add missing proj().
	* testsuite/26_numerics/headers/complex/synopsis.cc:
	Add _GLIBCXX20_CONSTEXPR to relevant decls.

From-SVN: r266416
2018-11-23 18:17:04 +00:00
Martin Sebor 14a9206d0c PR libstdc++/65229 fix pretty printer for std::bitset<0>
2018-11-23  Martin Sebor  <msebor@redhat.com>
	    Jonathan Wakely  <jwakely@redhat.com>

	PR libstdc++/65229
	* python/libstdcxx/v6/printers.py (StdBitsetPrinter): Handle
	exception thrown for std::bitset<0>.
	* testsuite/libstdc++-prettyprinters/simple.cc: Test std::bitset<0>.

Co-Authored-By: Jonathan Wakely <jwakely@redhat.com>

From-SVN: r266409
2018-11-23 16:12:03 +00:00
Jonathan Wakely 11aa881f98 PR libstdc++/87308 adjust regex used in std::any pretty printer
The pretty printer for std::any fails when the contained value is a
locally-defined type, because the name in the debuginfo has
cv-qualifiers and ptr-declarators in different positions. The unexpected
format confuses the printer. This makes the printer's regex handle
either format.

This isn't a complete fix because looking up the contained type fails
when there are two types with the same name (defined in different local
scopes). This applies to all closure types defined in a given function,
as they all appear as "func()::lambda" in the debuginfo names.

	PR libstdc++/87308 (partial)
	* python/libstdcxx/v6/printers.py (StdExpAnyPrinter): Adjust regex to
	work around PR 88166.
	* testsuite/libstdc++-prettyprinters/cxx17.cc: Test std::any
	containing a local type.

From-SVN: r266408
2018-11-23 15:48:56 +00:00
Jakub Jelinek e1389417f9 re PR c++/87386 (Error message for static_assert show wrong range)
PR c++/87386
	* parser.c (cp_parser_primary_expression): Use
	id_expression.get_location () instead of id_expr_token->location.
	Adjust the range from id_expr_token->location to
	id_expressio.get_finish ().
	(cp_parser_operator_function_id): Pass location of the operator
	token down to cp_parser_operator.
	(cp_parser_operator): Add start_loc argument, always construct a
	location with caret at start_loc and range from start_loc to the
	finish of the last token.
gcc/testsuite/
	* g++.dg/diagnostic/pr87386.C: New test.
	* g++.dg/parse/error17.C: Adjust expected diagnostics.
libstdc++-v3/
	* testsuite/20_util/scoped_allocator/69293_neg.cc: Adjust expected
	line.
	* testsuite/20_util/uses_allocator/cons_neg.cc: Likewise.
	* testsuite/20_util/uses_allocator/69293_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: r266359
2018-11-21 23:41:07 +01:00
Ville Voutilainen 47df7e197b Housekeeping for the effective targets of optional's tests.
* testsuite/20_util/optional/77288.cc: Adjust.
* testsuite/20_util/optional/84601.cc: Likewise.
* testsuite/20_util/optional/assignment/1.cc: Likewise.
* testsuite/20_util/optional/assignment/2.cc: Likewise.
* testsuite/20_util/optional/assignment/3.cc: Likewise.
* testsuite/20_util/optional/assignment/4.cc: Likewise.
* testsuite/20_util/optional/assignment/5.cc: Likewise.
* testsuite/20_util/optional/assignment/6.cc: Likewise.
* testsuite/20_util/optional/assignment/7.cc: Likewise.
* testsuite/20_util/optional/assignment/8.cc: Likewise.
* testsuite/20_util/optional/cons/77727.cc: Likewise.
* testsuite/20_util/optional/cons/copy.cc: Likewise.
* testsuite/20_util/optional/cons/deduction.cc: Likewise.
* testsuite/20_util/optional/cons/default.cc: Likewise.
* testsuite/20_util/optional/cons/move.cc: Likewise.
* testsuite/20_util/optional/cons/trivial.cc: Likewise.
* testsuite/20_util/optional/cons/value.cc: Likewise.
* testsuite/20_util/optional/cons/value_neg.cc: Likewise.
* testsuite/20_util/optional/constexpr/cons/default.cc: Likewise.
* testsuite/20_util/optional/constexpr/cons/value.cc: Likewise.
* testsuite/20_util/optional/constexpr/in_place.cc: Likewise.
* testsuite/20_util/optional/constexpr/nullopt.cc: Likewise.
* testsuite/20_util/optional/constexpr/observers/1.cc: Likewise.
* testsuite/20_util/optional/constexpr/observers/4.cc: Likewise.
* testsuite/20_util/optional/constexpr/observers/5.cc: Likewise.
* testsuite/20_util/optional/constexpr/relops/1.cc: Likewise.
* testsuite/20_util/optional/constexpr/relops/2.cc: Likewise.
* testsuite/20_util/optional/constexpr/relops/3.cc: Likewise.
* testsuite/20_util/optional/constexpr/relops/4.cc: Likewise.
* testsuite/20_util/optional/constexpr/relops/5.cc: Likewise.
* testsuite/20_util/optional/constexpr/relops/6.cc: Likewise.
* testsuite/20_util/optional/in_place.cc: Likewise.
* testsuite/20_util/optional/make_optional.cc: Likewise.
* testsuite/20_util/optional/nullopt.cc: Likewise.
* testsuite/20_util/optional/observers/1.cc: Likewise.
* testsuite/20_util/optional/observers/2.cc: Likewise.
* testsuite/20_util/optional/observers/3.cc: Likewise.
* testsuite/20_util/optional/observers/4.cc: Likewise.
* testsuite/20_util/optional/observers/5.cc: Likewise.
* testsuite/20_util/optional/observers/6.cc: Likewise.
* testsuite/20_util/optional/relops/1.cc: Likewise.
* testsuite/20_util/optional/relops/2.cc: Likewise.
* testsuite/20_util/optional/relops/3.cc: Likewise.
* testsuite/20_util/optional/relops/4.cc: Likewise.
* testsuite/20_util/optional/relops/5.cc: Likewise.
* testsuite/20_util/optional/relops/6.cc: Likewise.
* testsuite/20_util/optional/relops/7.cc: Likewise.
* testsuite/20_util/optional/requirements.cc: Likewise.
* testsuite/20_util/optional/swap/1.cc: Likewise.
* testsuite/20_util/optional/swap/2.cc: Likewise.
* testsuite/20_util/optional/typedefs.cc: Likewise.

From-SVN: r266310
2018-11-20 12:42:28 +02:00
Ville Voutilainen 4fea820523 re PR libstdc++/87855 (std::optional<T> only copy-constructible if T is trivially copy-constructible)
PR libstdc++/87855

Also implement P0602R4 (variant and optional
should propagate copy/move triviality) for std::optional.
* include/std/optional (_Optional_payload): Change
the main constraints to check constructibility in
addition to assignability.
(operator=): Make constexpr.
(_M_reset): Likewise.
(_M_construct): Likewise.
(operator->): Likewise.
* testsuite/20_util/optional/assignment/8.cc: Adjust.
* testsuite/20_util/optional/assignment/9.cc: New.

From-SVN: r266278
2018-11-19 17:05:18 +02:00
Jonathan Wakely d86b600d89 PR libstdc++/88084 - Implement LWG 2777
* include/std/string_view (basic_string_view::copy): Use traits to
	copy.
	* testsuite/21_strings/basic_string_view/operations/copy/char/2.cc:
	New test.
	* testsuite/21_strings/basic_string_view/operations/copy/wchar_t/2.cc:
	New test.

From-SVN: r266269
2018-11-19 10:53:59 +00:00
Michele Pezzutti bee39274cb PR libstdc++/83566 - cyl_bessel_j returns wrong result for x>1000
2018-11-16  Michele Pezzutti <mpezz@tiscali.it>
	    Edward Smith-Rowland  <3dw4rd@verizon.net>

	PR libstdc++/83566 - cyl_bessel_j returns wrong result for x>1000
	for high orders.
	* include/tr1/bessel_function.tcc: Perform no fewer than nu/2 iterations
	of the asymptotic series (nu is the Bessel order).
	* testsuite/tr1/5_numerical_facilities/special_functions/
	09_cyl_bessel_j/check_value.cc: Add tests at nu=100, 1000<=x<=2000.
	* testsuite/tr1/5_numerical_facilities/special_functions/	
	11_cyl_neumann/check_value.cc: Ditto.
	* testsuite/special_functions/08_cyl_bessel_j/check_value.cc: Ditto.
	* testsuite/special_functions/10_cyl_neumann/check_value.cc: Ditto.


Co-Authored-By: Edward Smith-Rowland <3dw4rd@verizon.net>

From-SVN: r266252
2018-11-18 18:32:26 +00:00
Jonathan Wakely c5be64810c Implement std::pmr::synchronized_pool_resource
Define the thread-safe pool resource, using a shared_mutex to allow
multiple threads to concurrently allocate from thread-specific pools.

Define new weak symbols for the pthread_rwlock_t functions, to avoid
making libstdc++.so depend on libpthread.so

When the necessary Gthread support is absent only define the
feature-test macro to 1, rather than 201603. This is intended to imply
incomplete support, because everything except synchronized_pool_resource
works.

	Implement std::pmr::synchronized_pool_resource
	* config/abi/pre/gnu.ver: Add new symbols.
	* include/std/memory_resource [_GLIBCXX_HAS_GTHREADS]
	(__cpp_lib_memory_resource): Define to expected value, 201603.
	(synchronized_pool_resource): New class.
	[!_GLIBCXX_HAS_GTHREADS] (__cpp_lib_memory_resource): Define to 1.
	* include/std/shared_mutex (__glibcxx_rwlock_rdlock)
	(__glibcxx_rwlock_tryrdlock, __glibcxx_rwlock_wrlock)
	(__glibcxx_rwlock_trywrlock, __glibcxx_rwlock_unlock)
	(__glibcxx_rwlock_destroy, __glibcxx_rwlock_init)
	(__glibcxx_rwlock_timedrdlock, __glibcxx_rwlock_timedwrlock): Define
	weak symbols for POSIX rwlock functions.
	(__shared_mutex_pthread): Use weak symbols.
	* include/std/version (__cpp_lib_memory_resource): Define.
	* src/c++17/memory_resource.cc [_GLIBCXX_HAS_GTHREADS]
	(synchronized_pool_resource::_TPools): New class.
	(destroy_TPools): New function for pthread_key_create destructor.
	(synchronized_pool_resource::synchronized_pool_resource)
	(synchronized_pool_resource::~synchronized_pool_resource)
	(synchronized_pool_resource::release)
	(synchronized_pool_resource::do_allocate)
	(synchronized_pool_resource::do_deallocate): Define public members.
	(synchronized_pool_resource::_M_thread_specific_pools)
	(synchronized_pool_resource::_M_alloc_tpools)
	(synchronized_pool_resource::_M_alloc_shared_tpools): Define private
	members.
	* testsuite/20_util/synchronized_pool_resource/allocate.cc: New test.
	* testsuite/20_util/synchronized_pool_resource/cons.cc: New test.
	* testsuite/20_util/synchronized_pool_resource/is_equal.cc: New test.
	* testsuite/20_util/synchronized_pool_resource/multithreaded.cc: New
	test.
	* testsuite/20_util/synchronized_pool_resource/release.cc: New test.
	* testsuite/performance/20_util/memory_resource/pools.cc: Add
	multithreaded tests using pmr::synchronized_pool_resource.

From-SVN: r266242
2018-11-17 23:35:44 +00:00
Renlin Li ac28df7e53 [Patch][libstdc++.exp] Update the usage of cached result.
This patch replaces the usage of cached results with a global dictionary.

Additionally, check_v3_target_namedlocale is updated to check on every variant.
Originally, it is only checked once.


gcc/libstdc++-v3/:
2018-11-16  Renlin Li  <renlin.li@arm.com>
	    Tejas Belagod  <tejas.belagod@arm.com>

	testsuite/lib/libstdc++.exp (check_v3_target_prop_cached): New proc.
	(check_v3_target): Use check_v3_target_prop_cached.


Co-Authored-By: Tejas Belagod <tejas.belagod@arm.com>

From-SVN: r266209
2018-11-16 14:36:40 +00:00
Jonathan Wakely a15032ee7b Optimize pool resource allocation
A recent change caused a performance regression. This restores the
previous performance and adds a performance test.

	* scripts/check_performance: Allow tests to choose a -std flag.
	* src/c++17/memory_resource.cc (bitset::get_first_unset()): Use local
	variables of the right types. Call update_next_word() unconditionally.
	* testsuite/20_util/unsynchronized_pool_resource/cons.cc: New test.
	* testsuite/performance/20_util/memory_resource/pools.cc: New test.
	* testsuite/util/testsuite_performance.h (time_counter): Allow
	timer to be restarted.

From-SVN: r266164
2018-11-15 00:04:19 +00:00
Jonathan Wakely aeb2b1f7fb Fix test that does undefined shifts greater than width of size_t
* testsuite/20_util/unsynchronized_pool_resource/allocate.cc: Fix
	test for 32-bit targets. Test additional allocation sizes.

From-SVN: r266163
2018-11-15 00:04:12 +00:00
Jonathan Wakely 78ef03b7c3 Add missing dir to create_testsuite_files script
* scripts/create_testsuite_files: Add special_functions to the list
	of directories to search. Add comment referring to conformance.exp.
	* testsuite/libstdc++-dg/conformance.exp: Add comment referring
	to create_testsuite_files.

From-SVN: r266146
2018-11-14 14:25:00 +00:00
Jonathan Wakely f2e005857e Improve handling of pool_options::largest_required_pool_block
Make the munge_options function round the largest_required_pool_block
value to a multiple of the smallest pool size (currently 8 bytes) to
avoid pools with odd sizes.

Ensure there is a pool large enough for blocks of the requested size.
Previously when largest_required_pool_block was exactly equal to one of
the pool_sizes[] values there would be no pool of that size. This patch
increases _M_npools by one, so there is a pool at least as large as the
requested value. It also reduces the size of the largest pool to be no
larger than needed.

	* src/c++17/memory_resource.cc (munge_options): Round up value of
	largest_required_pool_block to multiple of smallest pool size. Round
	excessively large values down to largest pool size.
	(select_num_pools): Increase number of pools by one unless it exactly
	matches requested largest_required_pool_block.
	(__pool_resource::_M_alloc_pools()): Make largest pool size equal
	largest_required_pool_block.
	* testsuite/20_util/unsynchronized_pool_resource/options.cc: Check
	that pool_options::largest_required_pool_block is set appropriately.

From-SVN: r266089
2018-11-13 22:57:53 +00:00
Jonathan Wakely d3306a84a6 Fix incorrect assertion when deallocating big block
Since a big_block rounds up the size to a multiple of big_block::min it
is wrong to assert that the supplied number of bytes equals the
big_block's size(). Add big_block::alloc_size(size_t) to calculate the
allocated size consistently, and add comments to the code.

	* src/c++17/memory_resource.cc (big_block): Improve comments.
	(big_block::all_ones): Remove.
	(big_block::big_block(size_t, size_t)): Use alloc_size.
	(big_block::size()): Add comment, replace all_ones with equivalent
	expression.
	(big_block::align()): Shift value of correct type.
	(big_block::alloc_size(size_t)): New function to round up size.
	(__pool_resource::allocate(size_t, size_t)): Add comment.
	(__pool_resource::deallocate(void*, size_t, size_t)): Likewise. Fix
	incorrect assertion by using big_block::alloc_size(size_t).
	* testsuite/20_util/unsynchronized_pool_resource/allocate.cc: Add
	more tests for unpooled allocations.

From-SVN: r266088
2018-11-13 22:57:48 +00:00
Jonathan Wakely 6bdd58f73a Fix overflows in std::pmr::unsynchonized_pool_resource
* src/c++17/memory_resource.cc (bitset::full()): Handle edge case
	for _M_next_word maximum value.
	(bitset::get_first_unset(), bitset::set(size_type)): Use
	update_next_word() to update _M_next_word.
	(bitset::update_next_word()): New function, avoiding wraparound of
	unsigned _M_next_word member.
	(bitset::max_word_index()): New function.
	(chunk::chunk(void*, uint32_t, void*, size_t)): Add assertion.
	(chunk::max_bytes_per_chunk()): New function.
	(pool::replenish(memory_resource*, const pool_options&)): Prevent
	_M_blocks_per_chunk from exceeding max_blocks_per_chunk or from
	causing chunk::max_bytes_per_chunk() to be exceeded.
	* testsuite/20_util/unsynchronized_pool_resource/allocate-max-chunks.cc:
	New test.

From-SVN: r266087
2018-11-13 22:57:44 +00:00
Jonathan Wakely 3d18dc9db0 Implement P0318R1 unwrap_ref_decay and unwrap_reference
Implement P0318R1 unwrap_ref_decay and unwrap_reference
	* include/std/type_traits (unwrap_reference, unwrap_reference_t)
	(unwrap_ref_decay, unwrap_ref_decay_t): New traits and aliases.
	* testsuite/20_util/unwrap_reference/1.cc: New test.
	* testsuite/20_util/unwrap_reference/2.cc: New test.

From-SVN: r266010
2018-11-11 05:17:03 +00:00
Jonathan Wakely 37b736f6bd Implement P1007R3 std::assume_aligned
Implement P1007R3 std::assume_aligned
	* include/std/memory (assume_aligned): Implement for C++17.
	* testsuite/20_util/assume_aligned/1.cc: New test.
	* testsuite/20_util/assume_aligned/2_neg.cc: New test.
	* testsuite/20_util/assume_aligned/3.cc: New test.

From-SVN: r266009
2018-11-11 05:16:51 +00:00
Jonathan Wakely 852a971c26 Implement std::pmr::unsynchronized_pool_resource
Implement std::pmr::unsynchronized_pool_resource
	* config/abi/pre/gnu.ver: Add new symbols.
	* include/std/memory_resource (std::pmr::__pool_resource): New class.
	(std::pmr::unsynchronized_pool_resource): New class.
	* src/c++17/Makefile.am: Add -fimplicit-templates to flags for
	memory_resource.cc
	* src/c++17/Makefile.in: Regenerate.
	* src/c++17/memory_resource.cc (bitset, chunk, big_block): New
	internal classes.
	(__pool_resource::_Pool): Define new class.
	(munge_options, pool_index, select_num_pools): New internal functions.
	(__pool_resource::__pool_resource, __pool_resource::~__pool_resource)
	(__pool_resource::allocate, __pool_resource::deallocate)
	(__pool_resource::_M_alloc_pools): Define member functions.
	(unsynchronized_pool_resource::unsynchronized_pool_resource)
	(unsynchronized_pool_resource::~unsynchronized_pool_resource)
	(unsynchronized_pool_resource::release)
	(unsynchronized_pool_resource::_M_find_pool)
	(unsynchronized_pool_resource::do_allocate)
	(unsynchronized_pool_resource::do_deallocate): Define member
	functions.
	* testsuite/20_util/unsynchronized_pool_resource/allocate.cc: New
	test.
	* testsuite/20_util/unsynchronized_pool_resource/is_equal.cc: New
	test.
	* testsuite/20_util/unsynchronized_pool_resource/options.cc: New
	test.
	* testsuite/20_util/unsynchronized_pool_resource/release.cc: New
	test.

From-SVN: r265853
2018-11-06 21:35:27 +00:00
Joseph Myers 22e0527251 Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856).
This patch updates GCC to use autoconf 2.69 and automake 1.15.1.
(That's not the latest automake version, but it's the one used by
binutils-gdb, with which consistency is desirable, and in any case
seems a useful incremental update that should make a future update to
1.16.1 easier.)

The changes are generally similar to the binutils-gdb ones, and are
copied from there where shared files and directories are involved
(there are some further changes to such shared directories, however,
which I'd expect to apply to binutils-gdb once this patch is in GCC).
Largely, obsolete AC_PREREQ calls are removed, while many
AC_LANG_SOURCE calls are added to avoid warnings from aclocal and
autoconf.  Multilib support is no longer included in core automake,
meaning that multilib.am needs copying from automake's contrib
directory into the GCC source tree.  Autoconf 2.69 has Go support, so
local copies of that support are removed.  I hope the D support will
soon be submitted to upstream autoconf so the local copy of that can
be removed in a future update.  Changes to how automake generates
runtest calls mean quotes are removed from RUNTEST definitions in five
lib*/testsuite/Makefile.am files (libatomic, libgomp, libitm,
libphobos, libvtv; some others have RUNTEST definitions without
quotes, which are still OK); libgo and libphobos also get
-Wno-override added to AM_INIT_AUTOMAKE so those overrides of RUNTEST
do not generate automake warnings.

Note that the regeneration did not include regeneration of
fixincludes/config.h.in (attempting such regeneration resulted in all
the USED_FOR_TARGET conditionals disappearing; and I don't see
anything in the fixincludes/ directory that would result in such
conditionals being generated, unlike in the gcc/ directory).  Also
note that libvtv/testsuite/other-tests/Makefile.in was not
regenerated; that directory is not listed as a subdirectory for which
Makefile.in gets regenerated by calling "automake" in libvtv/, so I'm
not sure how it's meant to be regenerated.

While I mostly fixed warnings should running aclocal / automake /
autoconf, there were various such warnings from automake in the
libgfortran, libgo, libgomp, liboffloadmic, libsanitizer, libphobos
directories that I did not fix, preferring to leave those to the
relevant subsystem maintainers.  Specifically, most of those warnings
were of the following form (example from libgfortran):

Makefile.am:48: warning: source file 'caf/single.c' is in a subdirectory,
Makefile.am:48: but option 'subdir-objects' is disabled
automake: warning: possible forward-incompatibility.
automake: At least a source file is in a subdirectory, but the 'subdir-objects'
automake: automake option hasn't been enabled.  For now, the corresponding output
automake: object file(s) will be placed in the top-level directory.  However,
automake: this behaviour will change in future Automake versions: they
will
automake: unconditionally cause object files to be placed in the same subdirectory
automake: of the corresponding sources.
automake: You are advised to start using 'subdir-objects' option throughout your
automake: project, to avoid future incompatibilities.

I think it's best for the relevant maintainers to add subdir-objects
and do any other associated Makefile.am changes needed.  In some cases
the paths in the warnings involved ../; I don't know if that adds any
extra complications to the use of subdir-objects.

I've tested this with native, cross and Canadian cross builds.  The
risk of any OS-specific issues should I hope be rather lower than if a
libtool upgrade were included (we *should* do such an upgrade at some
point, but it's more complicated - it involves identifying all our
local libtool changes to see if any aren't included in the upstream
version we update to, and reverting an upstream libtool patch that's
inappropriate for use in GCC); I think it would be better to get this
update into GCC so that people can test in different configurations
and we can fix any issues found, rather than to try to get more and
more testing done before it goes in.

top level:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* multilib.am: New file.  From automake.

	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* libtool.m4: Use AC_LANG_SOURCE.
	* configure.ac: Remove AC_PREREQ, use AC_LANG_SOURCE.
	* ar-lib: New file.
	* test-driver: New file.
	* configure: Re-generate.

config:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* math.m4, tls.m4: Use AC_LANG_SOURCE.

	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* override.m4 (_GCC_AUTOCONF_VERSION): Bump from 2.64 to 2.69.

fixincludes:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* aclocal.m4, configure: Regenerate.

gcc:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.  Use single
	line for second argument of AC_DEFINE_UNQUOTED.
	* doc/install.texi (Tools/packages necessary for modifying GCC):
	Update to autoconf 2.69 and automake 1.15.1.
	* aclocal.m4, config.in, configure: Regenerate.

gnattools:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* configure: Regenerate.

gotools:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* config/go.m4: Remove file.
	* Makefile.am (ACLOCAL_AMFLAGS): Do not use -I ./config.
	* configure.ac:  Remove AC_PREREQ.  Do not include config/go.m4.
	* Makefile.in, aclocal.m4, configure: Regenerate.

intl:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* configure.ac: Add AC_USE_SYSTEM_EXTENSIONS, remove AC_PREREQ.
	* configure: Re-generate.
	* config.h.in: Re-generate.
	* aclocal.m4: Re-generate.

libada:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* configure: Regenerate.

libatomic:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* acinclude.m4: Use AC_LANG_SOURCE.
	* configure.ac: Remove AC_PREREQ.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

libbacktrace:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.

libcc1:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure: Regenerate.

libcpp:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* aclocal.m4, config.in, configure: Regenerate.

libdecnumber:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* configure.ac: Remove AC_PREREQ.
	* configure: Re-generate.
	* aclocal.m4.

libffi:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	(AUTOMAKE_OPTIONS): Add info-in-builddir.
	(CLEANFILES): Remove doc/libffi.info.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure, fficonfig.h.in,
	include/Makefile.in, man/Makefile.in, testsuite/Makefile.in:
	Regenerate.

libgcc:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* configure: Regenerate.

libgfortran:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.

libgo [logically part of this change but omitted from the commit]:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* config/go.m4: Remove file.
	* config/libtool.m4: Use AC_LANG_SOURCE.
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.  Use
	-Wno-override in AM_INIT_AUTOMAKE call.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

libgomp:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am
	(AUTOMAKE_OPTIONS): Add info-in-builddir.
	(CLEANFILES): Remove libgomp.info.
	* configure.ac: Remove AC_PREREQ.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

libhsail-rt:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure: Regenerate.

libiberty:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* configure.ac: Remove AC_PREREQ.
	* configure: Re-generate.
	* config.in: Re-generate.

libitm:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	(AUTOMAKE_OPTIONS): Add info-in-builddir.
	(CLEANFILES): Remove libitm.info.
	* configure.ac: Remove AC_PREREQ.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

libobjc:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.
	* aclocal.m4, config.h.in, configure: Regenerate.

liboffloadmic:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.
	* plugin/Makefile.am: Include multilib.am.
	* plugin/configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure, plugin/Makefile.in,
	plugin/aclocal.m4, plugin/configure: Regenerate.

libphobos:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.  Use -Wno-override in
	AM_INIT_AUTOMAKE call.
	* m4/autoconf.m4: Add extra argument to AC_LANG_DEFINE call.
	* m4/druntime/os.m4: Use AC_LANG_SOURCE.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, libdruntime/Makefile.in,
	src/Makefile.in, testsuite/Makefile.in: Regenerate.

libquadmath:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	(AUTOMAKE_OPTIONS): Remove 1.8.  Add info-in-builddir.
	(all-local): Define outside conditional code.
	(CLEANFILES): Remove libquadmath.info.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.

libsanitizer:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* Makefile.in, aclocal.m4, asan/Makefile.in, configure,
	interception/Makefile.in, libbacktrace/Makefile.in,
	lsan/Makefile.in, sanitizer_common/Makefile.in, tsan/Makefile.in,
	ubsan/Makefile.in: Regenerate.

libssp:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	(AUTOMAKE_OPTIONS): Remove 1.9.5.
	* configure.ac: Remove AC_PREREQ.  Quote argument to
	AC_RUN_IFELSE.
	* Makefile.in, aclocal.m4, configure: Regenerate.

libstdc++-v3:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.
	* Makefile.in, aclocal.m4, configure, doc/Makefile.in,
	include/Makefile.in, libsupc++/Makefile.in, po/Makefile.in,
	python/Makefile.in, src/Makefile.in, src/c++11/Makefile.in,
	src/c++17/Makefile.in, src/c++98/Makefile.in,
	src/filesystem/Makefile.in, testsuite/Makefile.in: Regenerate.

libvtv:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.
	* configure.ac: Remove AC_PREREQ.
	* testsuite/Makefile.am (RUNTEST): Remove quotes.
	* Makefile.in, aclocal.m4, configure, testsuite/Makefile.in:
	Regenerate.

lto-plugin:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* configure.ac: Remove AC_PREREQ.  Use AC_LANG_SOURCE.
	* Makefile.in, aclocal.m4, config.h.in, configure: Regenerate.

zlib:
2018-10-31  Joseph Myers  <joseph@codesourcery.com>

	PR bootstrap/82856
	* Makefile.am: Include multilib.am.

	Merge from binutils-gdb:
	2018-06-19  Simon Marchi  <simon.marchi@ericsson.com>

	* configure.ac: Modernize AC_INIT call, remove AC_PREREQ.
	* Makefile.am (AUTOMAKE_OPTIONS): Remove 1.8, cygnus, add foreign.
	* Makefile.in: Re-generate.
	* aclocal.m4: Re-generate.
	* configure: Re-generate.

From-SVN: r265695
2018-10-31 17:03:16 +00:00
Jonathan Wakely d5e33619bf More testing for std::pair layout change
* testsuite/20_util/pair/87822.cc: Test deeper nesting.

From-SVN: r265680
2018-10-31 12:58:45 +00:00
Jonathan Wakely 0db78d0a5e PR libstdc++/87822 fix layout change for nested std::pair
The introduction of the empty __pair_base base class for PR 86751
changed the layout of std::pair<std::pair<...>, ...>. The outer pair and
its first member both have a base class of the same type, which cannot
exist at the same address. This causes the first member to be at a
non-zero offset.

The solution is to make the base class depend on the template
parameters, so that each pair type has a different base class type,
which allows the base classes of the outer pair and its first member to
have the same address.

	PR libstdc++/87822
	* include/bits/stl_pair.h (__pair_base): Change to class template.
	(pair): Make base class type depend on template parameters.
	* testsuite/20_util/pair/87822.cc: New test.

From-SVN: r265678
2018-10-31 12:29:02 +00:00
Marek Polacek b5ff4f5c0d Implement P0892R2, explicit(bool).
* c-cppbuiltin.c (c_cpp_builtins): Define __cpp_explicit_bool.

	* call.c (add_template_candidate_real): Return if the declaration is
	explicit and we're only looking for non-converting constructor.
	* cp-tree.h (lang_decl_fn): Add has_dependent_explicit_spec_p bit.
	(DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P): New macro.
	(cp_decl_specifier_seq): Add explicit_specifier field.
	(build_explicit_specifier, store_explicit_specifier): Declare.
	* decl.c (grokdeclarator): Call store_explicit_specifier.
	(build_explicit_specifier): New function.
	* parser.c (cp_parser_function_specifier_opt) <case RID_EXPLICIT>:
	Parse C++20 explicit(bool).
	* pt.c (store_explicit_specifier, lookup_explicit_specifier): New.
	(tsubst_function_decl): Handle explicit(dependent-expr).

	* g++.dg/cpp2a/explicit1.C: New test.
	* g++.dg/cpp2a/explicit10.C: New test.
	* g++.dg/cpp2a/explicit11.C: New test.
	* g++.dg/cpp2a/explicit12.C: New test.
	* g++.dg/cpp2a/explicit13.C: New test.
	* g++.dg/cpp2a/explicit2.C: New test.
	* g++.dg/cpp2a/explicit3.C: New test.
	* g++.dg/cpp2a/explicit4.C: New test.
	* g++.dg/cpp2a/explicit5.C: New test.
	* g++.dg/cpp2a/explicit6.C: New test.
	* g++.dg/cpp2a/explicit7.C: New test.
	* g++.dg/cpp2a/explicit8.C: New test.
	* g++.dg/cpp2a/explicit9.C: New test.

	* testsuite/20_util/any/cons/explicit.cc: Adjust dg-error.
	* testsuite/20_util/pair/cons/explicit_construct.cc: Likewise.
	* testsuite/20_util/tuple/cons/explicit_construct.cc: Likewise.

From-SVN: r265641
2018-10-30 19:59:41 +00:00
Jonathan Wakely 0321d9fac6 PR libstdc++/87809 avoid invalid expressions in exception specifications
If the allocator isn't default constructible then checking if the
default constructor throws in an exception specification makes the
declaration invalid. Use the type trait instead.

	PR libstdc++/87809
	* include/bits/forward_list.h (_Fwd_list_impl::_Fwd_list_impl()): Use
	trait in exception-specification instead of possibly invalid
	expression.
	* include/bits/stl_bvector.h (_Bvector_impl::_Bvector_impl()):
	Likewise.
	* include/bits/stl_list.h (_List_impl::_List_impl()): Likewise.
	* include/bits/stl_vector.h (_Vector_impl::_Vector_impl()): Likewise.
	* testsuite/23_containers/forward_list/cons/87809.cc: New test.
	* testsuite/23_containers/list/cons/87809.cc: New test.
	* testsuite/23_containers/vector/bool/cons/87809.cc: New test.
	* testsuite/23_containers/vector/cons/87809.cc: New test.

From-SVN: r265626
2018-10-30 14:49:43 +00:00
Jonathan Wakely c397f267f1 PR libstdc++/87784 fix dynamic_bitset::push_back
Previously the _M_Nb member was incremented before calling
_M_unchecked_set which meant that the bit being set was out of bounds.
It either set the wrong bit in an allocated word, or accessed beyond the
end of the allocated memory in the _M_w vector. The fix for the bug is
to update the _M_Nb member after using it as an index.

As an optimisation, when a new block needs to be appended the call to
_M_unchecked_set can be avoided by appending a block with the least
significant bit already set to the desired value.

	PR libstdc++/87784
	* include/tr2/dynamic_bitset (dynamic_bitset::push_back): When there
	are no unused bits in the last block, append a new block with the
	right value so the bit doesn't need to be set. Only increment size
	after setting the new bit, not before.
	* testsuite/tr2/dynamic_bitset/pr87784.cc: New test.

From-SVN: r265625
2018-10-30 14:49:32 +00:00
David Malcolm 7e2de6df10 C++: simplify output from suggest_alternatives_for
In the C++ FE, after emitting various errors about unrecognized names,
the parser can call
  suggest_alternatives_for
and/or
  suggest_alternative_in_explicit_scope.
These can issue zero or more suggestions for the unrecognized name,
or various other "note" diagnostics suggesting how to fix the problem.

For example, currently g++ emits:

t.cc:12:3: error: 'gtk_widget_showall' was not declared in this scope
12 |   gtk_widget_showall (w);
   |   ^~~~~~~~~~~~~~~~~~
t.cc:12:3: note: suggested alternative: 'gtk_widget_show_all'
12 |   gtk_widget_showall (w);
   |   ^~~~~~~~~~~~~~~~~~
   |   gtk_widget_show_all

This patch consolidates the common case when there is a single
candidate, so that the error can issue a fix-it hint directly.

This simplifies the above to:

t.cc:12:3: error: 'gtk_widget_showall' was not declared in this scope;
 did you mean 'gtk_widget_show_all'?
12 |   gtk_widget_showall (w);
   |   ^~~~~~~~~~~~~~~~~~
   |   gtk_widget_show_all

omitting the second "note" diagnostic.

Doing so requires changing the above "suggest_" functions so that
rather than being called after "error" and emitting a note directly,
they are called before the "error", and return a name_hint, which
can contain a suggestion and/or a deferred diagnostic.  The "single
candidate" case is handled via a suggestion, and the "multiple
candidates" case via a new subclass of deferred_diagnostic.

There was some complication due to the fact that we don't always have
enough location information to issue a fix-it hint.  Specifically,
for the case in qualified_name_lookup_error, the location is that of
the name, but the location of the qualifier prefix isn't reliably
available.  For some hints, e.g. spell-corrections, the replacement
is of the name, and for others, e.g. parent namespaces, it's for the
qualified name.  The patch addresses this by splitting this case out
into a new "suggest_alternatives_in_other_namespaces" function, for
which fix-it hints aren't issued.

Another complication is that of emitting a note when
  --param cxx-max-namespaces-for-diagnostic-help
is reached.  The patch emulates the existing behavior by emitting
the note from a deferred_diagnostic.  This potentially needs to
co-exist with another deferred_diagnostic, so it works as a decorator
around any other such deferred_diagnostic.  Doing so requires slightly
extending class name_hint.

On adding test coverage for the various cases, I discovered that
after emitting a "FOO is not a namespace-name" error, we also emit
a "expected namespace-name before" error.  The patch removes this
second error for the case where it's redundant, simplifying this case
from e.g.:

spellcheck-ns.C:10:24: error: 'inner_ms' is not a namespace-name
10 | using namespace outer::inner_ms;
   |                        ^~~~~~~~
spellcheck-ns.C:10:24: note: suggested alternative: 'inner_ns'
10 | using namespace outer::inner_ms;
   |                        ^~~~~~~~
   |                        inner_ns
spellcheck-ns.C:10:32: error: expected namespace-name before ';' token
10 | using namespace outer::inner_ms;
   |                                ^

to:

spellcheck-ns.C:10:24: error: 'inner_ms' is not a namespace-name;
 did you mean 'inner_ns'?
10 | using namespace outer::inner_ms;
   |                        ^~~~~~~~
   |                        inner_ns

include/ChangeLog:
	* unique-ptr.h (gnu::move): Generalize so it applies to all
	lvalue references, rather than just to unique_ptr values.

gcc/c-family/ChangeLog:
	* name-hint.h (name_hint::take_deferred): New member function.

gcc/c/ChangeLog:
	* c-decl.c (implicit_decl_warning): Update "is there a suggestion"
	logic for change to name_hint::operator bool.
	(undeclared_variable): Likewise.
	* c-parser.c (c_parser_declaration_or_fndef): Likewise.
	(c_parser_parameter_declaration): Likewise.

gcc/cp/ChangeLog:
	* cp-name-hint.h: New file.
	* cp-tree.h (expr_to_string): New decl.
	(suggest_alternatives_for): Move to cp-name-hint.h, changing
	return type from bool to name_hint.
	(suggest_alternative_in_explicit_scope): Likewise.
	* error.c: Define INCLUDE_UNIQUE_PTR.  Include "cp-name-hint.h".
	(expr_to_string): Make non-static.
	(qualified_name_lookup_error): For the non-"::" case, take
	responsibity for issuing any suggestion from
	suggest_alternative_in_explicit_scope, as it changes from
	returning a bool to returning a name_hint.  Replace fallback call
	to suggest_alternatives_for to a call to
	suggest_alternatives_in_other_namespaces, capturing the fact that
	we don't have enough location information to issue a fix-it hint
	for this case.  Update the error to support emitting a fix-it hint
	where appropriate.  For the "::" case, take responsibility for
	issuing any suggestion from suggest_alternatives_for, supporting
	emitting a fix-it hint.
	* lex.c: Define INCLUDE_UNIQUE_PTR.  Include "gcc-rich-location.h"
	and "cp-name-hint.h".
	(unqualified_name_lookup_error): Take responsibility for issuing
	any suggestion from suggest_alternatives_for, supporting emitting
	a fix-it hint.
	* name-lookup.c (class namespace_limit_reached): New subclass of
	deferred_diagnostic.
	(class show_candidate_location): Likewise.
	(class suggest_alternatives): Likewise.
	(class namespace_hints): New class.
	(suggest_alternatives_for): Convert return type from bool to
	name_hint, replacing all direct diagnostic emission by setting
	suggestions on the return value, or creating deferred diagnostics.
	Specifically, split out initial traversal of namespaces into
	namespace_hints' ctor, and maybe_decorate_with_limit, and move the
	rest of the implementation to
	namespace_hints::convert_candidates_to_name_hint and
	suggest_alternatives_for_1.
	(namespace_hints::namespace_hints): New ctor, adapted from
	suggest_alternatives_for's initial namespace traversal, storing
	location and name, and converting locals "candidates", "limited"
	and "limit" into members.
	(namespace_hints::convert_candidates_to_name_hint): New member
	function.
	(namespace_hints::maybe_decorate_with_limit): New member function.
	(suggest_alternatives_for_1): New function, based on second half
	of old implementation of suggest_alternatives_for, converting from
	immediate emission of suggestions to using name_hint.
	(suggest_alternatives_in_other_namespaces): New function.
	(maybe_suggest_missing_std_header): Convert from immediate
	emission of suggestions to using name_hint, moving emission
	implementation to...
	(class missing_std_header): New subclass of deferred_diagnostic.
	(maybe_suggest_missing_header): Convert return type from bool to
	name_hint.
	(suggest_alternative_in_explicit_scope): Convert from immediate
	emission of suggestions to using name_hint.
	* parser.c: Replace include of "c-family/name-hint.h" with
	"cp-name-hint.h".
	(cp_parser_diagnose_invalid_type_name): Update
	"is there a suggestion" logic for change to
	name_hint::operator bool.  Take responsibility for emitting
	fix-it hints from suggest_alternative_in_explicit_scope.
	(cp_parser_namespace_name): Take responsibility for emitting
	fix-it hints from suggest_alternative_in_explicit_scope.  Don't
	emit the "expected namespace-name" error if we've already emitted
	an "is not a namespace-name" error.

gcc/testsuite/ChangeLog:
	* c-c++-common/spellcheck-reserved.c: Update expected output for
	C++ for merger of "did you mean" suggestions into the error
	message.
	* g++.dg/ext/builtin3.C: Update expected output for merger of "did
	you mean" suggestion into the error.
	* g++.dg/lookup/error1.C: Likewise.
	* g++.dg/lookup/pr77549.C: Likewise.
	* g++.dg/lookup/pr80913.C: Likewise.
	* g++.dg/lookup/suggestions1.C: Likewise.
	* g++.dg/lookup/suggestions2.C: New test.
	* g++.dg/overload/koenig1.C: Update expected output as above.
	* g++.dg/spellcheck-identifiers-2.C: Likewise.
	* g++.dg/spellcheck-identifiers.C: Likewise.
	* g++.dg/spellcheck-ns.C: New test.
	* g++.dg/spellcheck-pr77829.C: Update expected output as above.
	* g++.dg/spellcheck-pr78656.C: Likewise.
	* g++.dg/spellcheck-pr79298.C: Likewise, adding
	-fdiagnostics-show-caret to options.
	* g++.dg/spellcheck-pr80177.C: Likewise.
	* g++.dg/spellcheck-single-vs-multiple.C: New test.
	* g++.dg/spellcheck-typenames.C: Update expected output as above.
	* g++.dg/template/static10.C: Likewise.
	* g++.old-deja/g++.mike/ns5.C: Likewise.
	* g++.old-deja/g++.mike/ns7.C: Likewise.
	* g++.old-deja/g++.ns/koenig5.C: Likewise.
	* g++.old-deja/g++.other/lineno5.C: Likewise.

libstdc++-v3/ChangeLog:
	* testsuite/17_intro/using_namespace_std_exp_neg.cc: Remove
	"expected namespace-name before" error.
	* testsuite/17_intro/using_namespace_std_tr1_neg.cc: Likewise.

From-SVN: r265610
2018-10-29 23:53:50 +00:00
François Dumont 881eaae688 48101_neg.cc: Remove dg-prune-output 'std' from regex pattern for versioned namespace...
2018-10-28  François Dumont  <fdumont@gcc.gnu.org>

	* testsuite/23_containers/deque/48101_neg.cc: Remove dg-prune-output
	'std' from regex pattern for versioned namespace compatibility.
	* testsuite/23_containers/vector/48101_neg.cc: Likewise.
	* testsuite/27_io/filesystem/path/io/dr2989.cc: Likewise.

From-SVN: r265575
2018-10-28 20:57:04 +00:00
Jonathan Wakely 71e093897c PR libstdc++/87749 fix (and optimize) string move construction
The move constructor for the SSO string uses assign(const basic_string&)
when either:

(1) the source string is "local" and so the contents of the small string
buffer need to be copied, or

(2) the allocator does not propagate and is_always_equal is false.

Case (1) is suboptimal, because the assign member is not noexcept and
the compiler isn't smart enough to see it won't actually throw in this
case. This causes extra code in the move assignment operator so that any
exception will be turned into a call to std::terminate. This can be
fixed by copying small strings inline instead of calling assign.

Case (2) is a bug, because the specific instances of the allocators
could be equal even if is_always_equal is false. This can result in an
unnecessary deep copy (and potentially-throwing allocation) when the
storage should be moved. This can be fixed by simply checking if the
allocators are equal.

	PR libstdc++/87749
	* include/bits/basic_string.h [_GLIBCXX_USE_CXX11_ABI]
	(basic_string::operator=(basic_string&&)): For short strings copy the
	buffer inline. Only fall back to using assign(const basic_string&) to
	do a deep copy when reallocation is needed.
	* testsuite/21_strings/basic_string/modifiers/assign/char/87749.cc:
	New test.
	* testsuite/21_strings/basic_string/modifiers/assign/char/
	move_assign_optim.cc: New test.
	* testsuite/21_strings/basic_string/modifiers/assign/wchar_t/87749.cc:
	New test.
	* testsuite/21_strings/basic_string/modifiers/assign/wchar_t/
	move_assign_optim.cc: New test.

From-SVN: r265493
2018-10-25 16:34:04 +01:00
Marc Glisse 0f317ef762 Relocation (= move+destroy)
2018-10-25  Marc Glisse  <marc.glisse@inria.fr>

	PR libstdc++/87106
	* include/bits/alloc_traits.h (_S_construct, _S_destroy, construct,
	destroy): Add noexcept specification.
	* include/bits/allocator.h (construct, destroy): Likewise.
	* include/ext/alloc_traits.h (construct, destroy): Likewise.
	* include/ext/malloc_allocator.h (construct, destroy): Likewise.
	* include/ext/new_allocator.h (construct, destroy): Likewise.
	* include/bits/stl_uninitialized.h (__relocate_object_a, __relocate_a,
	__relocate_a_1): New functions.
	(__is_trivially_relocatable): New class.
	* include/bits/stl_vector.h (__use_relocate): New static member.
	* include/bits/vector.tcc (reserve, _M_realloc_insert,
	_M_default_append): Use __relocate_a.
	(reserve, _M_assign_aux, _M_realloc_insert, _M_fill_insert,
	_M_default_append, _M_range_insert): Move _GLIBCXX_ASAN_ANNOTATE_REINIT
	after _Destroy.
	* testsuite/23_containers/vector/modifiers/push_back/49836.cc:
	Replace CopyConsOnlyType with DelAnyAssign.

From-SVN: r265485
2018-10-25 13:03:13 +00:00
Jonathan Wakely c3ba63c314 PR libstdc++/87704 fix unique_ptr(nullptr_t) constructors
Using a delegating constructor to implement these constructors means
that they instantiate the destructor, which requires the element_type to
be complete. In C++11 and C++14 they were specified to be delegating,
but that was changed as part of LWG 2801 so in C++17 they don't require
a complete type (as was intended all along).

	PR libstdc++/87704
	* include/bits/unique_ptr.h (unique_ptr::unique_ptr(nullptr_t)): Do
	not delegate to default constructor.
	(unique_ptr<T[], D>::unique_ptr(nullptr_t)): Likewise.
	* testsuite/20_util/unique_ptr/cons/incomplete.cc: New test.

From-SVN: r265423
2018-10-23 14:10:26 +01:00
François Dumont f65c0c735e testsuite_containers.h (forward_members_unordered<>::forward_members_unordered (const value_type&)): Add local_iterator pre and post increment checks.
2018-10-20  François Dumont  <fdumont@gcc.gnu.org>

	* testsuite/util/testsuite_containers.h
	(forward_members_unordered<>::forward_members_unordered
	(const value_type&)): Add local_iterator pre and post increment checks.
	* config/abi/pre/gnu.ver: Add GLIBCXX_3.4.26 new symbol.

From-SVN: r265344
2018-10-20 20:00:45 +00:00
Jonathan Wakely f324588755 Skip tests for GNU extensions when testing with strict mode
Tests for the implicit allocator rebinding extension will fail if the
extension is disabled, so skip them.

	* testsuite/23_containers/array/requirements/explicit_instantiation/
	3.cc: Skip test when compiled with a -std=c++NN strict mode.
	* testsuite/23_containers/deque/requirements/explicit_instantiation/
	3.cc: Likewise.
	* testsuite/23_containers/forward_list/requirements/
	explicit_instantiation/3.cc: Likewise.
	* testsuite/23_containers/list/requirements/explicit_instantiation/
	3.cc: Likewise.
	* testsuite/23_containers/map/requirements/explicit_instantiation/
	3.cc: Likewise.
	* testsuite/23_containers/multimap/requirements/explicit_instantiation/
	3.cc: Likewise.
	* testsuite/23_containers/multiset/requirements/explicit_instantiation/
	3.cc: Likewise.
	* testsuite/23_containers/set/requirements/explicit_instantiation/
	3.cc: Likewise.
	* testsuite/23_containers/unordered_map/requirements/
	explicit_instantiation/3.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/requirements/
	explicit_instantiation/3.cc: Likewise.
	* testsuite/23_containers/unordered_multiset/requirements/
	explicit_instantiation/3.cc: Likewise.
	* testsuite/23_containers/unordered_set/requirements/
	explicit_instantiation/3.cc: Likewise.
	* testsuite/23_containers/vector/ext_pointer/explicit_instantiation/
	3.cc: Likewise.
	* testsuite/23_containers/vector/requirements/explicit_instantiation/
	3.cc: Likewise.

From-SVN: r265334
2018-10-19 22:50:15 +01:00
Jonathan Wakely 92bab15297 Fix testsuite failures due to extra errors in strict dialects
When __STRICT_ANSI__ is defined the incorrect allocators used in these
tests also trigger and additional static assertion. Prune those extra
errors so that the tests don't fail when built with strict dialects.

	* testsuite/23_containers/deque/48101_neg.cc: Prune additional errors
	printed when __STRICT_ANSI__ is defined.
	* testsuite/23_containers/forward_list/48101_neg.cc: Likewise.
	* testsuite/23_containers/list/48101_neg.cc: Likewise.
	* testsuite/23_containers/multiset/48101_neg.cc: Likewise.
	* testsuite/23_containers/set/48101_neg.cc: Likewise.
	* testsuite/23_containers/unordered_multiset/48101_neg.cc: Likewise.
	* testsuite/23_containers/unordered_set/48101_neg.cc: Likewise.
	* testsuite/23_containers/vector/48101_neg.cc: Likewise.

From-SVN: r265333
2018-10-19 22:50:03 +01:00
Jonathan Wakely f8f3939037 Conditionally disable tests of non-standard extensions
These tests include uses of the extension to allow allocators with the
wrong value_type in containers. Skip those parts of the tests when
__STRICT_ANIS__ is defined.

	* testsuite/23_containers/forward_list/requirements/
	explicit_instantiation/5.cc [__STRICT_ANSI__]: Don't test non-standard
	extension.
	* testsuite/23_containers/list/requirements/explicit_instantiation/
	5.cc [__STRICT_ANSI__]: Likewise.
	* testsuite/23_containers/map/requirements/explicit_instantiation/5.cc
	[__STRICT_ANSI__]: Likewise.
	* testsuite/23_containers/multimap/requirements/explicit_instantiation/
	5.cc [__STRICT_ANSI__]: Likewise.
	* testsuite/23_containers/multiset/requirements/explicit_instantiation/
	5.cc [__STRICT_ANSI__]: Likewise.
	* testsuite/23_containers/set/requirements/explicit_instantiation/5.cc
	[__STRICT_ANSI__]: Likewise.
	* testsuite/23_containers/unordered_map/requirements/debug_container.cc
	[__STRICT_ANSI__]: Likewise.
	* testsuite/23_containers/unordered_map/requirements/
	explicit_instantiation/5.cc [__STRICT_ANSI__]: Likewise.
	* testsuite/23_containers/unordered_multimap/requirements/
	explicit_instantiation/5.cc [__STRICT_ANSI__]: Likewise.
	* testsuite/23_containers/unordered_multiset/requirements/
	explicit_instantiation/5.cc [__STRICT_ANSI__]: Likewise.
	* testsuite/23_containers/unordered_set/requirements/
	explicit_instantiation/5.cc [__STRICT_ANSI__]: Likewise.

From-SVN: r265332
2018-10-19 22:49:49 +01:00
Jonathan Wakely 78ed0f80c3 Fix tests that use allocators with incorrect value types
As a GNU extension we allow containers to be instantiated with
allocators that use a different value type from the container, and
automatically rebind the allocator to the correct type. This extension
is disabled in strict modes (when __STRICT_ANSI__ is defined, i.e.
-std=c++NN dialects). These testcases unintentionally rely on the
extension and so fail for strict modes.

Tests which intentionally make use of the extension will still fail in
strict dialects, but will be addressed in a later change.

	* testsuite/20_util/scoped_allocator/1.cc: Use allocator with correct
	value type for the container.
	* testsuite/23_containers/forward_list/cons/14.cc: Likewise.
	* testsuite/23_containers/map/56613.cc: Likewise.
	* testsuite/23_containers/unordered_map/55043.cc: Likewise.
	* testsuite/23_containers/unordered_map/allocator/copy.cc: Likewise.
	* testsuite/23_containers/unordered_map/allocator/copy_assign.cc:
	Likewise.
	* testsuite/23_containers/unordered_map/allocator/minimal.cc:
	Likewise.
	* testsuite/23_containers/unordered_map/allocator/move.cc: Likewise.
	* testsuite/23_containers/unordered_map/allocator/move_assign.cc:
	Likewise.
	* testsuite/23_containers/unordered_map/allocator/noexcept.cc:
	Likewise.
	* testsuite/23_containers/unordered_map/cons/81891.cc: Likewise.
	* testsuite/23_containers/unordered_map/requirements/exception/
	basic.cc: Likewise.
	* testsuite/23_containers/unordered_map/requirements/exception/
	generation_prohibited.cc: Likewise.
	* testsuite/23_containers/unordered_map/requirements/exception/
	propagation_consistent.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/55043.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/allocator/copy.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/allocator/copy_assign.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/allocator/minimal.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/allocator/move.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/allocator/move_assign.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/allocator/noexcept.cc:
	Likewise.
	* testsuite/23_containers/unordered_multimap/requirements/exception/
	basic.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/requirements/exception/
	generation_prohibited.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/requirements/exception/
	propagation_consistent.cc: Likewise.
	* testsuite/23_containers/unordered_multimap/requirements/
	explicit_instantiation/5.cc: Likewise.
	* testsuite/ext/malloc_allocator/sanity.cc: Likewise.

From-SVN: r265331
2018-10-19 22:49:40 +01:00
Jonathan Wakely e7f2d0bdb5 Disable tests that only pass for GNU dialects
The airy and hypergeometric functions are non-standard extensions and
are only defined for -std=gnu++NN dialects, not -std=c++NN ones.

	* ext/special_functions/airy_ai/check_nan.cc: Skip test for
	non-standard extension when a strict -std=c++NN dialect is used.
	* ext/special_functions/airy_ai/check_value.cc: Likewise.
	* ext/special_functions/airy_ai/compile.cc: Likewise.
	* ext/special_functions/airy_bi/check_nan.cc: Likewise.
	* ext/special_functions/airy_bi/check_value.cc: Likewise.
	* ext/special_functions/airy_bi/compile.cc: Likewise.
	* ext/special_functions/conf_hyperg/check_nan.cc: Likewise.
	* ext/special_functions/conf_hyperg/check_value.cc: Likewise.
	* ext/special_functions/conf_hyperg/compile.cc: Likewise.
	* ext/special_functions/hyperg/check_nan.cc: Likewise.
	* ext/special_functions/hyperg/check_value.cc: Likewise.
	* ext/special_functions/hyperg/compile.cc: Likewise.

From-SVN: r265330
2018-10-19 22:49:32 +01:00
Jonathan Wakely 88412b71ee Remove duplicate tests
These tests originally existed to check the containers in C++11 mode,
when the default was C++98 mode. Now that the default is C++14 (and we
run most tests for all modes) it serves no purpose to have two copies of
the tests when neither is explicitly using -std=gnu++98 anyway.

	* testsuite/23_containers/list/requirements/explicit_instantiation/
	5_c++0x.cc: Remove redundant test that is functionally identical to
	the 5.cc test.
	* testsuite/23_containers/map/requirements/explicit_instantiation/
	5_c++0x.cc: Likewise.
	* testsuite/23_containers/multimap/requirements/explicit_instantiation/
	5_c++0x.cc: Likewise.
	* testsuite/23_containers/multiset/requirements/explicit_instantiation/
	5_c++0x.cc: Likewise.
	* testsuite/23_containers/set/requirements/explicit_instantiation/
	5_c++0x.cc: Likewise.

From-SVN: r265329
2018-10-19 22:49:19 +01:00
Jonathan Wakely 30f7c08d96 Fix compilation error with _GLIBCXX_PARALLEL
* include/bits/regex_executor.tcc (_Backref_matcher::_M_apply): Use
	_GLIBCXX_STD_A to refer to normal mode algorithms.
	* testsuite/28_regex/headers/regex/parallel_mode.cc: New test.
	* testsuite/28_regex/headers/regex/std_c++0x_neg.cc: Remove empty
	whitespace.

From-SVN: r265314
2018-10-19 14:46:24 +01:00
Jonathan Wakely 955fe731e3 Fix tests that fail when built with different options
* testsuite/20_util/duration/cons/2.cc: Add -ffloat-store to fix
	failure when compiled without optimisation.
	* testsuite/ext/profile/mutex_extensions_neg.cc: Prune additional
	errors caused by C++17 std::pmr alias templates.

From-SVN: r265287
2018-10-18 21:04:55 +01:00
Jonathan Wakely fab2c75b73 PR libstdc++/87641 correctly initialize accumulator in valarray::sum()
Use the value of the first element as the initial value of the
__valarray_sum accumulator. Value-initialization might not create the
additive identity for the value type.

Make a similar change to __valarray_product even though it's only ever
used internally with a value_type of size_t.

	PR libstdc++/87641
	* include/bits/valarray_array.h (__valarray_sum): Use first element
	to initialize accumulator instead of value-initializing it.
	(__valarray_product<_Tp>): Move to ...
	* src/c++98/valarray.cc (__valarray_product<_Tp>): Here. Use first
	element to initialize accumulator.
	(__valarray_product(const valarray<size_t>&)): Remove const_cast made
	unnecessary by LWG 389.
	* testsuite/26_numerics/valarray/87641.cc: New test.

From-SVN: r265270
2018-10-18 16:38:50 +01:00
Ville Voutilainen 4026227f21 re PR libstdc++/87619 (sizeof(std::variant) can be reduced if its variant_size is UCHAR_MAX)
PR libstdc++/87619

* include/std/variant (__select_index): Fix an off-by-one.
* testsuite/20_util/variant/87619.cc: New.

From-SVN: r265247
2018-10-17 22:08:51 +03:00
Jonathan Wakely 436ea0e5d3 Rename namespace alias in test to avoid name collision
* testsuite/experimental/net/internet/address/v4/creation.cc: Do not
	declare ip in global namespace, to avoid collision with struct ip
	defined in <netinet/ip.h>.

From-SVN: r265205
2018-10-16 17:13:00 +01:00
Jonathan Wakely 7e8b87e901 Use effective target in Networking TS tests
* testsuite/experimental/net/headers.cc: Remove dg-options.
	* testsuite/experimental/net/buffer/arithmetic.cc: Replace dg-options
	with dg-do using effective target.
	* testsuite/experimental/net/buffer/const.cc: Likewise.
	* testsuite/experimental/net/buffer/creation.cc: Likewise.
	* testsuite/experimental/net/buffer/mutable.cc: Likewise.
	* testsuite/experimental/net/buffer/size.cc: Likewise.
	* testsuite/experimental/net/buffer/traits.cc: Likewise.
	* testsuite/experimental/net/execution_context/use_service.cc:
	Likewise.
	* testsuite/experimental/net/internet/address/v4/comparisons.cc:
	Likewise.
	* testsuite/experimental/net/internet/address/v4/cons.cc: Likewise.
	* testsuite/experimental/net/internet/address/v4/creation.cc:
	Likewise.
	* testsuite/experimental/net/internet/address/v4/members.cc: Likewise.
	* testsuite/experimental/net/internet/resolver/base.cc: Likewise.
	* testsuite/experimental/net/internet/resolver/ops/lookup.cc:
	Likewise.
	* testsuite/experimental/net/internet/resolver/ops/reverse.cc:
	Likewise.
	* testsuite/experimental/net/timer/waitable/cons.cc: Likewise.
	* testsuite/experimental/net/timer/waitable/dest.cc: Likewise.
	* testsuite/experimental/net/timer/waitable/ops.cc: Likewise.

From-SVN: r265200
2018-10-16 16:37:10 +01:00
Jonathan Wakely 5ae2c32a8a Define _GLIBCXX_USE_DEV_RANDOM as replacement for _GLIBCXX_USE_RANDOM_TR1
Define and use a new macro with a more descriptive name. Only use the
old macro in <tr1/random.h>.

	* acinclude.m4 (GLIBCXX_CHECK_RANDOM_TR1): Replace with ...
	(GLIBCXX_CHECK_DEV_RANDOM): New macro with more descriptive name.
	Define _GLIBCXX_USE_DEV_RANDOM as well as _GLIBCXX_USE_RANDOM_TR1.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Use GLIBCXX_CHECK_DEV_RANDOM instead of
	GLIBCXX_CHECK_RANDOM_TR1.
	crossconfig.m4: Likewise.
	* include/bits/random.h (random_device): Use _GLIBCXX_USE_DEV_RANDOM
	instead of _GLIBCXX_USE_RANDOM_TR1.
	* testsuite/26_numerics/random/random_device/cons/token.cc: Likewise.

From-SVN: r265197
2018-10-16 15:49:29 +01:00
Rainer Orth 630f2da967 Introduce dg-add-options net_ts
* testsuite/lib/dg-options.exp (add_options_for_net_ts): New proc.
	* testsuite/experimental/net/internet/address/v4/comparisons.cc:
	Add dg-add-options net_ts.
	* testsuite/experimental/net/internet/address/v4/cons.cc: Likewise.
	* testsuite/experimental/net/internet/address/v4/creation.cc: Likewise.
	* testsuite/experimental/net/internet/address/v4/members.cc: Likewise.
	* testsuite/experimental/net/internet/resolver/base.cc: Likewise.
	* testsuite/experimental/net/internet/resolver/ops/lookup.cc: Likewise.
	* testsuite/experimental/net/internet/resolver/ops/reverse.cc: Likewise.

From-SVN: r265192
2018-10-16 12:27:52 +00:00
Jonathan Wakely b57d432bdd Fix tests that fail when compiled without optimisation
* testsuite/20_util/duration/literals/range_neg.cc: Adjust pruned
	diagnostic to account for quotes around 'constexpr'.
	* testsuite/23_containers/deque/capacity/max_size.cc: Define static
	variable.
	* testsuite/23_containers/vector/capacity/max_size.cc: Likewise.

From-SVN: r265190
2018-10-16 13:06:05 +01:00
Jonathan Wakely d30096b45f PR libstdc++/87618 fix typos in linker script
PR libstdc++/87618
	* config/abi/pre/gnu.ver: Fix typos in patterns for basic_stringbuf.
	* testsuite/27_io/basic_stringbuf/cons/char/default.cc: Disable
	optimisation to check constructor definition can be linked to.
	* testsuite/27_io/basic_stringbuf/cons/wchar_t/default.cc: Likewise.

From-SVN: r265188
2018-10-16 12:14:37 +01:00