-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libcxx] Handle windows system error code mapping in std::error_code. #93101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2bfbd98
[libcxx] Handle windows system error code mapping in std::error_code.
jyknight 3fa6aaf
Merge commit '9783f28cbb155e4a8d49c12e1c60ce14dcfaf0c7~' into win-err…
jyknight 3b688f3
Merge commit '9783f28cbb155e4a8d49c12e1c60ce14dcfaf0c7' into win-erro…
jyknight c4258ce
Merge remote-tracking branch 'origin/main' into win-error-codes-3
jyknight 0ff332a
Fix semantic merge conflict.
jyknight 8e3979e
Add missing include (should fix "generic-no-localization" builder)
jyknight fcce725
Merge remote-tracking branch 'origin/main' into win-error-codes-3
jyknight 1533c10
Address review comments.
jyknight cf0fbb2
Clang-format the switch statement.
jyknight 87d7e19
Restore includes; they are needed in modules build.
jyknight eda4021
Merge remote-tracking branch 'origin/main' into win-error-codes-3
jyknight 5c9d5c0
Add release note.
jyknight a7b4dfb
Add missing return statement in test.
jyknight cd954c6
Merge remote-tracking branch 'origin/main' into win-error-codes-3
jyknight File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -201,7 +201,7 @@ inline perms posix_get_perms(const StatT& st) noexcept { return static_cast<perm | |
inline file_status create_file_status(error_code& m_ec, path const& p, const StatT& path_stat, error_code* ec) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not attached to this line: Can you add a release note in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
if (ec) | ||
*ec = m_ec; | ||
if (m_ec && (m_ec.value() == ENOENT || m_ec.value() == ENOTDIR)) { | ||
if (m_ec && (m_ec == errc::no_such_file_or_directory || m_ec == errc::not_a_directory)) { | ||
return file_status(file_type::not_found); | ||
} else if (m_ec) { | ||
ErrorHandler<void> err("posix_stat", ec, &p); | ||
|
@@ -236,7 +236,7 @@ inline file_status create_file_status(error_code& m_ec, path const& p, const Sta | |
inline file_status posix_stat(path const& p, StatT& path_stat, error_code* ec) { | ||
error_code m_ec; | ||
if (detail::stat(p.c_str(), &path_stat) == -1) | ||
m_ec = detail::capture_errno(); | ||
m_ec = detail::get_last_error(); | ||
return create_file_status(m_ec, p, path_stat, ec); | ||
} | ||
|
||
|
@@ -248,7 +248,7 @@ inline file_status posix_stat(path const& p, error_code* ec) { | |
inline file_status posix_lstat(path const& p, StatT& path_stat, error_code* ec) { | ||
error_code m_ec; | ||
if (detail::lstat(p.c_str(), &path_stat) == -1) | ||
m_ec = detail::capture_errno(); | ||
m_ec = detail::get_last_error(); | ||
return create_file_status(m_ec, p, path_stat, ec); | ||
} | ||
|
||
|
@@ -260,7 +260,7 @@ inline file_status posix_lstat(path const& p, error_code* ec) { | |
// http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html | ||
inline bool posix_ftruncate(const FileDescriptor& fd, off_t to_size, error_code& ec) { | ||
if (detail::ftruncate(fd.fd, to_size) == -1) { | ||
ec = capture_errno(); | ||
ec = get_last_error(); | ||
return true; | ||
} | ||
ec.clear(); | ||
|
@@ -269,7 +269,7 @@ inline bool posix_ftruncate(const FileDescriptor& fd, off_t to_size, error_code& | |
|
||
inline bool posix_fchmod(const FileDescriptor& fd, const StatT& st, error_code& ec) { | ||
if (detail::fchmod(fd.fd, st.st_mode) == -1) { | ||
ec = capture_errno(); | ||
ec = get_last_error(); | ||
return true; | ||
} | ||
ec.clear(); | ||
|
@@ -286,7 +286,7 @@ inline file_status FileDescriptor::refresh_status(error_code& ec) { | |
m_stat = {}; | ||
error_code m_ec; | ||
if (detail::fstat(fd, &m_stat) == -1) | ||
m_ec = capture_errno(); | ||
m_ec = get_last_error(); | ||
m_status = create_file_status(m_ec, name, m_stat, &ec); | ||
return m_status; | ||
} | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.