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.
This commit is contained in:
Jonathan Wakely 2022-02-08 21:05:30 +00:00
parent 0f58ba4dd6
commit 3d5f4f76e6
1 changed files with 2 additions and 0 deletions

View File

@ -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