public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-9905] libstdc++: Use ENOSYS for unsupported filesystem ops on AVR
@ 2023-10-03 16:10 Jonathan Wakely
0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2023-10-03 16:10 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:7d6bfe901594b59d8ee5bd6d841f623a90e9b2d1
commit r12-9905-g7d6bfe901594b59d8ee5bd6d841f623a90e9b2d1
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Feb 2 16:00:21 2023 +0000
libstdc++: Use ENOSYS for unsupported filesystem ops on AVR
Because avr-libc <errno.h> defines most error numbers with duplicate
values it's not sufficient to check #ifdef ENOTSUP when deciding which
std::errc constant to use for the filesystem library's __unsupported()
helper. Add a special case for AVR to always use the ENOSYS value.
libstdc++-v3/ChangeLog:
* src/filesystem/ops-common.h [AVR] (__unsupported): Always use
errc::function_not_supported instead of errc::not_supported.
(cherry picked from commit 5c43f06c228d169c370e99fa009154344fa305b8)
Diff:
---
libstdc++-v3/src/filesystem/ops-common.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libstdc++-v3/src/filesystem/ops-common.h b/libstdc++-v3/src/filesystem/ops-common.h
index edada8cd258..dd67a4b155a 100644
--- a/libstdc++-v3/src/filesystem/ops-common.h
+++ b/libstdc++-v3/src/filesystem/ops-common.h
@@ -84,7 +84,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
inline error_code
__unsupported() noexcept
{
-#if defined ENOTSUP
+#if defined __AVR__
+ // avr-libc defines ENOTSUP and EOPNOTSUPP but with nonsense values.
+ // ENOSYS is defined though, so use an error_code corresponding to that.
+ // This contradicts the comment above, but we don't have much choice.
+ return std::make_error_code(std::errc::function_not_supported);
+#elif defined ENOTSUP
return std::make_error_code(std::errc::not_supported);
#elif defined EOPNOTSUPP
// This is supposed to be for socket operations
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-10-03 16:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-03 16:10 [gcc r12-9905] libstdc++: Use ENOSYS for unsupported filesystem ops on AVR Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).