Commit Graph

682 Commits

Author SHA1 Message Date
Jakub Jelinek
7adcbafe45 Update copyright years. 2022-01-03 10:42:10 +01:00
Jonathan Wakely
a219139e98 libstdc++: Implement std::ios_base::noreplace for C++23 [PR59769]
This implements my P2467R0 proposal to support opening an fstream in
exclusive mode. The new constant is also supported pre-C++23 as
std::ios_base::__noreplace.

This proposal hasn't been approved for C++23 yet, but I am confident it
will be, as this is restoring a feture found in pre-ISO C++ iostreams
implementations (and still present in the MSVC library as _Noreplace).
If the proposal fails for C++23 we can remove the ios::noreplace
name and just keep ios::__noreplace as an extension.

libstdc++-v3/ChangeLog:

	PR libstdc++/59769
	* config/io/basic_file_stdio.cc (fopen_mode): Add support for
	exclusive mode.
	* include/bits/ios_base.h (_S_noreplace): Define new enumerator.
	(ios_base::__noreplace): Define.
	(ios_base::noreplace): Define for C++23.
	* include/std/version (__cpp_lib_ios_noreplace): Define.
	* testsuite/27_io/basic_ofstream/open/char/noreplace.cc: New test.
	* testsuite/27_io/basic_ofstream/open/wchar_t/noreplace.cc: New test.
2021-12-09 22:59:48 +00:00
Jonathan Wakely
0a12bd92d1 libstdc++: Fix dg-do directive for tests supposed to be run
libstdc++-v3/ChangeLog:

	* testsuite/23_containers/unordered_map/modifiers/move_assign.cc:
	Change dg-do compile to run.
	* testsuite/27_io/basic_istream/extractors_character/wchar_t/lwg2499.cc:
	Likewise.
2021-11-26 15:11:58 +00:00
Jonathan Wakely
a04b73e15b libstdc++: Replace hyphens in effective target keywords
An effective target like foo-bar-baz will match a target selector of
*-*-* and cause problems in the testsuite. Several libstdc++ et keywords
are of the form foo-bar, which could still be a problem for *-*
selectors.

Replace hyphens with underscores in the et keywords "debug-mode",
"cxx11-abi", etc.

