Fix std::filesystem

This change makes a second pass, at fixing the errno issue with libcxx's
filesystem code. Previously, 89.01% of LLVM's test suite was passing and
now 98.59% of their tests pass. Best of all, it's now possible for Clang
to be built as a working APE binary that can to compile the Cosmopolitan
repository. Please note it has only been vetted so far for some objects,
and more work would obviously need to be done in cosmo, to fix warnings.
This commit is contained in:
Justine Tunney 2024-07-28 17:25:20 -07:00
parent 0d7c272d3f
commit 77d3a07ff2
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
14 changed files with 408 additions and 69 deletions

22
test/libcxx/errc_test.cc Normal file
View file

@ -0,0 +1,22 @@
#include <cerrno>
#include <system_error>
bool test_errc_mapping(int posix_error, std::errc expected_errc) {
std::error_code ec(posix_error, std::generic_category());
return ec.value() == posix_error && //
std::error_condition(expected_errc) == ec;
}
int main() {
if (!test_errc_mapping(EACCES, std::errc::permission_denied))
return 1;
if (!test_errc_mapping(ENOENT, std::errc::no_such_file_or_directory))
return 2;
if (!test_errc_mapping(EEXIST, std::errc::file_exists))
return 3;
if (!test_errc_mapping(EINVAL, std::errc::invalid_argument))
return 4;
if (!test_errc_mapping(ENOSPC, std::errc::no_space_on_device))
return 5;
return 0;
}