diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2022-02-08 21:05:30 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2022-02-10 13:01:10 +0000 |
commit | 3d5f4f76e6db0895181ebca538748379bfe6058f (patch) | |
tree | 398290e6c50d9b3b2c3fbdb09225c3c0e3aa6b89 | |
parent | 0f58ba4dd6b25b16d25494ae18d15dfa681f9b65 (diff) | |
download | gcc-3d5f4f76e6db0895181ebca538748379bfe6058f.zip gcc-3d5f4f76e6db0895181ebca538748379bfe6058f.tar.gz gcc-3d5f4f76e6db0895181ebca538748379bfe6058f.tar.bz2 |
libstdc++: Fix directory iterator build for newlib
When building for newlib HAVE_OPENAT and HAVE_UNLINKAT are (sometimes?)
defined, but <fcntl.h> is only included when HAVE_DIRENT_H is defined.
Since directory iterators are completely useless without <dirent.h>,
just override the HAVE_OPENAT and HAVE_UNLINKAT detection when we don't
have <dirent.h>.
libstdc++-v3/ChangeLog:
* src/filesystem/dir-common.h (_GLIBCXX_HAVE_DIRFD): Undefine
when <dirent.h> is not available.
(_GLIBCXX_HAVE_UNLINKAT): Likewise.
-rw-r--r-- | libstdc++-v3/src/filesystem/dir-common.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libstdc++-v3/src/filesystem/dir-common.h b/libstdc++-v3/src/filesystem/dir-common.h index 511b988..365fd52 100644 --- a/libstdc++-v3/src/filesystem/dir-common.h +++ b/libstdc++-v3/src/filesystem/dir-common.h @@ -70,6 +70,8 @@ struct DIR { }; inline DIR* opendir(const char*) { return nullptr; } inline dirent* readdir(DIR*) { return nullptr; } inline int closedir(DIR*) { return -1; } +#undef _GLIBCXX_HAVE_DIRFD +#undef _GLIBCXX_HAVE_UNLINKAT #endif } // namespace __gnu_posix |