From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id DC7B03858C52; Thu, 2 Feb 2023 18:04:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DC7B03858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675361076; bh=S8Nz0ToQn8XzEE9IChGUYHKg60+c4lFPooOnsPIZWX4=; h=From:To:Subject:Date:From; b=CpaZOgceRXvtuFYyVwAhRI7qbh2DA0eIPRJ/XoCBCiQNRHBnAjgAnX5xNSjraDo+F pyN1jXQI4srBcLFzYQhHwxW5gB6VCG+K+dt7aBWhCWG0trFOMqxpkdJXik0r6vs8Pv Rvl29cwtOqNrBHCLzSzW7Yd3/gz9K5kevPBMPCuM= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-5664] libstdc++: Use ENOSYS for unsupported filesystem ops on AVR X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 331b4f168a06cd85fe40fd03b48b128cc8af399c X-Git-Newrev: 5c43f06c228d169c370e99fa009154344fa305b8 Message-Id: <20230202180436.DC7B03858C52@sourceware.org> Date: Thu, 2 Feb 2023 18:04:36 +0000 (GMT) List-Id: https://gcc.gnu.org/g:5c43f06c228d169c370e99fa009154344fa305b8 commit r13-5664-g5c43f06c228d169c370e99fa009154344fa305b8 Author: Jonathan Wakely Date: Thu Feb 2 16:00:21 2023 +0000 libstdc++: Use ENOSYS for unsupported filesystem ops on AVR Because avr-libc 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. 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 02c75be09d2..abbfca43e5c 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