Commit Graph

13476 Commits

Author SHA1 Message Date
François Dumont 8f1802003d libstdc++: Remove obsolete comment in <string> header
The comment is obsolete because char_traits.h do not include stl_algobase.h
anymore and stl_algobase.h is included directly from <string> a few lines
below.

libstdc++-v3/ChangeLog:

	* include/std/string: Remove obsolete comment about char_traits.h including
	stl_algobase.h.
2022-07-09 14:18:15 +02:00
GCC Administrator 6345c41454 Daily bump. 2022-07-08 00:16:22 +00:00
Jonathan Wakely ad6135e261 libstdc++: Remove workaround in __gnu_cxx::char_traits::move [PR89074]
The front-end bug that prevented this constexpr loop from working has
been fixed since GCC 12.1 so we can remove the workaround.

libstdc++-v3/ChangeLog:

	PR c++/89074
	* include/bits/char_traits.h (__gnu_cxx::char_traits::move):
	Remove workaround for front-end bug.
2022-07-07 17:38:14 +01:00
GCC Administrator d1f3a3fffe Daily bump. 2022-07-06 00:16:33 +00:00
Alexandre Oliva bd2d0aab4d libstdc++: testsuite: why cast getpid result
Add a comment next to the getpid call to explain why the typecast is
needed.


for  libstdc++-v3/ChangeLog

	* testsuite/util/testsuite_fs.h (nonexistent_path): Explain
	why we need the typecast.
2022-07-05 19:07:32 -03:00
Alexandre Oliva b44cba355e libstdc++: testsuite: cast getpid result
On vxworks, in kernel mode, getpid's return type is a pointer type, so
std::to_string on it fails overload resolution.  Restore the type cast
from the original patch that suggested adding the pid.


for  libstdc++-v3/ChangeLog

	* testsuite/util/testsuite_fs.h (nonexistent_path): Convert
	the getpid result to an integral type.
2022-07-05 06:12:27 -03:00
GCC Administrator ed97448899 Daily bump. 2022-07-02 00:16:26 +00:00
Jonathan Wakely 8a6ee426c2 libstdc++: Add missing prerequisite to generated header [PR106162]
The ${host_builddir}/largefile-config.h header can't be written until
its parent directory has been created, so it needs to have the creation
of that directory as a prerequisite.

libstdc++-v3/ChangeLog:

	PR libstdc++/106162
	* include/Makefile.am (largefile-config.h): Add
	stamp-${host_alias} prerequisite.
	* include/Makefile.in: Regenerate.
2022-07-01 22:42:55 +01:00
Jonathan Wakely f7a148304a libstdc++: Add nodiscard attribute to filesystem operations
Some of these are not truly "pure" because they access the file system,
e.g. exists and file_size, but they do not modify anything and are only
useful for the return value.

If you really want to use one of those functions just to check whether
an error is reported (either via an exception or an error_code&
argument) you can still do so, but you need to cast the discarded result
to void.  Several tests need such a change, because they were indeed
only calling the functions to check for expected errors.

libstdc++-v3/ChangeLog:

	* include/bits/fs_ops.h: Add nodiscard to all pure functions.
	* include/experimental/bits/fs_ops.h: Likewise.
	* testsuite/27_io/filesystem/operations/all.cc: Do not discard
	results of absolute and canonical.
	* testsuite/27_io/filesystem/operations/absolute.cc: Cast
	discarded result to void.
	* testsuite/27_io/filesystem/operations/canonical.cc: Likewise.
	* testsuite/27_io/filesystem/operations/exists.cc: Likewise.
	* testsuite/27_io/filesystem/operations/is_empty.cc: Likewise.
	* testsuite/27_io/filesystem/operations/read_symlink.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/operations/canonical.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/exists.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/is_empty.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/read_symlink.cc:
	Likewise.
	* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
	Likewise.
2022-07-01 11:50:18 +01:00
Sebastian Huber e0466d32eb Enable some features for RTEMS in libstdc++
Remove RTEMS support from crossconfig.m4 since this code is not used due to
"with_newlib" being "yes".

