From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id B8327385B520; Thu, 16 Mar 2023 16:51:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B8327385B520 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678985482; bh=nnL4LeEfR673HUnUXJm0JWEi3jFiXVepTdyG9x7ywKA=; h=From:To:Subject:Date:From; b=lySIjkCX7yLt1VTOs3TfWH5b4lYrrQfjqokR8fgOhZGAeSnIX6n9FPE4uz4eeVcsI wQD7xG0dKYfvV1tD/VtiB6UQ06SEQLMHBqaEiBD7myNOjLP6g9agO414AOSmqwmJ1D RrA9e2kvUgNygF0sFBDw34OsiP8xglR9k8hvFsYw= 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 r11-10580] libstdc++: Horrible macro hacks to allow building on avr X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: f99b97015f16ee3d8d4656666cd7594555fafbf9 X-Git-Newrev: 061700c9f6f0f9f4219ddeb236d55764b42869b6 Message-Id: <20230316165122.B8327385B520@sourceware.org> Date: Thu, 16 Mar 2023 16:51:22 +0000 (GMT) List-Id: https://gcc.gnu.org/g:061700c9f6f0f9f4219ddeb236d55764b42869b6 commit r11-10580-g061700c9f6f0f9f4219ddeb236d55764b42869b6 Author: Jonathan Wakely Date: Thu Feb 2 18:03:26 2023 +0000 libstdc++: Horrible macro hacks to allow building on avr In r12-4071-g59ffa3e3dba5a7 I added a new __unsupported() function and replaced all std::filesystem's uses of std::errc::not_supported and ENOTSUP with a call to that function. Then in r13-5664-g5c43f06c228d16 that function was tweaked to use ENOSYS instead of EOPNOTSUP for avr, due to limitations of on avr-libc. In the gcc-11 branch we don't have __unsupported(), so we get loads and loads of failures when trying to compile the src/c++17/fs_*.cc files. This horrible hack uses macros to redefine not_supported and ENOTSUP as function_not_supported and ENOSYS respectively, to fix the build for avr. libstdc++-v3/ChangeLog: * src/c++17/fs_ops.cc [AVR] (not_supported): Define as a macro for function_not_supported. * src/filesystem/ops-common.h [AVR] (ENOTSUP): Define as a macro for ENOSYS. Diff: --- libstdc++-v3/src/c++17/fs_ops.cc | 4 ++++ libstdc++-v3/src/filesystem/ops-common.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/libstdc++-v3/src/c++17/fs_ops.cc b/libstdc++-v3/src/c++17/fs_ops.cc index 4155b4d64b9..802894ea5b5 100644 --- a/libstdc++-v3/src/c++17/fs_ops.cc +++ b/libstdc++-v3/src/c++17/fs_ops.cc @@ -61,6 +61,10 @@ #define _GLIBCXX_END_NAMESPACE_FILESYSTEM } #include "../filesystem/ops-common.h" +#ifdef __AVR__ +# define not_supported function_not_supported +#endif + #pragma GCC diagnostic ignored "-Wunused-parameter" namespace fs = std::filesystem; diff --git a/libstdc++-v3/src/filesystem/ops-common.h b/libstdc++-v3/src/filesystem/ops-common.h index 54bafff2a9c..a680a51c984 100644 --- a/libstdc++-v3/src/filesystem/ops-common.h +++ b/libstdc++-v3/src/filesystem/ops-common.h @@ -170,6 +170,10 @@ namespace __gnu_posix # endif using char_type = char; #else // ! _GLIBCXX_FILESYSTEM_IS_WINDOWS && ! _GLIBCXX_HAVE_UNISTD_H +#ifdef __AVR__ +# define ENOTSUP ENOSYS +#endif + inline int open(const char*, int, ...) { errno = ENOTSUP; return -1; } inline int close(int) { errno = ENOTSUP; return -1; } using mode_t = int;