Revision tags: llvmorg-21-init, llvmorg-19.1.7 |
|
#
2b26ee6e |
| 08-Jan-2025 |
James Y Knight <jyknight@google.com> |
[libcxx] Handle windows system error code mapping in std::error_code. (#93101)
The `std::error_code`/`std::error_category` functionality is designed to
support multiple error domains. On Unix, both
[libcxx] Handle windows system error code mapping in std::error_code. (#93101)
The `std::error_code`/`std::error_category` functionality is designed to
support multiple error domains. On Unix, both system calls and libc
functions return the same error codes, and thus, libc++ today treats
`generic_category()` and `system_category()` as being equivalent.
However, on Windows, libc functions return `errno.h` error codes in the
`errno` global, but system calls return the very different `winerror.h`
error codes via `GetLastError()`.
As such, there is a need to map the winerror.h error codes into generic
errno codes. In libc++, however, the system_error facility does not
implement this mapping; instead the mapping is hidden inside libc++,
used directly by the std::filesystem implementation.
That has a few problems:
1. For std::filesystem APIs, the concrete windows error number is lost,
before users can see it. The intent of the distinction between
std::error_code and std::error_condition is that the error_code return
has the original (potentially more detailed) error code.
2. User-written code which calls Windows system APIs requires this same
mapping, so it also can also return error_code objects that other
(cross-platform) code can understand.
After this commit, an `error_code` with `generic_category()` is used to
report an error from `errno`, and, on Windows only, an `error_code` with
`system_category()` is used to report an error from `GetLastError()`. On
Unix, system_category remains identity-mapped to generic_category, but
is never used by libc++ itself.
The windows error code mapping is moved into system_error, so that
conversion of an `error_code` to `error_condition` correctly translates
the `system_category()` code into a `generic_category()` code, when
appropriate.
This allows code like:
`error_code(GetLastError(), system_category()) == errc::invalid_argument`
to work as expected -- as it does with MSVC STL.
(Continued from old phabricator review [D151493](https://reviews.llvm.org/D151493))
show more ...
|
Revision tags: llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4, llvmorg-19.1.3, llvmorg-19.1.2 |
|
#
ba87515f |
| 12-Oct-2024 |
Nikolas Klauser <nikolasklauser@berlin.de> |
[libc++][RFC] Always define internal feature test macros (#89178)
Currently, the library-internal feature test macros are only defined if
the feature is not available, and always have the prefix
`
[libc++][RFC] Always define internal feature test macros (#89178)
Currently, the library-internal feature test macros are only defined if
the feature is not available, and always have the prefix
`_LIBCPP_HAS_NO_`. This patch changes that, so that they are always
defined and have the prefix `_LIBCPP_HAS_` instead. This changes the
canonical use of these macros to `#if _LIBCPP_HAS_FEATURE`, which means
that using an undefined macro (e.g. due to a missing include) is
diagnosed now. While this is rather unlikely currently, a similar change
in `<__configuration/availability.h>` caught a few bugs. This also
improves readability, since it removes the double-negation of `#ifndef
_LIBCPP_HAS_NO_FEATURE`.
The current patch only touches the macros defined in `<__config>`. If
people are happy with this approach, I'll make a follow-up PR to also
change the macros defined in `<__config_site>`.
show more ...
|
Revision tags: llvmorg-19.1.1, llvmorg-19.1.0 |
|
#
953af0e7 |
| 05-Sep-2024 |
Louis Dionne <ldionne.2@gmail.com> |
[libc++][NFC] Increase consistency for namespace closing comments
|
Revision tags: llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init |
|
#
4f215fdd |
| 06-Jan-2024 |
Konstantin Varlamov <varconsteq@gmail.com> |
[libc++][hardening] Categorize more assertions. (#75918)
Also introduce `_LIBCPP_ASSERT_PEDANTIC` for assertions violating which
results in a no-op or other benign behavior, but which may neverthel
[libc++][hardening] Categorize more assertions. (#75918)
Also introduce `_LIBCPP_ASSERT_PEDANTIC` for assertions violating which
results in a no-op or other benign behavior, but which may nevertheless
indicate a bug in the invoking code.
show more ...
|
#
9783f28c |
| 18-Dec-2023 |
Louis Dionne <ldionne.2@gmail.com> |
[libc++] Format the code base (#74334)
This patch runs clang-format on all of libcxx/include and libcxx/src, in
accordance with the RFC discussed at [1]. Follow-up patches will format
the benchmar
[libc++] Format the code base (#74334)
This patch runs clang-format on all of libcxx/include and libcxx/src, in
accordance with the RFC discussed at [1]. Follow-up patches will format
the benchmarks, the test suite and remaining parts of the code. I'm
splitting this one into its own patch so the diff is a bit easier to
review.
This patch was generated with:
find libcxx/include libcxx/src -type f \
| grep -v 'module.modulemap.in' \
| grep -v 'CMakeLists.txt' \
| grep -v 'README.txt' \
| grep -v 'libcxx.imp' \
| grep -v '__config_site.in' \
| xargs clang-format -i
A Git merge driver is available in libcxx/utils/clang-format-merge-driver.sh
to help resolve merge and rebase issues across these formatting changes.
[1]: https://discourse.llvm.org/t/rfc-clang-formatting-all-of-libc-once-and-for-all
show more ...
|
Revision tags: llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0, llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init |
|
#
5a6c1ce1 |
| 21-Jul-2023 |
Louis Dionne <ldionne.2@gmail.com> |
[libc++] Change _LIBCPP_CONSTEXPR_SINCE_XXX to constexpr in the dylib
Since we build the dylib with C++20, there's no need to use conditional macros anymore.
Differential Revision: https://reviews.
[libc++] Change _LIBCPP_CONSTEXPR_SINCE_XXX to constexpr in the dylib
Since we build the dylib with C++20, there's no need to use conditional macros anymore.
Differential Revision: https://reviews.llvm.org/D157995
show more ...
|
#
cd0ad421 |
| 27-Jun-2023 |
varconst <varconsteq@gmail.com> |
[libc++][hardening][NFC] Introduce `_LIBCPP_ASSERT_UNCATEGORIZED`.
Replace most uses of `_LIBCPP_ASSERT` with `_LIBCPP_ASSERT_UNCATEGORIZED`.
This is done as a prerequisite to introducing hardened
[libc++][hardening][NFC] Introduce `_LIBCPP_ASSERT_UNCATEGORIZED`.
Replace most uses of `_LIBCPP_ASSERT` with `_LIBCPP_ASSERT_UNCATEGORIZED`.
This is done as a prerequisite to introducing hardened mode to libc++. The idea is to make enabling assertions an opt-in with (somewhat) fine-grained controls over which categories of assertions are enabled. The vast majority of assertions are currently uncategorized; the new macro will allow turning on `_LIBCPP_ASSERT` (the underlying mechanism for all kinds of assertions) without enabling all the uncategorized assertions (in the future; this patch preserves the current behavior).
Differential Revision: https://reviews.llvm.org/D153816
show more ...
|
Revision tags: llvmorg-16.0.6 |
|
#
21853b96 |
| 05-Jun-2023 |
Louis Dionne <ldionne.2@gmail.com> |
[libc++][filesystem] Avoid using anonymous namespaces in support headers
This avoids using anonymous namespaces in headers and ensures that the various helper functions get deduplicated across the T
[libc++][filesystem] Avoid using anonymous namespaces in support headers
This avoids using anonymous namespaces in headers and ensures that the various helper functions get deduplicated across the TUs implementing <filesystem>. Otherwise, we'd get a definition of these helper functions in each TU where they are used, which is entirely unnecessary.
Differential Revision: https://reviews.llvm.org/D152378
show more ...
|
#
c7d3c844 |
| 12-Jun-2023 |
Louis Dionne <ldionne.2@gmail.com> |
[libc++] Split sources for <filesystem>
The operations.cpp file contained the implementation of a ton of functionality unrelated to just the filesystem operations, and filesystem_common.h contained
[libc++] Split sources for <filesystem>
The operations.cpp file contained the implementation of a ton of functionality unrelated to just the filesystem operations, and filesystem_common.h contained a lot of unrelated functionality as well.
Splitting this up into more files will make it possible in the future to support parts of <filesystem> (e.g. path) on systems where there is no notion of a filesystem.
Differential Revision: https://reviews.llvm.org/D152377
show more ...
|