libstdc++-v3/ChangeLog:

	* configure: Regnerate.
	* configure.ac (newlib, *-rtems*): Enable TLS support for all RTEMS
	targets except bfin, lm32, mips, moxie, or1k, and v850.
	For all RTEMS targets, define HAVE_ALIGNED_ALLOC, HAVE_AT_QUICK_EXIT,
	HAVE_LINK, HAVE_POLL, HAVE_QUICK_EXIT, HAVE_READLINK, HAVE_SETENV,
	HAVE_SLEEP, HAVE_SOCKATMARK, HAVE_STRERROR_L, HAVE_SYMLINK,
	HAVE_TRUNCATE, and HAVE_USLEEP.
	* crossconfig.m4 (*-rtems*): Remove.
2022-07-01 12:03:13 +02:00
GCC Administrator 976196b333 Daily bump. 2022-07-01 00:16:27 +00:00
Jonathan Wakely c1fe8ddf68 libstdc++: Fix comment typos
libstdc++-v3/ChangeLog:

	* include/bits/utility.h: Fix comment typos.
2022-06-30 16:11:57 +01:00
Jonathan Wakely 1eef21ccfa libstdc++: Improve exceptions thrown from fs::temp_directory_path
Currently the throwing overload of fs::temp_directory_path() will
discard the path that was obtained from the environment. When it fails
because the path doesn't resolve to a directory you get an unhelpful
error like:

  filesystem error: temp_directory_path: Not a directory

It would be better to also print the path in that case, e.g.

  filesystem error: temp_directory_path: Not a directory [/home/bob/tmp]

libstdc++-v3/ChangeLog:

	* src/c++17/fs_ops.cc (fs::temp_directory_path()): Include path
	in exception.
	(fs::temp_directory_path(error_code&)): Rearrange to more
	closely match the structure of the first overload.
	* src/filesystem/ops.cc (fs::temp_directory_path): Likewise.
	* testsuite/27_io/filesystem/operations/temp_directory_path.cc:
	Check that exception contains the path.
	* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
	Likewise.
2022-06-30 14:16:27 +01:00
Jonathan Wakely 6c96b14a19 libstdc++: Fix experimental::filesystem::status on Windows [PR88881]
Although the Filesystem TS isn't properly supported on Windows (unlike
the C++17 Filesystem lib), most tests do pass. Two of the failures are
due to PR 88881 which was only fixed for std::filesystem not the TS.
This applies the fix to the TS implementation too.

libstdc++-v3/ChangeLog:

	PR libstdc++/88881
	* src/filesystem/ops.cc (has_trailing_slash): New helper
	function.
	(fs::status): Strip trailing slashes.
	(fs::symlink_status): Likewise.
	* testsuite/experimental/filesystem/operations/temp_directory_path.cc:
	Clean the environment before each test and use TMP instead of
	TMPDIR so the test passes on Windows.
2022-06-30 14:16:06 +01:00
GCC Administrator fb29fdea9c Daily bump. 2022-06-29 00:17:00 +00:00
Jonathan Wakely bb1f266a7d libstdc++: Fix filesystem build for Windows
I only half remembered to use char_type instead of char for filesystem
paths, so that it works with wchar_t on Windows. This fixes the
bootstrap failure.

libstdc++-v3/ChangeLog:

	* src/filesystem/dir-common.h (_Dir_base::_At_path):
	Use char_type consistently for paths.
2022-06-28 12:58:18 +01:00
Jonathan Wakely 198781144f libstdc++: Improve directory iterator abstractions for openat
Currently the _Dir::open_subdir function decides whether to construct a
_Dir_base with just a pathname, or a file descriptor and pathname. But
that means it is tiughtly coupled to the implementation of
_Dir_base::openat, which is what actually decides whether to use a file
descriptor or not. If the derived class passes a file descriptor and
filename, but the base class expects a full path and ignores the file
descriptor, then recursive_directory_iterator cannot recurse.

This change introduces a new type that provides the union of all the
information available to the derived class (the full pathname, as well
as a file descriptor for a directory and another pathname relative to
that directory). This allows the derived class to be agnostic to how the
base class will use that information.

libstdc++-v3/ChangeLog:

	* src/c++17/fs_dir.cc (_Dir::dir_and_pathname):: Replace with
	current() returning _At_path.
	(_Dir::_Dir, _Dir::open_subdir, _Dir::do_unlink): Adjust.
	* src/filesystem/dir-common.h (_Dir_base::_At_path): New class.
	(_Dir_base::_Dir_Base, _Dir_base::openat): Use _At_path.
	* src/filesystem/dir.cc (_Dir::dir_and_pathname): Replace with
	current() returning _At_path.
	(_Dir::_Dir, _Dir::open_subdir): Adjust.