libstdc++-v3/ChangeLog:

	* testsuite/lib/libstdc++.exp: Rename effective target keywords
	to avoid dashes in the name.
	* testsuite/*: Update effective targe keywords.
2021-11-24 13:20:26 +00:00
Jonathan Wakely
be08d57317 libstdc++: Improve tests for stringstream constructors in C++20
This ensures all constructors are checked.

libstdc++-v3/ChangeLog:

	* testsuite/27_io/basic_istringstream/cons/char/1.cc: Check all
	constructors.
	* testsuite/27_io/basic_istringstream/cons/wchar_t/1.cc:
	Likewise.
	* testsuite/27_io/basic_ostringstream/cons/char/1.cc: Likewise.
	* testsuite/27_io/basic_ostringstream/cons/wchar_t/1.cc:
	Likewise.
	* testsuite/27_io/basic_stringstream/cons/char/1.cc: Likewise.
	* testsuite/27_io/basic_stringstream/cons/wchar_t/1.cc:
	Likewise.
2021-11-19 20:23:50 +00:00
Jonathan Wakely
a30a2e43e4 libstdc++: Implement std::spanstream for C++23
This implements the <spanstream> header, as proposed for C++23 by P0448R4.

libstdc++-v3/ChangeLog:

	* include/Makefile.am: Add spanstream header.
	* include/Makefile.in: Regenerate.
	* include/precompiled/stdc++.h: Add spanstream header.
	* include/std/version (__cpp_lib_spanstream): Define.
	* include/std/spanstream: New file.
	* testsuite/27_io/spanstream/1.cc: New test.
	* testsuite/27_io/spanstream/version.cc: New test.
2021-11-13 11:45:31 +00:00
Martin Sebor
9a27acc30a Make full use of context-sensitive ranges in access warnings.
gcc/ChangeLog:

	* builtins.c (check_strncat_sizes): Pass access_data ctor additional
	arguments.
	(expand_builtin_memcmp): Move code to gimple-ssa-warn-access.cc.
	(expand_builtin_fork_or_exec): Same.
	* gimple-array-bounds.cc (array_bounds_checker::check_mem_ref): Pass
	compute_objsize additional arguments.
	(inbounds_memaccess_p): Same.
	(array_bounds_checker::check_array_bounds): Add an assert.  Stash
	statement in a member.
	(check_array_bounds_dom_walker::before_dom_children): Same.
	* gimple-array-bounds.h (array_bounds_checker::m_stmt): New member.
	* gimple-ssa-sprintf.c (get_destination_size): Add an argument.
	(handle_printf_call): Pass a new argument.
	* gimple-ssa-warn-access.cc (get_size_range): Add an argument.
	(check_access): Add an argument and pass it along to callees.
	(check_read_access): Make a member function.
	(pass_waccess::check_strcat): Pass access_data ctor additional
	arguments.
	(pass_waccess::check_strncat): Same.
	(pass_waccess::check_stxcpy): Same.
	(pass_waccess::check_stxncpy): Same.
	(pass_waccess::check_strncmp): Same.
	(pass_waccess::check_read_access): Same.
	(pass_waccess::check_builtin): Same.
	(pass_waccess::maybe_check_access_sizes): Same.
	(pass_waccess::maybe_check_dealloc_call): Same.
	* gimple-ssa-warn-access.h (check_read_access): Declare a new
	member function.
	* pointer-query.cc (compute_objsize_r): Add an argument.
	(gimple_call_return_array): Same.
	(gimple_call_alloc_size): Same.
	(access_ref::access_ref): Same.
	(access_ref::get_ref): Same.
	(pointer_query::get_ref): Same.
	(handle_min_max_size): Pass an arguments to callees.
	(handle_array_ref): Add an argument.
	(handle_mem_ref): Same.
	(compute_objsize): Same.
	* pointer-query.h (struct access_ref): Adjust signatures.
	(struct access_data): Same.
	(gimple_call_alloc_size): Add an argument.
	(gimple_parm_array_size): Same.
	(compute_objsize): Same.
	* tree-ssa-strlen.c (strlen_pass::adjust_last_stmt): Pass an additional
	argument to compute_objsize.
	(strlen_pass::maybe_warn_overflow): Same.
	(maybe_diag_stxncpy_trunc): Same.

gcc/testsuite/ChangeLog:

	* gcc.dg/Wstringop-overflow-22.c: Correct typos.
	* gcc.dg/Wstringop-overflow-81.c: New test.

libstdc++-v3/ChangeLog:

	* testsuite/21_strings/basic_string/capacity/1.cc: Also suppress
	-Wstringop-overread.
	* testsuite/27_io/filesystem/path/factory/u8path-char8_t.cc: Same.
2021-10-26 16:53:23 -06:00
Jonathan Wakely
ce55693604 libstdc++: Rename files with the wrong extensions
libstdc++-v3/ChangeLog:

	* testsuite/27_io/filesystem/path/construct/102592.C: Moved to...
	* testsuite/27_io/filesystem/path/construct/102592.cc: ...here.
	* testsuite/28_regex/match_results/102667.C: Moved to...
	* testsuite/28_regex/match_results/102667.cc: ...here.
2021-10-13 22:35:14 +01:00
Jonathan Wakely
85b24e32dc libstdc++: Fix dangling string_view in filesystem::path [PR102592]
When creating a path from a pair of non-contiguous iterators we pass the
iterators to _S_convert(Iter, Iter). That function passes the iterators
to __string_from_range to get a contiguous sequence of characters, and
then calls _S_convert(const C*, const C*) to perform the encoding
conversions. If the value type, C, is char8_t, then no conversion is
needed and the _S_convert<char8_t>(const char8_t*, const char8_t*)
specialization casts the pointer to const char* and returns a
std::string_view that refs to the char8_t sequence. However, that
sequence is owned by the std::u8string rvalue returned by
__string_from_range, which goes out of scope when _S_convert(Iter, Iter)
returns. That means the std::string_view is dangling and we get
undefined behaviour when parsing it as a path.

The same problem does not exist for the path members taking a "Source"
argument, because those functions all convert a non-contiguous range
into a basic_string<C> immediately, using __effective_range(__source).
That means that the rvalue string returned by that function is still in
scope for the full expression, so the string_view does not dangle.

The solution for the buggy functions is to do the same thing, and call
__string_from_range immediately, so that the returned rvalue is still in
scope for the lifetime of the string_view returned by _S_convert. To
avoid reintroducing the same problem, remove the _S_convert(Iter, Iter)
overload that calls __string_from_range and returns a dangling view.

libstdc++-v3/ChangeLog:

	PR libstdc++/102592
	* include/bits/fs_path.h (path::path(Iter, Iter, format))
	(path::append(Iter, Iter), path::concat(Iter, Iter)): Call
	__string_from_range directly, instead of two-argument overload
	of _S_convert.
	(path::_S_convert(Iter, Iter)): Remove.
	* testsuite/27_io/filesystem/path/construct/102592.C: New test.
2021-10-13 20:36:51 +01:00
Jonathan Wakely
cfeff094e6 libstdc++: Move test that depends on wchar_t I/O to wchar_t sub-directory
This fixes a FAIL when --disable-wchar_t is used.

libstdc++-v3/ChangeLog:

	* testsuite/27_io/basic_filebuf/close/81256.cc: Moved to...
	* testsuite/27_io/basic_filebuf/close/wchar_t/81256.cc: ...here.
2021-10-09 00:57:48 +01:00
Jonathan Wakely
43e2a44182 libstdc++: Add missing _GLIBCXX_USE_WCHAR_T checks in testsuite
These tests fail for a --disable-wchar_t build.

libstdc++-v3/ChangeLog:

	* testsuite/22_locale/conversions/buffer/1.cc: Check
	_GLIBCXX_USE_WCHAR_T.
	* testsuite/22_locale/conversions/buffer/3.cc: Likewise. Add
	test using char16_t.
	* testsuite/22_locale/conversions/string/1.cc: Check
	_GLIBCXX_USE_WCHAR_T.
	* testsuite/27_io/filesystem/path/generic/generic_string.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/modifiers/make_preferred.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/native/alloc.cc: Likewise.
	* testsuite/27_io/filesystem/path/native/string-char8_t.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/native/string.cc: Likewise.
	* testsuite/28_regex/algorithms/regex_match/extended/wstring_locale.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/generic/generic_string.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/native/alloc.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/native/string-char8_t.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/native/string.cc:
	Likewise.
2021-10-09 00:57:48 +01:00
Jonathan Wakely
313193edfc libstdc++: Improve test for printing volatile pointers
libstdc++-v3/ChangeLog:

	* testsuite/27_io/basic_ostream/inserters_other/char/volatile_ptr.cc:
	Check result matches non-volatile pointer.
2021-10-05 15:56:55 +01:00
Jonathan Wakely
96955a82f0 libstdc++: Support printing volatile pointers (P1147R1)
To avoid needing to export a new symbol from the library (for now) the
new member function uses __attribute__((always_inline)).

libstdc++-v3/ChangeLog:

	* include/std/ostream (operator<<(const volatile void*)):
	Add new overload, as per P1147R1.
	* testsuite/27_io/basic_ostream/inserters_other/char/volatile_ptr.cc:
	New test.
2021-10-05 09:35:47 +01:00
Jonathan Wakely
749c31b345 libstdc++: Rename tests with incorrect extension
The libstdc++ testsuite only runs .cc files, so these two old tests have
never been run.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/valarray/dr630-3.C: Moved to...
	* testsuite/26_numerics/valarray/dr630-3.cc: ...here.
	* testsuite/27_io/basic_iostream/cons/16251.C: Moved to...
	* testsuite/27_io/basic_iostream/cons/16251.cc: ...here.
2021-09-17 12:40:41 +01:00
Jonathan Wakely
29b2fd371f libstdc++: Skip filesystem tests that depend on permissions [PR90787]
Tests that depend on filesystem permissions FAIL if run on Windows or as
root. Add a helper function to detect those cases, so the tests can skip
those checks gracefully.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/90787
	* testsuite/27_io/filesystem/iterators/directory_iterator.cc:
	Use new __gnu_test::permissions_are_testable() function.
	* testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc:
	Likewise.
	* testsuite/27_io/filesystem/operations/exists.cc: Likewise.
	* testsuite/27_io/filesystem/operations/is_empty.cc: Likewise.
	* testsuite/27_io/filesystem/operations/remove.cc: Likewise.
	* testsuite/27_io/filesystem/operations/remove_all.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/experimental/filesystem/iterators/directory_iterator.cc:
	Likewise.
	* testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/exists.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/is_empty.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/remove.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/remove_all.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
	Likewise.
	* testsuite/util/testsuite_fs.h (__gnu_test::permissions_are_testable):
	New function to guess whether testing permissions will work.
2021-08-20 15:15:22 +01:00
Jonathan Wakely
3dbd4d94bf libstdc++: Use secure_getenv for filesystem::temp_directory_path() [PR65018]
This adds a configure check for the GNU extension secure_getenv and then
uses it for looking up TMPDIR and similar variables.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/65018
	* configure.ac: Check for secure_getenv.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* src/filesystem/ops-common.h (get_temp_directory_from_env): New
	helper function to obtain path from the environment.
	* src/c++17/fs_ops.cc (fs::temp_directory_path): Use new helper.
	* src/filesystem/ops.cc (fs::temp_directory_path): Likewise.
	* testsuite/27_io/filesystem/operations/temp_directory_path.cc:
	Print messages if test cannot be run.
	* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
	Likewise. Fix incorrect condition. Use "TMP" to work with
	Windows as well as POSIX.
2021-07-30 18:12:39 +01:00
Jonathan Wakely
124eaa50e0 libstdc++: Fix create_directories to resolve symlinks [PR101510]
When filesystem__create_directories checks to see if the path already
exists and resovles to a directory, it uses filesystem::symlink_status,
which means it reports an error if the path is a symlink. It should use
filesystem::status, so that the target directory is detected, and no
error is reported.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/101510
	* src/c++17/fs_ops.cc (fs::create_directories): Use status
	instead of symlink_status.
	* src/filesystem/ops.cc (fs::create_directories): Likewise.
	* testsuite/27_io/filesystem/operations/create_directories.cc:
	* testsuite/27_io/filesystem/operations/create_directory.cc: Do
	not test with symlinks on Windows.
	* testsuite/experimental/filesystem/operations/create_directories.cc:
	* testsuite/experimental/filesystem/operations/create_directory.cc:
	Do not test with symlinks on Windows.
2021-07-20 20:34:47 +01:00
Jonathan Wakely
0c4ae4ff46 libstdc++: Add more tests for filesystem::create_directory [PR101510]
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	PR libstdc++/101510
	* src/c++17/fs_ops.cc (create_dir): Adjust whitespace.
	* testsuite/27_io/filesystem/operations/create_directory.cc:
	Test creating directory with name of existing symlink to
	directory.
	* testsuite/experimental/filesystem/operations/create_directory.cc:
	Likewise.
2021-07-20 12:54:30 +01:00
Jonathan Wakely
e5c422b7d8 libstdc++: Implement LWG 415 for std::ws
For C++11 std::ws changed to be an unformatted input function, meaning
it constructs a sentry and sets badbit on exceptions.

libstdc++-v3/ChangeLog:

	* doc/xml/manual/intro.xml: Document LWG 415 change.
	* doc/html/manual/bugs.html: Regenerate.
	* include/bits/istream.tcc (ws): Create sentry and catch
	exceptions.
	* testsuite/27_io/basic_istream/ws/char/lwg415.cc: New test.
	* testsuite/27_io/basic_istream/ws/wchar_t/lwg415.cc: New test.
2021-06-28 13:34:49 +01:00
Jonathan Wakely
f8c5b542f6 libstdc++: Implement LWG 581 for std:ostream::flush()
LWG 581 changed ostream::flush() to an unformatted output function for
C++11, but it was never implemented in libstdc++.

libstdc++-v3/ChangeLog:

	* doc/xml/manual/intro.xml: Document LWG 581 change.
	* doc/html/manual/bugs.html: Regenerate.
	* include/bits/basic_ios.tcc: Whitespace.
	* include/bits/ostream.tcc (basic_ostream::flush()): Construct
	sentry.
	* testsuite/27_io/basic_ostream/flush/char/2.cc: Check
	additional cases.
	* testsuite/27_io/basic_ostream/flush/char/exceptions_badbit_throw.cc:
	Likewise.
	* testsuite/27_io/basic_ostream/flush/wchar_t/2.cc: Likewise.
	* testsuite/27_io/basic_ostream/flush/wchar_t/exceptions_badbit_throw.cc:
	Likewise.
2021-06-25 18:47:39 +01:00
Jonathan Wakely
9b6c65c754 libstdc++: Fix exception handling in std::ostream seek functions
N3168 added the requirement that the [ostream.seeks] functions create a
sentry object. Nothing in the requirements of those functions says
anything about catching exceptions and setting badbit.

As well as not catching exceptions, this change results in another
observable behaviour change. Previously seeking on a stream with eofbit
set would work (as long as badbit and failbit weren't set). The
construction of a sentry causes failbit to be set when eofbit is set,
which causes the seek to fail. It is necessary to clear the eofbit
before seeking now.

libstdc++-v3/ChangeLog:

	* include/bits/ostream.tcc (sentry): Only set failbit if badbit
	is set, not if eofbit is set.
	(tellp, seekp, seekp): Create sentry object. Do not set badbit
	on exceptions.
	* testsuite/27_io/basic_ostream/seekp/char/exceptions_badbit_throw.cc:
	Adjust expected behaviour.
	* testsuite/27_io/basic_ostream/seekp/wchar_t/exceptions_badbit_throw.cc:
	Likewise.
	* testsuite/27_io/basic_ostream/tellp/char/exceptions_badbit_throw.cc:
	Likewise.
	* testsuite/27_io/basic_ostream/tellp/wchar_t/exceptions_badbit_throw.cc:
	Likewise.
	* testsuite/27_io/basic_ostream/seekp/char/n3168.cc: New test.
	* testsuite/27_io/basic_ostream/seekp/wchar_t/n3168.cc: New test.
	* testsuite/27_io/basic_ostream/tellp/char/n3168.cc: New test.
	* testsuite/27_io/basic_ostream/tellp/wchar_t/n3168.cc: New test.
2021-06-25 18:47:23 +01:00
Jonathan Wakely
1e690757d3 libstdc++: Fix filesystem::path comparisons for C++23
In C++23 there is a basic_string_view(Range&&) constructor, which is
constrained to take a range (specifically, a contiguous_range). When the
filesystem::path comparison operators call lhs.compare(rhs) the overload
taking a string_view is considered, which means checking whether path
satisfies the range concept. That satisfaction result changes depending
whether path::iterator is complete, which is ill-formed; no diagnostic
required. To avoid the problem, this change ensures that the overload
resolution is performed in a context where path::iterator is complete
and the range concept is satisfied. (The result of overload resolution
is always that the compare(const path&) overload is the best match, but
we still have to consider the compare(basic_string_view<value_type>) one
to decide if it even participates in overload resolution).

For std::filesystem::path we can't define the comparison operators later
in the file, because they are hidden friends, so a new helper is
introduced that gets defined when everything else is complete.

For std::experimental::filesystem::path we can just move the definitions
of the comparison operators later in the file.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/bits/fs_path.h (operator==, operator<=>): Use new
	_S_compare function.
	(path::_S_compare): New function to call path::compare in a
	context where path::iterator is complete.
	* include/experimental/bits/fs_path.h (operator<, operator==):
	Define after path::iterator is complete.
	* testsuite/27_io/filesystem/path/native/conv_c++23.cc: New
	test.
	* testsuite/experimental/filesystem/path/native/conv_c++23.cc:
	New test.
2021-06-11 19:18:11 +01:00
Jonathan Wakely
45aa7a4476 libstdc++: Fix filesystem::path constraints for volatile [PR 100630]
The constraint check for filesystem::path construction uses
decltype(__is_path_src(declval<Source>())) which mean it considers
conversion from an rvalue.  When Source is a volatile-qualified type
it cannot use is_path_src(const Unknown&) because a const lvalue
reference can only bind to a non-volatile rvalue.

Since the relevant path members all have a const Source& parameter,
the constraint should be defined in terms of declval<const Source&>(),
not declval<Source>(). This avoids the problem of volatile-qualified
rvalues, because we no longer use an rvalue at all.

libstdc++-v3/ChangeLog:

	PR libstdc++/100630
	* include/experimental/bits/fs_path.h (__is_constructible_from):
	Test construction from a const lvalue, not an rvalue.
	* testsuite/27_io/filesystem/path/construct/100630.cc: New test.
	* testsuite/experimental/filesystem/path/construct/100630.cc:
	New test.
2021-05-17 17:58:46 +01:00
Jonathan Wakely
0498d2d09a libstdc++: Remove redundant -std=gnu++17 option from remaining tests
GCC defaults to -std=gnu++17 now anyway, and using it explicitly in the
dg-options directive prevents running these tests with different modes
such as -std=c++17 or -std=gnu++20.

libstdc++-v3/ChangeLog:

	* testsuite/17_intro/headers/c++2017/all_attributes.cc: Remove
	-std=gnu++17 from dg-options directive.
	* testsuite/17_intro/headers/c++2017/all_no_exceptions.cc:
	Likewise.
	* testsuite/17_intro/headers/c++2017/all_pedantic_errors.cc:
	Likewise.
	* testsuite/17_intro/headers/c++2017/operator_names.cc:
	Likewise.
	* testsuite/17_intro/headers/c++2017/parallel_mode.cc: Likewise.
	* testsuite/17_intro/headers/c++2017/stdc++.cc: Likewise.
	* testsuite/17_intro/headers/c++2017/stdc++_multiple_inclusion.cc:
	Likewise.
	* testsuite/18_support/aligned_alloc/aligned_alloc.cc: Likewise.
	* testsuite/18_support/byte/81076.cc: Likewise.
	* testsuite/18_support/byte/global_neg.cc: Likewise.
	* testsuite/18_support/byte/ops.cc: Likewise.
	* testsuite/18_support/byte/requirements.cc: Likewise.
	* testsuite/18_support/headers/cfloat/values_c++17.cc: Likewise.
	* testsuite/18_support/launder/1.cc: Likewise.
	* testsuite/18_support/launder/nodiscard.cc: Likewise.
	* testsuite/18_support/launder/requirements.cc: Likewise.
	* testsuite/18_support/launder/requirements_neg.cc: Likewise.
	* testsuite/18_support/new_aligned.cc: Likewise.
	* testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc:
	Likewise.
	* testsuite/19_diagnostics/error_code/is_error_code_v.cc:
	Likewise.
	* testsuite/19_diagnostics/error_condition/hash.cc: Likewise.
	* testsuite/20_util/addressof/requirements/constexpr.cc:
	Likewise.
	* testsuite/20_util/as_const/1.cc: Likewise.
	* testsuite/20_util/as_const/rvalue_neg.cc: Likewise.
	* testsuite/20_util/bind/83427.cc: Likewise.
	* testsuite/20_util/bind/is_placeholder_v.cc: Likewise.
	* testsuite/20_util/bool_constant/requirements.cc: Likewise.
	* testsuite/20_util/duration/arithmetic/constexpr_c++17.cc:
	Likewise.
	* testsuite/20_util/duration/requirements/treat_as_floating_point_v.cc:
	Likewise.
	* testsuite/20_util/duration_cast/rounding.cc: Likewise.
	* testsuite/20_util/enable_shared_from_this/members/weak_from_this.cc:
	Likewise.
	* testsuite/20_util/from_chars/1_neg.cc: Likewise.
	* testsuite/20_util/from_chars/requirements.cc: Likewise.
	* testsuite/20_util/function/91456.cc: Likewise.
	* testsuite/20_util/function/cons/deduction.cc: Likewise.
	* testsuite/20_util/function_objects/83607.cc: Likewise.
	* testsuite/20_util/function_objects/invoke/59768.cc: Likewise.
	* testsuite/20_util/function_objects/mem_fn/80478.cc: Likewise.
	* testsuite/20_util/function_objects/not_fn/1.cc: Likewise.
	* testsuite/20_util/function_objects/not_fn/87538.cc: Likewise.
	* testsuite/20_util/has_unique_object_representations/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/has_unique_object_representations/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/has_unique_object_representations/value.cc:
	Likewise.
	* testsuite/20_util/hash/nullptr.cc: Likewise.
	* testsuite/20_util/in_place/requirements.cc: Likewise.
	* testsuite/20_util/is_aggregate/incomplete_neg.cc: Likewise.
	* testsuite/20_util/is_aggregate/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_aggregate/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/is_aggregate/value.cc: Likewise.
	* testsuite/20_util/is_invocable/83395.cc: Likewise.
	* testsuite/20_util/is_invocable/91456.cc: Likewise.
	* testsuite/20_util/is_invocable/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_invocable/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/is_invocable/value.cc: Likewise.
	* testsuite/20_util/is_literal_type/deprecated-1z.cc: Likewise.
	* testsuite/20_util/is_nothrow_constructible/94003.cc: Likewise.
	* testsuite/20_util/is_nothrow_invocable/83395.cc: Likewise.
	* testsuite/20_util/is_nothrow_invocable/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_nothrow_invocable/requirements/typedefs.cc: Likewise.
	* testsuite/20_util/is_nothrow_invocable/value.cc: Likewise.
	* testsuite/20_util/is_nothrow_swappable/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_nothrow_swappable/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/is_nothrow_swappable/value.cc: Likewise.
	* testsuite/20_util/is_nothrow_swappable_with/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_nothrow_swappable_with/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/is_nothrow_swappable_with/value.cc:
	Likewise.
	* testsuite/20_util/is_swappable/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_swappable/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/is_swappable/value.cc: Likewise.
	* testsuite/20_util/is_swappable_with/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/is_swappable_with/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/is_swappable_with/value.cc: Likewise.
	* testsuite/20_util/logical_traits/83134.cc: Likewise.
	* testsuite/20_util/logical_traits/requirements/explicit_instantiation.cc:
	Likewise.
	* testsuite/20_util/logical_traits/requirements/typedefs.cc:
	Likewise.
	* testsuite/20_util/logical_traits/value.cc: Likewise.
	* testsuite/20_util/pair/cons/deduction.cc: Likewise.
	* testsuite/20_util/pair/swap_cxx17.cc: Likewise.
	* testsuite/20_util/ratio/requirements/ratio_equal_v.cc:
	Likewise.
	* testsuite/20_util/reference_wrapper/83427.cc: Likewise.
	* testsuite/20_util/reference_wrapper/deduction.cc: Likewise.
	* testsuite/20_util/shared_ptr/casts/reinterpret.cc: Likewise.
	* testsuite/20_util/shared_ptr/cons/deduction.cc: Likewise.
	* testsuite/20_util/shared_ptr/requirements/weak_type.cc:
	Likewise.
	* testsuite/20_util/time_point/arithmetic/constexpr.cc:
	Likewise.
	* testsuite/20_util/time_point_cast/rounding.cc: Likewise.
	* testsuite/20_util/to_chars/3.cc: Likewise.
	* testsuite/20_util/to_chars/chars_format.cc: Likewise.
	* testsuite/20_util/to_chars/lwg3266.cc: Likewise.
	* testsuite/20_util/to_chars/requirements.cc: Likewise.
	* testsuite/20_util/tuple/78939.cc: Likewise.
	* testsuite/20_util/tuple/apply/1.cc: Likewise.
	* testsuite/20_util/tuple/apply/2.cc: Likewise.
	* testsuite/20_util/tuple/cons/deduction.cc: Likewise.
	* testsuite/20_util/tuple/make_from_tuple/1.cc: Likewise.
	* testsuite/20_util/tuple/make_from_tuple/2.cc: Likewise.
	* testsuite/20_util/tuple/swap_cxx17.cc: Likewise.
	* testsuite/20_util/tuple/tuple_size_v.cc: Likewise.
	* testsuite/20_util/unique_ptr/cons/deduction_neg.cc: Likewise.
	* testsuite/20_util/uses_allocator/requirements/uses_allocator_v.cc:
	Likewise.
	* testsuite/20_util/variable_templates_for_traits.cc: Likewise.
	* testsuite/20_util/void_t/1.cc: Likewise.
	* testsuite/20_util/weak_ptr/cons/deduction.cc: Likewise.
	* testsuite/24_iterators/container_access.cc: Likewise.
	* testsuite/24_iterators/headers/iterator/range_access_c++17.cc:
	Likewise.
	* testsuite/24_iterators/headers/iterator/synopsis_c++17.cc:
	Likewise.
	* testsuite/24_iterators/range_access/range_access_cpp17.cc:
	Likewise.
	* testsuite/24_iterators/range_access/range_access_cpp17_neg.cc:
	Likewise.
	* testsuite/26_numerics/gcd/gcd_neg.cc: Likewise.
	* testsuite/26_numerics/headers/cmath/functions_std_c++17.cc:
	Likewise.
	* testsuite/26_numerics/headers/cmath/hypot.cc: Likewise.
	* testsuite/26_numerics/headers/cmath/special_functions_global.cc:
	Likewise.
	* testsuite/26_numerics/lcm/1.cc: Likewise.
	* testsuite/26_numerics/lcm/lcm_neg.cc: Likewise.
	* testsuite/26_numerics/valarray/deduction.cc: Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/char/lwg2221.cc:
	Likewise.
	* testsuite/27_io/manipulators/standard/char/quoted_sv.cc:
	Likewise.
	* testsuite/27_io/manipulators/standard/wchar_t/quoted_sv.cc:
	Likewise.
	* testsuite/27_io/types/4.cc: Likewise.
	* testsuite/28_regex/basic_regex/ctors/deduction.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/91997.cc: Likewise.
	* testsuite/libstdc++-prettyprinters/cxx17.cc: Likewise.
2021-05-10 16:22:54 +01:00
Jonathan Wakely
aa60ff1c88 libstdc++: Remove redundant -std=gnu++17 options from filesystem tests
GCC defaults to -std=gnu++17 now anyway, and using it explicitly in the
dg-options directive prevents running these tests with different modes
such as -std=c++17 or -std=gnu++20.

libstdc++-v3/ChangeLog:

	* testsuite/27_io/basic_filebuf/open/char/path.cc: Remove
	-std=gnu++17 from dg-options directive.
	* testsuite/27_io/basic_fstream/cons/char/path.cc: Likewise.
	* testsuite/27_io/basic_fstream/open/char/path.cc: Likewise.
	* testsuite/27_io/basic_ifstream/cons/char/path.cc: Likewise.
	* testsuite/27_io/basic_ifstream/open/char/path.cc: Likewise.
	* testsuite/27_io/basic_ofstream/cons/char/path.cc: Likewise.
	* testsuite/27_io/basic_ofstream/open/char/path.cc: Likewise.
	* testsuite/27_io/filesystem/directory_entry/86597.cc: Likewise.
	* 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/91067.cc: Likewise.
	* testsuite/27_io/filesystem/iterators/caching.cc: Likewise.
	* testsuite/27_io/filesystem/iterators/directory_iterator.cc:
	Likewise.
	* testsuite/27_io/filesystem/iterators/pop.cc: Likewise.
	* testsuite/27_io/filesystem/iterators/recursion_pending.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/all.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/rename.cc: Likewise.
	* testsuite/27_io/filesystem/operations/resize_file.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.
	* testsuite/27_io/filesystem/path/append/path.cc: Likewise.
	* 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/92853.cc: Likewise.
	* testsuite/27_io/filesystem/path/concat/94063.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/90281.cc: Likewise.
	* testsuite/27_io/filesystem/path/construct/90634.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/factory/u8path-char8_t.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/factory/u8path.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/94242.cc: Likewise.
	* testsuite/27_io/filesystem/path/generic/generic_string.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/generic/utf.cc: Likewise.
	* testsuite/27_io/filesystem/path/generic/wchar_t.cc: Likewise.
	* testsuite/27_io/filesystem/path/io/dr2989.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/alloc.cc: Likewise.
	* testsuite/27_io/filesystem/path/native/string-char8_t.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/cmp.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/empty_neg.cc:
	* 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.
	* testsuite/experimental/filesystem/path/construct/string_view.cc:
	Likewise.
2021-05-10 16:22:53 +01:00
Jonathan Wakely
23972128c8 libstdc++: Adjust expected errors in tests when compiled as C++20
libstdc++-v3/ChangeLog:

	* testsuite/20_util/scoped_allocator/69293_neg.cc: Add dg-error
	for additional errors in C++20.
	* testsuite/20_util/specialized_algorithms/memory_management_tools/destroy_neg.cc:
	Likewise.
	* testsuite/20_util/uses_allocator/69293_neg.cc: Likewise.
	* testsuite/27_io/filesystem/path/io/dr2989.cc: Likewise.
2021-05-10 15:54:43 +01:00
Jonathan Wakely
a87ceadf17 libstdc++: Fix constraints for rvalue stream insertion/extraction
The __rval_streamable() function was an attempt to test for
convertibility cheaply and without confusing diagnostics. It doesn't
work with Clang though, and is probably ill-formed.

Replace that helper function with a check for derivation from ios_base,
and use that in the alias templates __rvalue_stream_insertion_t and
__rvalue_stream_extraction_t. Use concepts for the constraints when
available.

libstdc++-v3/ChangeLog:

	* include/std/istream (__rvalue_stream_extraction_t): Replace
	use of __rval_streamable.
	* include/std/ostream (__rvalue_stream_insertion_t): Likewise.
	(__rval_streamable): Remove.
	(_Require_derived_from_ios_base, __derived_from_ios_base): New
	helper for checking constraints.
	* testsuite/27_io/basic_istream/extractors_other/char/4.cc: Fix
	reference to the wrong subclause of the standard.
	* testsuite/27_io/basic_istream/extractors_other/wchar_t/4.cc:
	Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/char/6.cc:
	Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/wchar_t/6.cc:
	Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/char/99692.cc:
	New test.
	* testsuite/27_io/filesystem/path/io/dr2989.cc: Adjust pruned
	errors.
2021-05-07 23:45:52 +01:00
Jonathan Wakely
aa475c4ac8 libstdc++: Implement LWG 1203 for rvalue iostreams
This implements the resolution of LWG 1203 so that the constraints for
rvalue stream insertion/extraction are simpler, and the return type is
the original rvalue stream type not its base class.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* include/std/istream (operator>>(Istream&&, x&)): Simplify, as
	per LWG 1203.
	* include/std/ostream (operator<<(Ostream&&, const x&)):
	Likewise.
	* testsuite/27_io/basic_istream/extractors_character/char/lwg2499_neg.cc:
	Adjust dg-error pattern.
	* testsuite/27_io/basic_istream/extractors_character/wchar_t/lwg2499_neg.cc:
	Likewise.
	* testsuite/27_io/basic_istream/extractors_other/char/4.cc: Define
	is_extractable trait to replace std::__is_extractable. Make it
	work with rvalue streams as well as lvalues, to replace f() and
	g() helper functions.
	* testsuite/27_io/basic_istream/extractors_other/wchar_t/4.cc:
	Likewise.
	* testsuite/27_io/basic_ostream/inserters_other/char/6.cc:
	Define is_insertable trait to replace std::__is_insertable. Make
	it work with rvalue streams as well as lvalues, to replace f()
	and g() helper functions.
	* testsuite/27_io/basic_ostream/inserters_other/wchar_t/6.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/io/dr2989.cc: Prune additional
	errors from new constraints.
	* testsuite/27_io/rvalue_streams-2.cc: Remove PR 80675 checks,
	which are no longer expected to compile.
	* testsuite/27_io/rvalue_streams.cc: Adjust existing test.
	Verify LWG 1203 changes.
2021-04-30 14:33:19 +01:00
Jonathan Wakely
e06d3f5dd7 libstdc++: Fix filesystem::path construction from COW string [PR 99805]
Calling the non-const data() member on a COW string makes it "leaked",
possibly resulting in reallocating the string to ensure a unique owner.

The path::_M_split_cmpts() member parses its _M_pathname string using
string_view objects and then calls _M_pathname.data() to find the offset
of each string_view from the start of the string. However because
_M_pathname is non-const that will cause a COW string to reallocate if
it happens to be shared with another string object. This results in the
offsets calculated for each component being wrong (i.e. undefined)
because the string views no longer refer to substrings of the
_M_pathname member. The fix is to use the parse.offset(c) member which
gets the offset safely.

The bug only happens for the path(string_type&&) constructor and only
for COW strings. When constructed from an lvalue string the string's
contents are copied rather than just incrementing the refcount, so
there's no reallocation when calling the non-const data() member. The
testsuite changes check the lvalue case anyway, because we should
probably change the deep copying to just be a refcount increment (by
adding a path(const string_type&) constructor or an overload for
__effective_range(const string_type&), for COW strings only).

libstdc++-v3/ChangeLog:

	PR libstdc++/99805
	* src/c++17/fs_path.cc (path::_M_split_cmpts): Do not call
	non-const member on _M_pathname, to avoid copy-on-write.
	* testsuite/27_io/filesystem/path/decompose/parent_path.cc:
	Check construction from strings that might be shared.
2021-04-07 16:39:24 +01:00
Jonathan Wakely
31002af904 libstdc++: Do not assume std::FILE is complete [PR 99270]
libstdc++-v3/ChangeLog:

	PR libstdc++/99270
	* testsuite/27_io/headers/cstdio/types_std.cc: Use pointer to
	FILE instead of FILE.
2021-02-25 15:35:58 +00:00
Jonathan Wakely
1dfd95f0a0 libstdc++: Fix filesystem::rename on Windows [PR 98985]
The _wrename function won't overwrite an existing file, so use
MoveFileEx instead. That allows renaming directories over files, which
POSIX doesn't allow, so check for that case explicitly and report an
error.

Also document the deviation from the expected behaviour, and add a test
for filesystem::rename which was previously missing.

The Filesystem TS experimental::filesystem::rename doesn't have that
extra code to handle directories correctly, so the relevant parts of the
new test are not run on Windows.

libstdc++-v3/ChangeLog:

	* doc/xml/manual/status_cxx2014.xml: Document implementation
	specific properties of std::experimental::filesystem::rename.
	* doc/xml/manual/status_cxx2017.xml: Document implementation
	specific properties of std::filesystem::rename.
	* doc/html/*: Regenerate.
	* src/c++17/fs_ops.cc (fs::rename): Implement correct behaviour
	for directories on Windows.
	* src/filesystem/ops-common.h (__gnu_posix::rename): Use
	MoveFileExW on Windows.
	* testsuite/27_io/filesystem/operations/rename.cc: New test.
	* testsuite/experimental/filesystem/operations/rename.cc: New test.
2021-02-12 15:29:50 +00:00
Jonathan Wakely
c4ece1d96a libstdc++: XFAIL tests that depends on RTTI
The std::emit_on_flush manipulator depends on dynamic_cast, so fails
without RTTI.

The std::async code can't catch a forced_unwind exception when RTTI is
disabled, so it can't rethrow it either, and the test aborts.

libstdc++-v3/ChangeLog:

	* testsuite/27_io/basic_ostream/emit/1.cc: Expect test to fail
	if -fno-rtti is used.
	* testsuite/30_threads/async/forced_unwind.cc: Expect test
	to abort if -fno-rtti is used.
2021-02-12 14:30:13 +00:00
Jonathan Wakely
e9c3105211 libstdc++: Only use dynamic_cast in tests when RTTI is enabled
libstdc++-v3/ChangeLog:

	* testsuite/27_io/basic_istringstream/rdbuf/char/2832.cc: Use
	static_cast when RTTI is disabled.
	* testsuite/27_io/basic_istringstream/rdbuf/wchar_t/2832.cc:
	Likewise.
	* testsuite/27_io/basic_ostringstream/rdbuf/char/2832.cc:
	Likewise.
	* testsuite/27_io/basic_ostringstream/rdbuf/wchar_t/2832.cc:
	Likewise.
	* testsuite/27_io/basic_stringstream/str/char/2.cc:
	Likewise.
	* testsuite/27_io/basic_stringstream/str/wchar_t/2.cc:
	Likewise.
2021-02-12 14:30:13 +00:00
Jonathan Wakely
6a6f74be9d libstdc++: Fix spelling of __MINGW32__ macros
libstdc++-v3/ChangeLog:

	* testsuite/27_io/filesystem/operations/proximate.cc: Fix typo
	in __MINGW32__ macro name.
	* testsuite/27_io/filesystem/path/compare/lwg2936.cc: Likewise.
	* testsuite/27_io/filesystem/path/generation/proximate.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/generation/relative.cc:
	Likewise.
	* testsuite/util/testsuite_fs.h: Likewise.
2021-02-10 16:40:29 +00:00
Jonathan Wakely
bfdb7b8c6f libstdc++: Clear up directories created by tests
libstdc++-v3/ChangeLog:

	* testsuite/27_io/filesystem/operations/remove_all.cc: Remove
	test directory after making it writable again.
	* testsuite/experimental/filesystem/operations/remove_all.cc:
	Likewise.
2021-02-09 16:54:41 +00:00
Jonathan Wakely
a81d2f1e41 libstdc++: Fix narrow char test to use stringbuf not wstringbuf
This seems to be a copy & paste error.

libstdc++-v3/ChangeLog:

	* testsuite/27_io/basic_stringstream/cons/char/1.cc: Use
	stringbuf not wstringbuf.
2021-01-18 12:45:10 +00:00
Jakub Jelinek
99dee82307 Update copyright years. 2021-01-04 10:26:59 +01:00
Ville Voutilainen
4e096e0ff8 libstdc++: Fix the test for rvalue stream extraction
libstdc++-v3/ChangeLog:

	* testsuite/27_io/rvalue_streams.cc: Run the extraction to a char*
	for C++17 and lower only.
2020-12-15 18:03:43 +02:00
Jonathan Wakely
8b2c3b5af3 libstdc++: Use longer timeout for istream::gcount() overflow tests
On targets with 32-bit poitners these tests do extra work, so give them
longer to run.

libstdc++-v3/ChangeLog:

	* testsuite/27_io/basic_istream/ignore/char/94749.cc: Add
	dg-timeout-factor for ilp32 targets.
	* testsuite/27_io/basic_istream/ignore/wchar_t/94749.cc:
	Likewise.
2020-12-02 12:34:20 +00:00
Jonathan Wakely
0fb378761f libstdc++: Use longer timeout for slow running tests
libstdc++-v3/ChangeLog:

	* testsuite/27_io/basic_istream/get/char/lwg3464.cc: Add
	dg-timeout-factor directive.
	* testsuite/27_io/basic_istream/get/wchar_t/lwg3464.cc:
	Likewise.
2020-12-01 10:51:25 +00:00
Jonathan Wakely
58f71a34c6 libstdc++: Link test with libatomic if needed [PR 98003]
libstdc++-v3/ChangeLog:

	PR libstdc++/98003
	* testsuite/27_io/basic_syncbuf/sync_ops/1.cc: Add options for
	libatomic.
2020-12-01 10:37:38 +00:00
Jonathan Wakely
4a7c799908 libstdc++: Fix -Wrange-loop-construct warnings in filesystem tests
Many tests do `for (const path& p : test_paths)` where test_paths is an
array of strings. To avoid -Wrange-loop-construct warnings the loop
variable should be an object, not a reference bound to a temporary.

libstdc++-v3/ChangeLog:

	* testsuite/27_io/filesystem/operations/absolute.cc: Avoid
	-Wrange-loop-construct warning.
	* testsuite/27_io/filesystem/path/append/source.cc: Likewise.
	* testsuite/27_io/filesystem/path/assign/copy.cc: Likewise.
	* testsuite/27_io/filesystem/path/compare/path.cc: Likewise.
	* testsuite/27_io/filesystem/path/construct/copy.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_path.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/itr/traversal.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/nonmember/append.cc: Likewise.
	* testsuite/27_io/filesystem/path/nonmember/cmp.cc: Likewise.
	* testsuite/27_io/filesystem/path/nonmember/cmp_c++20.cc:
	Likewise.
	* testsuite/27_io/filesystem/path/nonmember/hash_value.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_relative.cc: Likewise.
	* testsuite/experimental/filesystem/operations/absolute.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/assign/copy.cc: Likewise.
	* testsuite/experimental/filesystem/path/compare/path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/construct/copy.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/extension.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/filename.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/parent_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/relative_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/root_directory.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/decompose/root_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/itr/traversal.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/modifiers/remove_filename.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/modifiers/replace_extension.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/modifiers/replace_filename.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/nonmember/hash_value.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_extension.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_filename.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_parent_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_relative_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_root_directory.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_root_name.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_root_path.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/has_stem.cc:
	Likewise.
	* testsuite/experimental/filesystem/path/query/is_relative.cc:
	Likewise.
2020-11-27 13:34:22 +00:00
Jonathan Wakely
ecba8547dd libstdc++: Implement std::emit_on_flush etc.
This adds the manipulators for use with basic_osyncstream. In order to
detect when an arbitrary basic_ostream<C,T> is the base class of a
basic_syncbuf<C,T,A> object, introduce a new intermediate base class
that stores the data members. The new base class stores a pointer and
two bools, which wastes (sizeof(void*) - 2) bytes of padding. It would
be possible to use the two least significant bits of the pointer for the
two bools, at least for targets where alignof(basic_streambuf) > 2, but
that's left as a possible change for a future date.

Also define basic_syncbuf::overflow to override the virtual function in
the base class, so that single characters can be inserted into the
stream buffer. Previously the default basic_streambuf::overflow
implementation was used, which drops the character on the floor.

libstdc++-v3/ChangeLog:

	* include/std/ostream (__syncbuf_base): New class template.
	(emit_on_flush, noemit_on_flush, flush_emit): New manipulators.
	* include/std/syncstream (basic_syncbuf): Derive from
	__syncbuf_base instead of basic_streambuf.
	(basic_syncbuf::operator=): Remove self-assignment check.
	(basic_syncbuf::swap): Remove self-swap check.
	(basic_syncbuf::emit): Do not skip pubsync() call if sequence
	is empty.
	(basic_syncbuf::sync): Remove no-op pubsync on stringbuf.
	(basic_syncbuf::overflow): Define override.
	* testsuite/27_io/basic_syncstream/basic_ops/1.cc: Test
	basic_osyncstream::put(char_type).
	* testsuite/27_io/basic_ostream/emit/1.cc: New test.
2020-11-11 00:19:40 +00:00
Jonathan Wakely
95cb0fc8c5 libstdc++: Add remaining C++20 additions to <sstream> [P0408R7]
This adds the new overloads of basic_stringbuf::str, and the
corresponding overloads to basic_istringstream, basic_ostringstream and
basic_stringstream.

libstdc++-v3/ChangeLog:

	* config/abi/pre/gnu.ver (GLIBCXX_3.4.21): Tighten patterns.
	(GLIBCXX_3.4.29): Export new symbols.
	* include/bits/alloc_traits.h (__allocator_like): New concept.
	* include/std/sstream (basic_stringbuf::swap): Add exception
	specification.
	(basic_stringbuf::str() const): Add ref-qualifier. Use new
	_M_high_mark function.
	(basic_stringbuf::str(const SAlloc&) const): Define new function.
	(basic_stringbuf::str() &&): Likewise.
	(basic_stringbuf::str(const basic_string<C,T,SAlloc>&)):
	Likewise.
	(basic_stringbuf::str(basic_string<C,T,Alloc>&&)): Likewise.
	(basic_stringbuf::view() const): Use _M_high_mark.
	(basic_istringstream::str, basic_ostringstream::str)
	(basic_stringstream::str): Define new overloads.
	* src/c++20/sstream-inst.cc (basic_stringbuf::str)
	(basic_istringstream::str, basic_ostringstream::str)
	(basic_stringstream::str): Explicit instantiation definitions
	for new overloads.
	* testsuite/27_io/basic_istringstream/view/char/1.cc: Add more
	checks.
	* testsuite/27_io/basic_istringstream/view/wchar_t/1.cc:
	Likewise.
	* testsuite/27_io/basic_ostringstream/view/char/1.cc:
	Likewise.
	* testsuite/27_io/basic_ostringstream/view/wchar_t/1.cc:
	Likewise.
	* testsuite/27_io/basic_stringstream/view/char/1.cc:
	Likewise.
	* testsuite/27_io/basic_stringstream/view/wchar_t/1.cc:
	Likewise.
	* testsuite/27_io/basic_istringstream/str/char/2.cc: New test.
	* testsuite/27_io/basic_istringstream/str/wchar_t/2.cc: New test.
	* testsuite/27_io/basic_ostringstream/str/char/3.cc: New test.
	* testsuite/27_io/basic_ostringstream/str/wchar_t/3.cc: New test.
	* testsuite/27_io/basic_stringbuf/str/char/4.cc: New test.
	* testsuite/27_io/basic_stringbuf/str/wchar_t/4.cc: New test.
	* testsuite/27_io/basic_stringstream/str/char/5.cc: New test.
	* testsuite/27_io/basic_stringstream/str/wchar_t/5.cc.cc: New test.
2020-11-10 19:22:47 +00:00
Jonathan Wakely
432258be4f libstdc++: Fix new <sstream> constructors
- Add a missing 'explicit' to a basic_stringbuf constructor.
- Set up the get/put area pointers in the constructor from strings using
  different allocator types.
- Remove public basic_stringbuf::__sv_type alias.
- Do not construct temporary basic_string objects with a
  default-constructed allocator.

Also, change which basic_string constructor is used, as a minor
compile-time optimization. Constructing from a basic_string_view
requires more work from the compiler, so just use a pointer and length.

libstdc++-v3/ChangeLog:

	* include/std/sstream (basic_stringbuf(const allocator_type&):
	Add explicit.
	(basic_stringbuf(const basic_string<C,T,SA>&, openmode, const A&)):
	Call _M_stringbuf_init. Construct _M_string from pointer and length
	to avoid constraint checks for string view.
	(basic_stringbuf::view()): Make __sv_type alias local to the
	function.
	(basic_istringstream(const basic_string<C,T,SA>&, openmode, const A&)):
	Pass string to _M_streambuf instead of constructing a temporary
	with the wrong allocator.
	(basic_ostringstream(const basic_string<C,T,SA>&, openmode, const A&)):
	Likewise.
	(basic_stringstream(const basic_string<C,T,SA>&, openmode, const A&)):
	Likewise.
	* src/c++20/sstream-inst.cc: Use string_view and wstring_view
	typedefs in explicit instantiations.
	* testsuite/27_io/basic_istringstream/cons/char/1.cc: Add more
	tests for constructors.
	* testsuite/27_io/basic_ostringstream/cons/char/1.cc: Likewise.
	* testsuite/27_io/basic_stringbuf/cons/char/1.cc: Likewise.
	* testsuite/27_io/basic_stringbuf/cons/char/2.cc: Likewise.
	* testsuite/27_io/basic_stringbuf/cons/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_stringbuf/cons/wchar_t/2.cc: Likewise.
	* testsuite/27_io/basic_stringstream/cons/char/1.cc: Likewise.
2020-11-05 13:31:32 +00:00
Jonathan Wakely
8f565d255a libstdc++: Fix default mode of new basic_stringstream constructor [PR 97719]
libstdc++-v3/ChangeLog:

	PR libstdc++/97719
	* include/std/sstream (basic_stringstream(string_type&&, openmode)):
	Fix default argument.
	* testsuite/27_io/basic_stringstream/cons/char/97719.cc: New test.
2020-11-04 23:41:02 +00:00
Thomas Rodgers
6bcbcea058 libstdc++: Add c++2a <syncstream>
libstdc++-v3/ChangeLog:
	* doc/doxygen/user.cfg.in (INPUT): Add new header.
	* include/Makefile.am (std_headers): Add new header.
	* include/Makefile.in: Regenerate.
	* include/precompiled/stdc++.h: Include new header.
	* include/std/syncstream: New header.
	* include/std/version: Add __cpp_lib_syncbuf.
	* testsuite/27_io/basic_syncbuf/1.cc: New test.
	* testsuite/27_io/basic_syncbuf/2.cc: Likewise.
	* testsuite/27_io/basic_syncbuf/basic_ops/1.cc:
	Likewise.
	* testsuite/27_io/basic_syncbuf/requirements/types.cc:
	Likewise.
	* testsuite/27_io/basic_syncbuf/sync_ops/1.cc:
	Likewise.
	* testsuite/27_io/basic_syncstream/1.cc: Likewise.
	* testsuite/27_io/basic_syncstream/2.cc: Likewise.
	* testsuite/27_io/basic_syncstream/basic_ops/1.cc:
	Likewise.
	* testsuite/27_io/basic_syncstream/requirements/types.cc:
	Likewise.
2020-11-02 10:41:32 -08:00
Jonathan Wakely
13feb0234b libstdc++: Avoid warnings in tests
This fixes some warnings emitted when testing with warning flags added.
Some of these are only necessary when testing with -Wsystem-headers, but
either way it cleans up the tests to be less noisy under non-default
flags.

libstdc++-v3/ChangeLog:

	* testsuite/18_support/96817.cc: Avoid -Wunused warnings.
	* testsuite/20_util/any/assign/2.cc: Likewise.
	* testsuite/20_util/any/cons/2.cc: Likewise.
	* testsuite/20_util/align/1.cc: Avoid -Wsign-compare warning.
	* testsuite/20_util/function/65760.cc: Avoid -Wunused warning.
	* testsuite/20_util/function/1.cc: Avoid -Wcatch-value warning.
	* testsuite/20_util/function/cons/move_target.cc: Avoid -Wunused
	warning.
	* testsuite/20_util/headers/memory/synopsis.cc: Add exception
	specification.
	* testsuite/20_util/monotonic_buffer_resource/allocate.cc: Avoid
	-Wsign-compare warning.
	* testsuite/20_util/tuple/cons/deduction.cc: Avoid -Wunused
	warning.
	* testsuite/20_util/specialized_algorithms/uninitialized_copy/808590-cxx11.cc:
	Avoid -Wdeprecated-copy warning.
	* testsuite/21_strings/basic_string/56166.cc: Avoid
	-Wcatch-value warning.
	* testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc:
	Avoid -Wcatch-value warnings.
	* testsuite/21_strings/basic_string/numeric_conversions/char/stof.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/char/stoi.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/char/stol.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/char/stold.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/char/stoll.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/char/stoul.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/char/stoull.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stof.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoi.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stol.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoll.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoul.cc:
	Likewise.
	* testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoull.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/compare/char/nonnull.cc:
	Prune additional diagnostics.
	* testsuite/21_strings/basic_string_view/operations/find/char/nonnull.cc:
	Likewise.
	* testsuite/21_strings/basic_string_view/operations/rfind/char/nonnull.cc:
	Likewise.
	* testsuite/21_strings/headers/string/synopsis.cc: Add exception
	specifications.
	* testsuite/22_locale/locale/cons/12352.cc: Define sized
	delete operators to avoid warnings.
	* testsuite/23_containers/deque/modifiers/swap/1.cc: Add
	exception specification.
	* testsuite/23_containers/forward_list/cons/11.cc: Avoid
	-Wdeprecated-copy warning.
	* testsuite/23_containers/headers/bitset/synopsis.cc: Add
	exception specification.
	* testsuite/23_containers/headers/deque/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/forward_list/synopsis.cc:
	Likewise.
	* testsuite/23_containers/headers/list/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/map/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/queue/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/set/synopsis.cc: Likewise.
	* testsuite/23_containers/headers/vector/synopsis.cc: Likewise.
	* testsuite/23_containers/list/modifiers/swap/1.cc: Likewise.
	* testsuite/23_containers/map/modifiers/swap/1.cc: Likewise.
	* testsuite/23_containers/multimap/modifiers/swap/1.cc:
	Likewise.
	* testsuite/23_containers/multiset/modifiers/swap/1.cc:
	Likewise.
	* testsuite/23_containers/set/modifiers/swap/1.cc: Likewise.
	* testsuite/23_containers/unordered_set/56267-2.cc: Avoid
	-Wdeprecated-copy warning.
	* testsuite/23_containers/vector/bool/23632.cc: Avoid
	-Wempty-body warning.
	* testsuite/23_containers/vector/modifiers/swap/1.cc: Add
	exception specification.
	* testsuite/25_algorithms/heap/moveable2.cc: Fix misplaced
	parentheses around arguments.
	* testsuite/25_algorithms/sample/1.cc: Use return value.
	* testsuite/25_algorithms/search/searcher.cc: Avoid -Wunused
	warnings.
	* testsuite/27_io/basic_ostream/exceptions/char/9561.cc:
	Likewise.
	* testsuite/27_io/basic_ostream/exceptions/wchar_t/9561.cc:
	Likewise.
	* testsuite/27_io/filesystem/operations/remove_all.cc: Avoid
	-Wsign-compare warning.
	* testsuite/experimental/any/assign/2.cc: Avoid -Wunused warnings.
	* testsuite/experimental/any/cons/2.cc: Likewise.
	* testsuite/experimental/filesystem/operations/remove_all.cc:
	Avoid -Wign-compare warning.
	* testsuite/experimental/memory/observer_ptr/cons/cons.cc:
	Likewise.
	* testsuite/experimental/memory_resource/null_memory_resource.cc:
	Likewise.
	* testsuite/experimental/source_location/1.cc: Avoid -Waddress
	warning.
	* testsuite/ext/pod_char_traits.cc: Avoid -Wunused warning.
	* testsuite/ext/vstring/modifiers/clear/56166.cc: Avoid
	-Wcatch-value.
	* testsuite/std/concepts/concepts.lang/concept.swappable/swap.cc:
	Avoid -Wunused warning.
	* testsuite/std/concepts/concepts.lang/concept.swappable/swappable.cc:
	Likewise.
	* testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc:
	Prune additional warnings.
	* testsuite/tr1/3_function_objects/function/1.cc: Avoid
	-Wcatch-value warning.
	* testsuite/util/replacement_memory_operators.h: Define sized
	delete to avoid warnings.
	* testsuite/util/testsuite_api.h (_NonDefaultConstructible): Add
	user-declared assignment operator to stop -Wdeprecated-copy
	warnings.
	* testsuite/util/testsuite_containers.h: Avoid -Wunused warning.
	* testsuite/util/testsuite_iterators.h: Avoid -Wsign-compare
	warnings.
	* testsuite/util/testsuite_new_operators.h: Define sized deleted.
2020-10-29 22:47:21 +00:00
Thomas Rodgers
a0e4d7b44c libstdc++: Implement C++20 features for <sstream>
New ctors and ::view() accessor for -
  * basic_stingbuf
  * basic_istringstream
  * basic_ostringstream
  * basic_stringstreamm

New ::get_allocator() accessor for basic_stringbuf.

libstdc++-v3/ChangeLog:
	* acinclude.m4 (glibcxx_SUBDIRS): Add src/c++20.
	* config/abi/pre/gnu.ver (GLIBCXX_3.4.29): New symbols.
	* configure: Regenerate.
	* include/std/sstream:
	(basic_stringbuf::basic_stringbuf(allocator const&)): New constructor.
	(basic_stringbuf::basic_stringbuf(openmode, allocator const&)): Likewise.
	(basic_stringbuf::basic_stringbuf(basic_string&&, openmode)): Likewise.
	(basic_stringbuf::basic_stringbuf(basic_stringbuf&&, allocator const&)):
	Likewise.
	(basic_stringbuf::get_allocator()): New method.
	(basic_stringbuf::view()): Likewise.
	(basic_istringstream::basic_istringstream(basic_string&&, openmode)):
	New constructor.
	(basic_istringstream::basic_istringstream(openmode, allocator const&)):
	Likewise
	(basic_istringstream::view()): New method.
	(basic_ostringstream::basic_ostringstream(basic_string&&, openmode)):
	New constructor.
	(basic_ostringstream::basic_ostringstream(openmode, allocator const&)):
	Likewise
	(basic_ostringstream::view()): New method.
	(basic_stringstream::basic_stringstream(basic_string&&, openmode)):
	New constructor.
	(basic_stringstream::basic_stringstream(openmode, allocator const&)):
	Likewise
	(basic_stringstream::view()): New method.
	* src/Makefile.in: Add c++20 directory.
	* src/Makefile.am: Regenerate.
	* src/c++20/Makefile.am: Add makefile for new sub-directory.
	* src/c++20/Makefile.in: Generate.
	* src/c++20/sstream-inst.cc: New file defining explicit
	instantiations for basic_stringbuf, basic_istringstream,
	basic_ostringstream, and basic_stringstream member functions
	added in C++20.
	* testsuite/27_io/basic_stringbuf/cons/char/2.cc: New test.
	* testsuite/27_io/basic_stringbuf/cons/wchar_t/2.cc: Likewise.
	* testsuite/27_io/basic_stringbuf/view/char/1.cc: Likewise.
	* testsuite/27_io/basic_stringbuf/view/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_istringstream/cons/char/1.cc: Likewise.
	* testsuite/27_io/basic_istringstream/cons/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_istringstream/view/char/1.cc: Likewise.
	* testsuite/27_io/basic_istringstream/view/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_ostringstream/cons/char/1.cc: Likewise.
	* testsuite/27_io/basic_ostringstream/cons/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_ostringstream/view/char/1.cc: Likewise.
	* testsuite/27_io/basic_ostringstream/view/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_stringstream/cons/char/1.cc: Likewise.
	* testsuite/27_io/basic_stringstream/cons/wchar_t/1.cc: Likewise.
	* testsuite/27_io/basic_stringstream/view/char/1.cc: Likewise.
	* testsuite/27_io/basic_stringstream/view/wchar_t/1.cc: Likewise.
2020-10-28 11:56:06 -07:00
Jonathan Wakely
5ae9ddd480 libstdc++: Enable tests that incorrectly require cxx11-abi
These tests were not being run when -D_GLIBCXX_USE_CXX11_ABI=0 was added
to the test flags, but they actually work OK with the old string.

libstdc++-v3/ChangeLog:

	* testsuite/21_strings/basic_string/allocator/char/minimal.cc:
	Do not require cxx11-abi effective target.
	* testsuite/21_strings/basic_string/allocator/wchar_t/minimal.cc:
	Likewise.
	* testsuite/27_io/basic_fstream/cons/base.cc: Likewise.
2020-10-14 12:52:46 +01:00