mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-01 18:22:27 +00:00
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:
parent
0d7c272d3f
commit
77d3a07ff2
14 changed files with 408 additions and 69 deletions
22
test/libcxx/errc_test.cc
Normal file
22
test/libcxx/errc_test.cc
Normal 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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue