gcc/libstdc++-v3/testsuite/19_diagnostics
Jonathan Wakely 59ffa3e3db libstdc++: Avoid unconditional use of errc::not_supported [PR 99327]
The errc::not_supported constant is only defined if ENOTSUP is defined,
which is not true for all targets. Many uses of errc::not_supported in
the filesystem library do not actually match the intended meaning of
ENOTSUP described by POSIX. They should be using ENOSYS instead
(i.e. errc::function_not_supported).

This change ensures that appropriate error codes are used by the
filesystem library. The remaining uses of errc::not_supported are
replaced with a call to a new helper function so that an alternative
value will be used on targets that don't support errc::not_supported.

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

libstdc++-v3/ChangeLog:

	PR libstdc++/99327
	* src/filesystem/ops-common.h (__unsupported): New function to
	return a suitable error code for missing functionality.
	(posix::off_t): New typedef.
	(posix::*): Set errno to ENOSYS instead of ENOTSUP for no-op
	fallback implementations.
	(do_copy_file): Replace uses of errc::not_supported.
	* src/c++17/fs_ops.cc (fs::copy, fs::copy_file, create_dir)
	(fs::create_directory, fs::create_directory_symlink)
	(fs::create_hard_link, fs::create_symlink, fs::current_path)
	(fs::equivalent, do_stat, fs::file_size, fs::hard_link_count)
	(fs::last_write_time, fs::permissions, fs::read_symlink):
	Replace uses of errc::not_supported.
	(fs::resize_file): Qualify off_t.
	* src/filesystem/ops.cc (fs::copy, fs::copy_file, create_dir)
	(fs::create_directory, fs::create_directory_symlink)
	(fs::create_hard_link, fs::create_symlink, fs::current_path)
	(fs::equivalent, do_stat, fs::file_size, fs::last_write_time)
	(fs::permissions, fs::read_symlink, fs::system_complete):
	Replace uses of errc::not_supported.
	(fs::resize_file): Qualify off_t and enable unconditionally.
	* testsuite/19_diagnostics/system_error/cons-1.cc: Likewise.
2021-10-01 20:34:50 +01:00
..
error_category libstdc++: Make std::system_category() recognize Windows error codes 2021-09-23 16:07:39 +01:00
error_code libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
error_condition libstdc++: Remove redundant -std=gnu++17 option from remaining tests 2021-05-10 16:22:54 +01:00
headers libstdc++: Disable PCH for test that depends on a macro being defined 2021-09-23 16:07:39 +01:00
logic_error Update copyright years. 2021-01-04 10:26:59 +01:00
runtime_error Update copyright years. 2021-01-04 10:26:59 +01:00
system_error libstdc++: Avoid unconditional use of errc::not_supported [PR 99327] 2021-10-01 20:34:50 +01:00
stdexcept.cc Update copyright years. 2021-01-04 10:26:59 +01:00