2022-06-28 12:09:20 +01:00
Jonathan Wakely 835b19936b libstdc++: Do not optimize away storing pathname if it's needed
libstdc++-v3/ChangeLog:

	* src/c++17/fs_dir.cc (_Dir::_Dir) [!_GLIBCXX_HAVE_OPENAT]:
	Always store pathname if we don't have openat or unlinkat,
	because the full path is needed to open sub-directories and
	remove entries.
2022-06-28 12:08:35 +01:00
Jonathan Wakely 30aea28bd3 libstdc++: testsuite: Guard use of C99 std::log2
This prevents the test from failing if the only thing not supported is
the text printed to the log about the size of the floating-point type.

libstdc++-v3/ChangeLog:

	* testsuite/20_util/from_chars/4.cc: Only use log2 if C99 math
	functions are available.
2022-06-28 09:29:24 +01:00
GCC Administrator 9d3dd21856 Daily bump. 2022-06-28 00:16:58 +00:00
Alexandre Oliva 01e094f82d libstdc++: testsuite: use cmath long double overloads
In case we need to supplement the C standard library with additional
definitions for float and long double, the declarations expected to be
in the C headers may not be there.  Rely on the cmath overloads
instead.


for  libstdc++-v3/ChangeLog

	* testsuite/20_util/to_chars/long_double.cc: Use cmath
	long double overloads for nexttoward and ldexp.
2022-06-27 10:34:19 -03:00
Alexandre Oliva 8fce31f69b libstdc++: testsuite: require cmath for exp simd
simd_math.h assumes declarations for many C99 functions to be present,
that libstdc++ doesn't add to target systems that don't have them in
the C library.

Add the C99 math requirement to tests for simd features, so that they
don't fail because of limitations of the target C library.


for  libstdc++-v3/ChangeLog

	* testsuite/experimental/simd/standard_abi_usable.cc: Require
	cmath support.
	* testsuite/experimental/simd/standard_abi_usable_2.cc:
	Likewise.
2022-06-27 10:34:19 -03:00
Alexandre Oliva 3e3744d37e libstdc++: testsuite: complex proj requirements
The template version of complex::proj returns its argument without
testing for infinities, and that's all we have when neither C99
complex nor C99 math functions are available, and it seems too hard to
do better without isinf and copysign.

I suppose just calling them and expecting users will supply
specializations as needed has been ruled out, and so has refraining
from defining it when it can't be implemented correctly.

It's pointless to run the proj.cc test under these circumstances, so
arrange for it to be skipped.  In an unusual way, after trying to
introduce dg-require tests for ccomplex-or-cmath, and found their
results to be misleading due to variations across -std=* versions.


for  libstdc++-v3/ChangeLog

	* testsuite/26_numerics/complex/proj.cc: Skip test in the
	circumstances in which the implementation of proj is known to
	be broken.
2022-06-27 10:34:18 -03:00
Alexandre Oliva 486893b1d3 libstdc++: check for openat with dirfd in std::filesystem
In the recent patch to check for openat, I missed an occurrence of
dirfd in std::filesystem.


for  libstdc++-v3/ChangeLog

	* src/c++17/fs_dir.cc (dir_and_pathname): Use dirfd if
	_GLIBCXX_HAVE_OPENAT.
2022-06-27 10:34:16 -03:00
Alexandre Oliva ca35ebaec8 libstdc++: testsuite: conditionalize another symlink test
In the recent patch that introduced NO_SYMLINKS, I missed one of the
testcases that created symlinks.


for  libstdc++-v3/ChangeLog

	* testsuite/27_io/filesystem/iterators/recursive_directory_iterator.cc
	(test06): Don't create symlinks when NO_SYMLINKS is defined.
2022-06-27 10:34:15 -03:00
Alexandre Oliva 250b95a994 libstdc++: xfail experimental/net tests on rtems
Some net/timer/waitable tests fail on rtems because poll() is not
available.

The above, as well as net/internet/resolver/ops tests and
net/timer/waitable/cons.cc, will fail early at runtime unless mkfifo
is enabled in the RTEMS configuration, because the io_context ctor
throws when pipe() fails.

