aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2023-02-02 16:00:21 +0000
committerJonathan Wakely <jwakely@redhat.com>2023-02-02 16:57:27 +0000
commit5c43f06c228d169c370e99fa009154344fa305b8 (patch)
treeab96262784a3c5c9ae5934379602f72b7e6cc0de /libstdc++-v3
parent331b4f168a06cd85fe40fd03b48b128cc8af399c (diff)
downloadgcc-5c43f06c228d169c370e99fa009154344fa305b8.zip
gcc-5c43f06c228d169c370e99fa009154344fa305b8.tar.gz
gcc-5c43f06c228d169c370e99fa009154344fa305b8.tar.bz2
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.
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/src/filesystem/ops-common.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/libstdc++-v3/src/filesystem/ops-common.h b/libstdc++-v3/src/filesystem/ops-common.h
index 02c75be..abbfca4 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