-
- Downloads
libstdc++: Fix build failures for avr
The abr-libc <errno.h> does not define EOVERFLOW, which means that std::errc::value_too_large is not defined, and so <charconv> cannot be compiled. Define value_too_large for avr with a value that does not clash with any that is defined in <errno.h>. This is a kluge to fix bootstrap for avr; it can be removed after PR libstdc++/104883 is resolved. The avr-libc <errno.h> fails to meet the C and POSIX requirements that each error macro has a distinct integral value, and is usable in #if directives. Add a special case for avr to system_error.cc so that only the valid errors are recognized. Also disable the errno checks in std::filesystem::remove_all that assume a meaningful value for errno. On avr-libc <unistd.h> exists but does not define the POSIX functions needed by std::filesystem, so _GLIBCXX_HAVE_UNISTD_H is not sufficient to check for basic POSIX APIs. Check !defined __AVR__ as well as _GLIBCXX_HAVE_UNISTD_H before using those functions. This is a kluge and we should really have a specific macro that says the required functions are available. libstdc++-v3/ChangeLog: * config/os/generic/error_constants.h (errc::value_too_large) [__AVR__]: Define. * src/c++11/system_error.cc (system_category::default_error_condition) [__AVR__]: Only match recognize values equal to EDOM, ERANGE, ENOSYS and EINTR. * src/c++17/fs_ops.cc (fs::current_path) [__AVR__]: Do not check for ENOENT etc. in switch. (fs::remove_all) [__AVR__]: Likewise. * src/filesystem/ops-common.h [__AVR__]: Do not use POSIX open, close etc.
Showing
- libstdc++-v3/config/os/generic/error_constants.h 2 additions, 0 deletionslibstdc++-v3/config/os/generic/error_constants.h
- libstdc++-v3/src/c++11/system_error.cc 9 additions, 0 deletionslibstdc++-v3/src/c++11/system_error.cc
- libstdc++-v3/src/c++17/fs_ops.cc 5 additions, 1 deletionlibstdc++-v3/src/c++17/fs_ops.cc
- libstdc++-v3/src/filesystem/ops-common.h 1 addition, 1 deletionlibstdc++-v3/src/filesystem/ops-common.h
Loading
Please register or sign in to comment