However, even enabling pipes and adjusting the net_ts link command to
use --gc-sections for -lbsd as recommended, both
net/internet/resolver/ops still fail at runtime.


for  libstdc++-v3/ChangeLog

	* testsuite/lib/dg-options.exp (add_options_for_net_ts):
	Add -Wl,--gc-sections for RTEMS targets.
	* testsuite/experimental/net/timer/waitable/dest.cc: Link-time
	xfail on RTEMS.
	* testsuite/experimental/net/timer/waitable/ops.cc: Likewise.
	* testsuite/experimental/net/internet/resolver/ops/lookup.cc:
	Execution-time xfail on RTEMS.
	* testsuite/experimental/net/internet/resolver/ops/reverse.cc:
	Likewise.
2022-06-27 10:34:14 -03:00
Jonathan Wakely c10a7546cf libstdc++: testsuite: Add missing <string> header
libstdc++-v3/ChangeLog:

	* testsuite/ext/mt_allocator/22309_thread.cc: Include <string>.
2022-06-27 11:08:17 +01:00
Joel Brobecker 30a8f67295 libstdc++: testsuite: avoid predicable mkstemp
We have noticed that, on RTEMS, a small number of testscases are
failing because two calls to this method return the same filename.
This happens for instance in 27_io/filesystem/operations/copy_file.cc
where it does:

  auto from = __gnu_test::nonexistent_path();
  auto to = __gnu_test::nonexistent_path();

We tracked this issue down to the fact that the implementation of
mkstemp on that system appears to use a very predictable algorithm
for chosing the name of the temporary file, where the same filename
appears to be tried in the same order, regardless of past calls.
So, as long as the file gets deleted after a call to mkstemp (something
we do here in our nonexistent_path method), the next call to mkstemps
ends up returning the same filename, causing the collision we se above.

This commit enhances the __gnu_test::nonexistent_path method to
introduce in the filename being returned a counter which gets
incremented at every call of this method.

Co-authored-by: Jonathan Wakely <jwakely@redhat.com>

libstdc++-v3/ChangeLog:

	* testsuite/util/testsuite_fs.h (__gnu_test::nonexistent_path):
	Always include a counter in the filename returned.
2022-06-27 11:08:17 +01:00
Jonathan Wakely a364488f7a libstdc++: Make std::move_only_function never valueless in std::variant
This is not suitable to backport, as it affects the ABI of std::variant
and so isn't appropriate for a release branch.

libstdc++-v3/ChangeLog:

	* include/bits/move_only_function.h (_Never_valueless_alt):
	Define partial specialization for std::move_only_function.
2022-06-27 11:08:16 +01:00
Jonathan Wakely da55353e95 libstdc++: Simplify std::variant construction using variable templates
libstdc++-v3/ChangeLog:

	* include/std/variant (_Build_FUN::_S_fun): Define fallback case
	as deleted.
	(__accepted_index, _Extra_visit_slot_needed): Replace class
	templates with variable templates.
2022-06-27 11:08:16 +01:00
Jonathan Wakely 6177f60d91 libstdc++: Simplify fs::path construction using variable template
libstdc++-v3/ChangeLog:

	* include/bits/fs_path.h (__is_path_iter_src): Replace class
	template with variable template.
2022-06-27 11:08:16 +01:00
Jonathan Wakely 48099f7daf libstdc++: Invert relationship between std::is_clock and std::is_clock_v
This redefines std::is_clock in terms of std::is_clock_v, instead of the
other way around. This avoids instantiatng the class template for code
that only uses the variable template.

libstdc++-v3/ChangeLog:

	* include/bits/chrono.h (is_clock_v): Define to false.
	(is_clock_v<T>): Define partial specialization for true cases.
	(is_clock): Define in terms of is_clock_v.
2022-06-27 11:08:16 +01:00
GCC Administrator 84c2131d2c Daily bump. 2022-06-25 00:16:23 +00:00
Xi Ruoyao fa4e97907f
libstdc++: use grep -E instead of egrep in scripts
egrep has been deprecated in favor of grep -E for a long time, and the
next grep release (3.8 or 4.0) will print a warning of egrep is used.
Stop using egrep so we won't see the warning.

grep's from GNU, BSD (including Mac OS X), AIX, BusyBox all support -E
and -F.  Solaris grep doesn't support -E, but extract_symvers.in already
contains a special case for Solaris and doxygen documentation generation
is already broken on non-GNU.

