From 3d5f4f76e6db0895181ebca538748379bfe6058f Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Tue, 8 Feb 2022 21:05:30 +0000 Subject: [PATCH] libstdc++: Fix directory iterator build for newlib When building for newlib HAVE_OPENAT and HAVE_UNLINKAT are (sometimes?) defined, but is only included when HAVE_DIRENT_H is defined. Since directory iterators are completely useless without , just override the HAVE_OPENAT and HAVE_UNLINKAT detection when we don't have . libstdc++-v3/ChangeLog: * src/filesystem/dir-common.h (_GLIBCXX_HAVE_DIRFD): Undefine when is not available. (_GLIBCXX_HAVE_UNLINKAT): Likewise. --- libstdc++-v3/src/filesystem/dir-common.h | 2 ++ 1 file changed, 2 insertions(+) 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 -- 2.7.4