libstdc++-v3/ChangeLog:

	* scripts/extract_symvers.in: Use grep -E instead of egrep.
	* scripts/run_doxygen: Likewise.
2022-06-24 20:31:31 +08:00
Alexandre Oliva 93070671ea libstdc++: check for openat
rtems6.0 has fdopendir, and fcntl.h defines AT_FDCWD and declares
openat, but there's no openat in libc.  Adjust dir-common.h to not
assume ::openat just because of AT_FDCWD.


for  libstdc++-v3/ChangeLog

	* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for
	openat.
	* configure, config.h.in: Rebuilt.
	* src/filesystem/dir-common.h (openat): Use ::openat if
	_GLIBCXX_HAVE_OPENAT.
	* src/filesystem/dir.cc (dir_and_pathname): Use dirfd if
	_GLIBCXX_HAVE_OPENAT.
2022-06-23 23:28:14 -03:00
Alexandre Oliva 5d8a5f04ac libstdc++: xfail rename tests on rtems
::rename on RTEMS does not meet several POSIX requirements, despite
compliance with C and C++ standards.  ::std::filesystem::rename, in
turn, has requirements borrowed from POSIX, so it would have to be a
lot more than a simple wrapper around ::rename on RTEMS, and even then
fall short.

Until RTEMS reimplements ::rename for POSIX compliance, expect
filesystem rename tests to fail on it.


for  libstdc++-v3/ChangeLog

	* testsuite/27_io/filesystem/operations/rename.cc: xfail on
	rtems.
	* testsuite/experimental/filesystem/operations/rename.cc:
	Likewise.
2022-06-23 23:28:14 -03:00
Alexandre Oliva f01cf5eaa0 libstdc++: testsuite: skip fs last_write_time tests if dummy
The last_write_time functions are defined in ways that are useful, or
that fail immediately, depending on various macros.  When they fail
immediately, the filesystem last_write_time.cc tests fail noisily, but
the fail is entirely expected.

Define NO_LAST_WRITE_TIME in the last_write_time.cc tests, according
to the macros that select implementations of last_write_time, and use
it through the new dg-require-target-fs-lwt to skip tests that are
expected to fail.


for  libstdc++-v3/ChangeLog

	* testsuite/util/testsuite_fs.h (NO_LAST_WRITE_TIME): Define
	when appropriate.
	* testsuite/lib/libstdc++.exp
	(check_v3_target_fs_last_write_time): New.
	* testsuite/lib/dg-options.exp (dg-require-target-fs-lwt):
	New.
	* testsuite/27_io/filesystem/operations/last_write_time.cc:
	Skip the test if the features are unavailable.
	* testsuite/experimental/filesystem/operations/last_write_time.cc:
	Likewise.
2022-06-23 23:28:14 -03:00
Alexandre Oliva b931c6874e libstdc++: testsuite: skip fs space tests on dummy implementations
The do_space function is defined in ways that are useful, or that fail
immediately, depending on various macros.  When it fails immediately,
the filesystem space.cc tests fail noisily, but the fail is entirely
expected.

Define NO_SPACE in testsuite_fs.h, according to the macros that select
implementations of do_space, and use it to skip tests that are
expected to fail, through a new dg-require.


for  libstdc++-v3/ChangeLog

	* testsuite/util/testsuite_fs.h (NO_SPACE): Define if
	appropriate.
	* testsuite/lib/libstdc++.exp (check_v3_target_fs_space): New.
	* testsuite/lib/dg-options.exp (dg-require-target-fs-space):
	New.
	* testsuite/27_io/filesystem/operations/space.cc: Require
	target-fs-space.
	* testsuite/experimental/filesystem/operations/space.cc:
	Likewise.
2022-06-23 23:28:14 -03:00
Alexandre Oliva 9f7f25bb35 libstdc++: testsuite: conditionalize symlink tests
Several filesystem tests expect to be able to create symlinks even
when !defined (_GLIBCXX_HAVE_SYMLINK), and fail predictably, reducing
the amount of testing of other filesystem features.

They are already skipped for mingw targets.  I've extended the
skipping to other targets in which _GLIBCXX_HAVE_SYMLINK is undefined,
through a new NO_SYMLINKS macro in testsuite_fs.h that guards
skippable portions of tests, and dg-require-target-fs-symlinks for
tests that would be reduced to nothing.


for  libstdc++-v3/ChangeLog

	* testsuite/util/testsuite_fs.h (NO_SYMLINKS): Define on
	mingw and when create_symlink is a dummy.
	* testsuite/27_io/filesystem/operations/symlink_status.cc:
	Drop mingw xfail.
	(test01, test02): Don't create symlinks when NO_SYMLINKS is
	defined.
	* testsuite/27_io/filesystem/operations/canonical.cc (test03):
	Likewise.
	* testsuite/27_io/filesystem/operations/copy.cc (test02):
	Likewise.
	* testsuite/27_io/filesystem/operations/create_directories.cc
	(test04): Likewise.
	* testsuite/27_io/filesystem/operations/create_directory.cc
	(test01): Likewise.
	* testsuite/27_io/filesystem/operations/permissions.cc
	(test03, test04): Likewise.
	* testsuite/27_io/filesystem/operations/remove.cc (test01):
	Likewise.
	* testsuite/27_io/filesystem/operations/remove_all.cc (test01):
	Likewise.
	* testsuite/27_io/filesystem/operations/rename.cc
	(test_symlinks): Likewise.
	* testsuite/27_io/filesystem/operations/weakly_canonical.cc
	(test01): Likewise.
	* testsuite/experimental/filesystem/iterators/recursive_directory_iterator.cc
	(test06): Likewise.
	* testsuite/experimental/filesystem/operations/copy.cc
	(test01): Likewise.
	* testsuite/experimental/filesystem/operations/create_directories.cc
	(test04): Likewise.
	* testsuite/experimental/filesystem/operations/create_directory.cc
	(test01): Likewise.
	* testsuite/experimental/filesystem/operations/permissions.cc
	(test03, test04): Likewise.
	* testsuite/experimental/filesystem/operations/remove.cc
	(test01): Likewise.
	* testsuite/experimental/filesystem/operations/remove_all.cc
	(test01): Likewise.
	* testsuite/experimental/filesystem/operations/rename.cc
	(test01): Likewise.
	* testsuite/lib/libstdc++.exp
	(v3_check_preprocessor_condition): Add optional inc parameter.
	Add it to the test program after include bits/c++config.h.
	(check_v3_target_fs_symlinks): New.
	* testsuite/lib/dg-options.exp
	(dg-require-target-fs-symlinks): New.
	* testsuite/27_io/filesystem/operations/read_symlink.cc:
	Replace mingw xfail with require target-fs-symlinks.
	* testsuite/experimental/filesystem/operations/read_symlink.cc:
	Likewise.
2022-06-23 23:25:52 -03:00
Alexandre Oliva 2b86788d7c libstdc++: testsuite: avoid predictable mkstemp
This patch was originally meant to reduce the likelihood that
nonexistent_path() returns the same pathname for from and to.

It was prompted by a target system with a non-random implementation of
mkstemp, that returns a predictable sequence of filenames and selects
the first one that isn't already taken.

That turned out not to be enough: nonexistent_path adds a suffix to
the filename chosen by mkstemp and removes the file it created, so
mkstemp may very well insist on the same basename, and the case that
doesn't use mkstemp doesn't even check whether the file already
exists.

Anyway, by the time I realized this wasn't enough, I'd already
implemented some of the changes, and I figured I might as well
contribute them, even though they don't really solve any problem, and
even if they did, they'd be just a partial solution.


for  libstdc++-v3/ChangeLog

	* testsuite/27_io/filesystem/operations/copy.cc (test02):
	Select TO after creating FROM.
	(test03, test04): Likewise.
	* testsuite/experimental/filesystem/operations/copy.cc
	(test02, test03, test04): Likewise.
2022-06-23 23:25:52 -03:00
Alexandre Oliva 0b2c1781db libstdc++: testsuite: tolerate non-cancelling sleep
Though sleep, nanosleep and clock_nanosleep are all POSIX cancellation
points, not all target systems follow this POSIX requirement.
30_threads/thread/native_handle/cancel.cc will run until it times out
on such systems.

Rather than failing a C++ library test because of a limitation of the
target system, this patch gives the test a chance to successfully
exercise the features it intends to exercise, by introducing a
cancellation point in a loop that would otherwise run indefinitely on
systems exhibiting this limitation.


for  libstdc++-v3/ChangeLog

	* testsuite/30_threads/thread/native_handle/cancel.cc: Add an
	explicit cancellation point in case sleep_for lacks one.
2022-06-23 23:25:52 -03:00
Alexandre Oliva a5bba80e32 libstdc++: testsuite: use -lbsd for net_ts on RTEMS
Networking functions that net_ts tests rely on are defined in libbsd
on RTEMS, so link with it.


for  libstdc++-v3/ChangeLog

	* testsuite/lib/dg-options.exp (add_options_for_net_ts): Add
	-lbsd for RTEMS targets.
2022-06-23 23:25:52 -03:00
GCC Administrator df724ec773 Daily bump. 2022-06-24 00:16:41 +00:00
Jonathan Wakely 7c1c7e120c libstdc++: Properly remove temporary directories in filesystem tests
Although these tests use filesystem::remove_all to clean up, that fails
because it uses recursive_directory_iterator which is intentionally
bodged by the custom readdir defined in the test.

Just use POSIX rmdir to clean up. We don't need to use _rmdir or _wrmdir
for Windows, because we'll never reach test02() on targets where the
custom readdir doesn't interpose the one from libc.

libstdc++-v3/ChangeLog:

	* testsuite/27_io/filesystem/iterators/error_reporting.cc: Use
	rmdir to remove directories.
	* testsuite/experimental/filesystem/iterators/error_reporting.cc:
	Likewise.
2022-06-23 17:19:38 +01:00
Jonathan Wakely 78fd15fd4a libstdc++: Simplify test by not using std::log2
This test uses std::log2 without including <cmath>, but it doesn't need
to use it at all. Just get the number of digits from numeric_limits
instead.

libstdc++-v3/ChangeLog:

	* testsuite/26_numerics/random/random_device/entropy.cc: Use
	numeric_limits<unsigned>::digits.
2022-06-23 12:00:01 +01:00
GCC Administrator 5d0cf15822 Daily bump. 2022-06-23 00:16:40 +00:00
Alexandre Oliva a33dda016e libstdc++: eh_globals: gthreads: reset _S_init before deleting key
Clear __eh_globals_init's _S_init in the dtor before deleting the
gthread key.

This ensures that, in case any code involved in deleting the key
interacts with eh_globals, the key that is being deleted won't be
used, and the non-thread-specific eh_globals fallback will.


for  libstdc++-v3/ChangeLog

	* libsupc++/eh_globals.cc [!_GLIBCXX_HAVE_TLS]
	(__eh_globals_init::~__eh_globals_init): Clear _S_init first.
2022-06-21 23:11:02 -03:00
Alexandre Oliva f129628e8f libstdc++: testsuite: call sched_yield for nonpreemptive targets
As in the gcc testsuite, systems without preemptive multi-threading
require sched_yield calls to be placed at points in which a context
switch might be needed to enable the test to complete.


for  libstdc++-v3/ChangeLog

	* testsuite/30_threads/this_thread/60421.cc (test02): Call
	sched_yield.
2022-06-21 23:11:01 -03:00
Alexandre Oliva 540ae3601e libstdc++: testsuite: require cmath for nexttowardl
nexttowardl is only expected to be available with C99 math, but
20_util/to_chars/long_double.cc uses it unconditionally.

State the cmath requirement in the test.


for  libstdc++-v3/ChangeLog

	* testsuite/20_util/to_chars/long_double.cc: Require cmath.
2022-06-21 23:11:00 -03:00
Alexandre Oliva 345d69a7de libstdc++: testsuite: work around bitset namespace pollution
rtems6 declares a global struct bitset in a header file included
indirectly by sys/types.h, that ambiguates the unqualified references
to bitset after "using namespace std" in the testsuite.

Work around the namespace pollution with using declarations of
std::bitset.


for  libstdc++-v3/ChangeLog

	* testsuite/23_containers/bitset/cons/dr1325-2.cc: Work around
	global struct bitset.
	* testsuite/23_containers/bitset/ext/15361.cc: Likewise.
	* testsuite/23_containers/bitset/input/1.cc: Likewise.
	* testsuite/23_containers/bitset/to_string/1.cc: Likewise.
	* testsuite/23_containers/bitset/to_string/dr396.cc: Likewise.
2022-06-21 23:11:00 -03:00