aboutsummaryrefslogtreecommitdiff
path: root/libcxx/src
AgeCommit message (Collapse)AuthorFilesLines
2024-03-03[libc++][NFC] Replace _ALIGNAS_TYPE with alignas in iostream.cppNikolas Klauser1-22/+14
2024-02-29[libc++] Include missing <__assert> after #80091 (#83480)Fangrui Song1-0/+1
_LIBCPP_ASSERT_SHIM used by the -fno-exceptions and LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS=on configuration needs _LIBCPP_ASSERT from <__assert>.
2024-02-26[libc++] Always keep libc++abi re-exports up-to-date (#79012)Louis Dionne1-7/+2
Previously, the list of libc++abi symbols that we re-export from libc++ would be partly encoded in libc++abi (and re-exported automatically via the cxxabi-reexports target), and partly hard-coded in libcxx/lib/libc++abi.exp. The duplication of information led to symbols not being exported from libc++ after being added to libc++abi when they should have been. This patch removes the duplication of information. After this patch, the full list of symbols to re-export from libc++abi is handled by the cxxabi-reexports target and is stored in libcxxabi. The symbols newly re-exported from libc++ are mainly new fundamental typeinfos and a bunch of functions and classes that are part of libc++abi but are most likely implementation details. In the future, it would be possible to try to trim down the set of what we export from libc++abi (and hence what we re-export from libc++) to remove some implementation detail symbols. Fixes #79008
2024-02-19[libc++] Refactor the predicate taking variant of `__cxx_atomic_wait` (#80596)Jan Kokemüller1-0/+1
This is a follow-up PR to <https://github.com/llvm/llvm-project/pull/79265>. It aims to be a gentle refactoring of the `__cxx_atomic_wait` function that takes a predicate. The key idea here is that this function's signature is changed to look like this (`std::function` used just for clarity): ```c++ __cxx_atomic_wait_fn(Atp*, std::function<bool(Tp &)> poll, memory_order __order); ``` ...where `Tp` is the corresponding `value_type` to the atomic variable type `Atp`. The function's semantics are similar to `atomic`s `.wait()`, but instead of having a hardcoded predicate (is the loaded value unequal to `old`?) the predicate is specified explicitly. The `poll` function may change its argument, and it is very important that if it returns `false`, it leaves its current understanding of the atomic's value in the argument. Internally, `__cxx_atomic_wait_fn` dispatches to two waiting mechanisms, depending on the type of the atomic variable: 1. If the atomic variable can be waited on directly (for example, Linux's futex mechanism only supports waiting on 32 bit long variables), the value of the atomic variable (which `poll` made its decision on) is then given to the underlying system wait function (e.g. futex). 2. If the atomic variable can not be waited on directly, there is a global pool of atomics that are used for this task. The ["eventcount" pattern](<https://gist.github.com/mratsim/04a29bdd98d6295acda4d0677c4d0041>) is employed to make this possible. The eventcount pattern needs a "monitor" variable which is read before the condition is checked another time. libcxx has the `__libcpp_atomic_monitor` function for this. However, this function only has to be called in case "2", i.e. when the eventcount is actually used. In case "1", the futex is used directly, so the monitor must be the value of the atomic variable that the `poll` function made its decision on to continue blocking. Previously, `__libcpp_atomic_monitor` was _also_ used in case "1". This was the source of the ABA style bug that PR#79265 fixed. However, the solution in PR#79265 has some disadvantages: - It exposes internals such as `cxx_contention_t` or the fact that `__libcpp_thread_poll_with_backoff` needs two functions to higher level constructs such as `semaphore`. - It doesn't prevent consumers calling `__cxx_atomic_wait` in an error prone way, i.e. by providing to it a predicate that doesn't take an argument. This makes ABA style issues more likely to appear. Now, `__cxx_atomic_wait_fn` takes just _one_ function, which is then transformed into the `poll` and `backoff` callables needed by `__libcpp_thread_poll_with_backoff`. Aside from the `__cxx_atomic_wait` changes, the only other change is the weakening of the initial atomic load of `semaphore`'s `try_acquire` into `memory_order_relaxed` and the CAS inside the loop is changed from `strong` to `weak`. Both weakenings should be fine, since the CAS is called in a loop, and the "acquire" semantics of `try_acquire` come from the CAS, not from the initial load.
2024-02-17[libc++][chrono] Loads tzdata.zi in tzdb. (#74928)Mark de Wever10-216/+994
This implements the loading of the tzdata.zi file and store its contents in the tzdb struct. This adds all required members except: - the leap seconds, - the locate_zone, and - current_zone. The class time_zone is incomplete and only contains the parts needed for storing the parsed data. The class time_zone_link is fully implemented including its non-member functions. Implements parts of: - P0355 Extending <chrono> to Calendars and Time Zones - P1614 The Mothership has Landed Implements: - P1982 Rename link to time_zone_link
2024-02-10[libc++][print] Moves is_terminal to the dylib. (#80464)Mark de Wever1-9/+16
Having the test in the header requires including unistd.h on POSIX platforms. This header has other declarations which may conflict with code that uses named declarations provided by this header. For example code using "int pipe;" would conflict with the function pipe in this header. Moving the code to the dylib means std::print would not be available on Apple backdeployment targets. On POSIX platforms there is no transcoding required so a not Standard conforming implementation is still a useful and the observable differences are minimal. This behaviour has been done for print before https://github.com/llvm/llvm-project/pull/76293. Note questions have been raised in LWG4044 "Confusing requirements for std::print on POSIX platforms", whether or not the isatty check on POSIX platforms is required. When this LWG issue is resolved the backdeployment targets could become Standard compliant. This patch is intended to be backported to the LLVM-18 branch. Fixes: https://github.com/llvm/llvm-project/issues/79782
2024-02-03[libc++] Move the locale support headers to __locale_dir/locale_base_api/ ↵Nikolas Klauser1-3/+1
(#74522) Differential Revision: https://reviews.llvm.org/D147869
2024-01-30[libc++] Split the monolithic __threading_support header (#79654)Louis Dionne4-4/+4
The <__threading_support> header is a huge beast and it's really difficult to navigate. I find myself struggling to find what I want every time I have to open it, and I've been considering splitting it up for years for that reason. This patch aims not to contain any functional change. The various implementations of the threading base are simply moved to separate headers and then the individual headers are simplified in mechanical ways. For example, we used to have redundant declarations of all the functions at the top of `__threading_support`, and those are removed since they are not needed anymore. The various #ifdefs are also simplified and removed when they become unnecessary. Finally, this patch adds documentation for the API we expect from any threading implementation.
2024-01-29[libc++] Fix filesystem::remove_all() on FreeBSD (#79540)Mark Johnston1-2/+3
remove_all_impl() opens the target path with O_NOFOLLOW, which fails if the target is a symbolic link. On FreeBSD, rather than returning ELOOP, openat() returns EMLINK. This is unlikely to change for compatibility reasons, see https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=214633 . Thus, check for EMLINK as well.
2024-01-22[libc++] Fix the behavior of throwing `operator new` under -fno-exceptions ↵Louis Dionne2-26/+196
(#69498) In D144319, Clang tried to land a change that would cause some functions that are not supposed to return nullptr to optimize better. As reported in https://reviews.llvm.org/D144319#4203982, libc++ started seeing failures in its CI shortly after this change was landed. As explained in D146379, the reason for these failures is that libc++'s throwing `operator new` can in fact return nullptr when compiled with exceptions disabled. However, this contradicts the Standard, which clearly says that the throwing version of `operator new(size_t)` should never return nullptr. This is actually a long standing issue. I've previously seen a case where LTO would optimize incorrectly based on the assumption that `operator new` doesn't return nullptr, an assumption that was violated in that case because libc++.dylib was compiled with -fno-exceptions. Unfortunately, fixing this is kind of tricky. The Standard has a few requirements for the allocation functions, some of which are impossible to satisfy under -fno-exceptions: 1. `operator new(size_t)` must never return nullptr 2. `operator new(size_t, nothrow_t)` must call the throwing version and return nullptr on failure to allocate 3. We can't throw exceptions when compiled with -fno-exceptions In the case where exceptions are enabled, things work nicely. `new(size_t)` throws and `new(size_t, nothrow_t)` uses a try-catch to return nullptr. However, when compiling the library with -fno-exceptions, we can't throw an exception from `new(size_t)`, and we can't catch anything from `new(size_t, nothrow_t)`. The only thing we can do from `new(size_t)` is actually abort the program, which does not make it possible for `new(size_t, nothrow_t)` to catch something and return nullptr. This patch makes the following changes: 1. When compiled with -fno-exceptions, the throwing version of `operator new` will now abort on failure instead of returning nullptr on failure. This resolves the issue that the compiler could mis-compile based on the assumption that nullptr is never returned. This constitutes an API and ABI breaking change for folks compiling the library with -fno-exceptions (which is not the general public, who merely uses libc++ headers but use a shared library that has already been compiled). This should mostly impact vendors and other folks who compile libc++.dylib themselves. 2. When the library is compiled with -fexceptions, the nothrow version of `operator new` has no change. When the library is compiled with -fno-exceptions, the nothrow version of `operator new` will now check whether the throwing version of `operator new` has been overridden. If it has not been overridden, then it will use an implementation equivalent to that of the throwing `operator new`, except it will return nullptr on failure to allocate (instead of terminating). However, if the throwing `operator new` has been overridden, it is now an error NOT to also override the nothrow `operator new`. Indeed, there is no way for us to implement a valid nothrow `operator new` without knowing the exact implementation of the throwing version. In summary, this change will impact people who fall into the following intersection of conditions: - They use the libc++ shared/static library built with `-fno-exceptions` - They do not override `operator new(..., std::nothrow_t)` - They override `operator new(...)` (the throwing version) - They use `operator new(..., std::nothrow_t)` We believe this represents a small number of people. Fixes #60129 rdar://103958777 Differential Revision: https://reviews.llvm.org/D150610
2024-01-22[libc++][hardening] Classify assertions related to leaks and syscalls. (#77164)Konstantin Varlamov3-7/+25
Introduce two new categories: - `_LIBCPP_ASSERT_VALID_DEALLOCATION`; - `_LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL`.
2024-01-22[libc++] Fix linking for platforms that don't implement std::exception_ptr ↵itrofimow1-0/+6
(#79040) This patch fixes linkage for platforms that don't implement std::exception_ptr, as such setup was overlooked in #65534.
2024-01-22[libc++] Fix noexcept behaviour of operator new helper functions (#74337)azhan921-2/+2
This patch removes the noexcept specifier introduced in #69407 since the Standard allows a new handler to throw an exception of type bad_alloc (or derived from it). With the noexcept specifier on the helper functions, we would immediately terminate the program. The patch also adds tests for the case that had regressed. Co-authored-by: Alison Zhang <alisonzhang@ibm.com>
2024-01-22[libc++abi] Implement __cxa_init_primary_exception and use it to optimize ↵itrofimow2-0/+16
std::make_exception_ptr (#65534) This patch implements __cxa_init_primary_exception, an extension to the Itanium C++ ABI. This extension is already present in both libsupc++ and libcxxrt. This patch also starts making use of this function in std::make_exception_ptr: instead of going through a full throw/catch cycle, we are now able to initialize an exception directly, thus making std::make_exception_ptr around 30x faster.
2024-01-21[NFC][libc++] tab -> spaceMark de Wever1-1/+1
2024-01-21[libc++] Install modules. (#75741)Mark de Wever1-0/+5
Installs the source files of the experimental libc++ modules. These source files (.cppm) are used by the Clang to build the std and std.compat modules. The design of this patch is based on a discussing in SG-15 on 12.12.2023. (SG-15 is the ISO C++ Tooling study group): - The modules are installed at a location, that is not known to build systems and compilers. - Next to the library there will be a module manifest json file. This json file contains the information to build the module from the libraries sources. This information includes the location where the sources are installed. @ruoso supplied the specification of this json file. - If possible, the compiler has an option to give the location of the module manifest file (https://github.com/llvm/llvm-project/pull/76451). Currently there is no build system support, but it expected to be added in the future. Fixes: https://github.com/llvm/llvm-project/issues/73089
2024-01-20[libc++][hardening] Categorize assertions that produce incorrect results ↵Konstantin Varlamov2-4/+3
(#77183) Introduce a new `argument-within-domain` category that covers cases where the given arguments make it impossible to produce a correct result (or create a valid object in case of constructors). While the incorrect result doesn't create an immediate problem within the library (like e.g. a null pointer dereference would), it always indicates a logic error in user code and is highly likely to lead to a bug in the program once the value is used.
2024-01-16[libc++][print] Enables it on Apple backdeployment. (#76293)Mark de Wever1-1/+1
As suggested in #73262 this enable the stream printing on Apple backdeployment targets. This omits the check whether the file is a terminal. This is not entirely conforming, but the differences should be minor and are typically not observable. Fixes https://github.com/llvm/llvm-project/issues/75225
2024-01-11[libc++] Re-export libc++abi symbols on Apple platforms when using ↵a-n-n-a-l-e-e1-1/+1
system-libcxxabi (#77218) When using LIBCXX_CXX_ABI=system-libcxxabi on Apple platforms, we would not re-export the libc++abi symbols unlike when LIBCXX_CXX_ABI=libcxxabi. This was caused by overly strict string matching in CMake. https://github.com/NixOS/nixpkgs/issues/269548
2024-01-07Reapply "[libc++][streams] P1759R6: Native handles and file streams" (#77190)Hristo Hristov2-0/+38
Fixes build on Windows in C++26 mode. Reverted in: https://github.com/llvm/llvm-project/commit/40c07b559aa6ab4bac074c943967d3207bc07ae0 Original PR: https://github.com/llvm/llvm-project/pull/76632 --------- Co-authored-by: Zingam <zingam@outlook.com>
2024-01-05Revert "[libc++][streams] P1759R6: Native handles and file streams (#76632)"Haowei Wu2-38/+0
This reverts commit 255f95a40377677dd762df5a1aa65bcbb4f75c79, which contains a breaking libcxx test on Windows when using C++26
2024-01-05[libc++][hardening] Categorize more assertions. (#75918)Konstantin Varlamov7-18/+18
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.
2024-01-05[libc++][streams] P1759R6: Native handles and file streams (#76632)Hristo Hristov2-0/+38
Implements: `P1759R6` https://wg21.link/P1759R6 - https://eel.is/c++draft/filebuf - https://eel.is/c++draft/ifstream - https://eel.is/c++draft/ofstream - https://eel.is/c++draft/fstream --------- Co-authored-by: Zingam <zingam@outlook.com>
2023-12-20[libc++][hardening] Categorize more 'valid-element-access' checks. (#71620)Konstantin Varlamov1-1/+1
2023-12-19[libc++][print] Adds ostream overloads. (#73262)Mark de Wever3-0/+45
Finishes implementation of - P2093R14 Formatted output - P2539R4 Should the output of std::print to a terminal be synchronized with the underlying stream? Differential Revision: https://reviews.llvm.org/D156609
2023-12-18[libc++] Restore order of includes on Windows to unbreak the buildLouis Dionne1-2/+2
As reported in [1], it looks like the Windows headers are picky about the order in which they are included, and the clang-format change broke the build by reordering the headers. [1]: https://github.com/llvm/llvm-project/pull/74334#issuecomment-1861719927
2023-12-18[libc++] Format the code base (#74334)Louis Dionne67-9868/+7780
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
2023-12-05[libc++] Replace uses of _VSTD:: by std:: (#74331)Louis Dionne10-77/+77
As part of the upcoming clang-formatting of libc++, this patch performs the long desired removal of the _VSTD macro. See https://discourse.llvm.org/t/rfc-clang-formatting-all-of-libc-once-and-for-all for the clang-format proposal.
2023-12-04[libc++][NFC] Add a few clang-format annotations (#74352)Louis Dionne1-0/+2
This is in preparation for clang-formatting the whole code base. These annotations are required either to avoid clang-format bugs or because the manually formatted code is significantly more readable than the clang-formatted alternative. All in all, it seems like very few annotations are required, which means that clang-format is doing a very good job in most cases.
2023-12-04[libc++] Rename _LIBCPP_INLINE_VISIBILITY to _LIBCPP_HIDE_FROM_ABI (#74095)Louis Dionne6-26/+26
In preparation for running clang-format on the whole code base, we are also removing mentions of the legacy _LIBCPP_INLINE_VISIBILITY macro in favor of the newer _LIBCPP_HIDE_FROM_ABI. We're still leaving the definition of _LIBCPP_INLINE_VISIBILITY to avoid creating needless breakage in case some older patches are checked-in with mentions of the old macro. After we branch for LLVM 18, we can do another pass to clean up remaining uses of the macro that might have gotten introduced by mistake (if any) and remove the macro itself at the same time. This is just a minor convenience to smooth out the transition as much as possible. See https://discourse.llvm.org/t/rfc-clang-formatting-all-of-libc-once-and-for-all for the clang-format proposal.
2023-11-29[libc++] Speed up classic locale (take 2) (#73533)Louis Dionne1-52/+46
Locale objects use atomic reference counting, which may be very expensive in parallel applications. The classic locale is used by default by all streams and can be very contended. But it's never destroyed, so the reference counting is also completely pointless on the classic locale. Currently ~70% of time in the parallel stringstream benchmarks is spent in locale ctor/dtor. And the execution radically slows down with more threads. Avoid reference counting on the classic locale. With this change parallel benchmarks start to scale with threads. This is a re-application of f8afc53d641c (aka PR #72112) which was reverted in 4e0c48b907f1 because it broke the sanitizer builds due to an initialization order fiasco. This issue has now been fixed by ensuring that the locale is constinit'ed. Co-authored-by: Dmitry Vyukov <dvyukov@google.com>
2023-11-28[libc++] Properly guard std::filesystem with >= C++17 (#72701)Louis Dionne2-4/+4
<filesystem> is a C++17 addition. In C++11 and C++14 modes, we actually have all the code for <filesystem> but it is hidden behind a non-inline namespace __fs so it is not accessible. Instead of doing this unusual dance, just guard the code for filesystem behind a classic C++17 check like we normally do.
2023-11-27Revert "[libc++] Speed up classic locale (#72112)"Kirill Stoimenov1-45/+52
Looks like it broke the ASAN build: https://lab.llvm.org/buildbot/#/builders/168/builds/17053/steps/9/logs/stdio This reverts commit f8afc53d641ce9d4ad8565aae9e7b5911b572a02.
2023-11-27[libc++] Fix UTF-8 decoding in codecvts (#68442)Dimitrij Mijoski1-23/+49
This patch fixes one case where the decoding member function `in()` was returning `partial` instead of `error`. Additionally, it adds large testsuite that tests all `codecvt` facets that were added in C++11 and in C++20. The testsuite covers this bug. Fixes #60177.
2023-11-27[libc++] Remove experimental pmr headers now shipped in mainline (#73172)Louis Dionne4-152/+11
Several experimental headers around std::pmr have been slated for removal for a while now. This patch actually performs the removal and cleanups from the code base.
2023-11-27[libc++] Speed up classic locale (#72112)Dmitry Vyukov1-52/+45
Locale objects use atomic reference counting, which may be very expensive in parallel applications. The classic locale is used by default by all streams and can be very contended. But it's never destroyed, so the reference counting is also completely pointless on the classic locale. Currently ~70% of time in the parallel stringstream benchmarks is spent in locale ctor/dtor. And the execution radically slows down with more threads. Avoid reference counting on the classic locale. With this change parallel benchmarks start to scale with threads. Co-authored-by: Louis Dionne <ldionne.2@gmail.com> ``` │ baseline │ optimized │ │ sec/op │ sec/op vs base │ Istream_numbers/0/threads:1 4.672µ ± 0% 4.419µ ± 0% -5.42% (p=0.000 n=30+39) Istream_numbers/0/threads:72 539.817µ ± 0% 9.842µ ± 1% -98.18% (p=0.000 n=30+40) Istream_numbers/1/threads:1 4.890µ ± 0% 4.750µ ± 0% -2.85% (p=0.000 n=30+40) Istream_numbers/1/threads:72 66.44µ ± 1% 10.14µ ± 1% -84.74% (p=0.000 n=30+40) Istream_numbers/2/threads:1 4.888µ ± 0% 4.746µ ± 0% -2.92% (p=0.000 n=30+40) Istream_numbers/2/threads:72 494.8µ ± 0% 410.2µ ± 1% -17.11% (p=0.000 n=30+40) Istream_numbers/3/threads:1 4.697µ ± 0% 4.695µ ± 5% ~ (p=0.391 n=30+37) Istream_numbers/3/threads:72 421.5µ ± 7% 421.9µ ± 9% ~ (p=0.665 n=30) Ostream_number/0/threads:1 183.0n ± 0% 141.0n ± 2% -22.95% (p=0.000 n=30) Ostream_number/0/threads:72 24196.5n ± 1% 343.5n ± 3% -98.58% (p=0.000 n=30) Ostream_number/1/threads:1 250.0n ± 0% 196.0n ± 2% -21.60% (p=0.000 n=30) Ostream_number/1/threads:72 16260.5n ± 0% 407.0n ± 2% -97.50% (p=0.000 n=30) Ostream_number/2/threads:1 254.0n ± 0% 196.0n ± 1% -22.83% (p=0.000 n=30) Ostream_number/2/threads:72 28.49µ ± 1% 18.89µ ± 5% -33.72% (p=0.000 n=30) Ostream_number/3/threads:1 185.0n ± 0% 185.0n ± 0% 0.00% (p=0.017 n=30) Ostream_number/3/threads:72 19.38µ ± 4% 19.33µ ± 5% ~ (p=0.425 n=30) ```
2023-11-24[libc++][NFC] Refactor _LIBCPP_AVAILABILITY_HAS_* macros to always be ↵philnik7771-1/+1
defined (#71002) This makes the conditionals quite a bit simpler to understand, since it avoids double negatives and makes sure we have <__availability> included. For vendors which use availability macros, it also enforces that they check when specific features are introduced and define the macro for their platform appropriately.
2023-11-23[libc++] Refactor the creation of the global and classic locales (#72581)Louis Dionne1-30/+23
The creation of the global and the classic locales was pretty twisty. This patch refactors how this is done to reduce the amount of indirections and prepare the terrain for a future where GCC implements the no_destroy attribute.
2023-11-21[libc++][hardening] Categorize all `ryu` assertions as internal (#71853)Konstantin Varlamov5-28/+28
These assertions can only be triggered by bugs in the algorithm's implementation; all user inputs should be handled gracefully.
2023-11-07[libc++][hardening] Add `_LIBCPP_ASSERT_NON_NULL` to check for null pointers ↵Konstantin Varlamov2-5/+5
(#71428)
2023-11-05[libc++] Handle threads-related .cpp files like we do all other source files ↵Louis Dionne11-118/+99
(#71100) Source files in libc++ are added to the CMake targets only if they are required by the configuration. We do this pretty consistently for all configurations like no-filesystem, no-random-device, etc. but we didn't do it for no-threads. This patch makes this consistent for no-threads, which is helpful in reducing the amount of work required to port libc++ to some platforms without threads. Indeed, with the previous approach, several threads-related source files would end up including headers that might fail to compile properly on some platforms. This issue is sidestepped entirely by making the approach for no-threads consistent with the other configurations.
2023-11-05[libc++] Guard the whole print.cpp file with _LIBCPP_WIN32API (#71122)Louis Dionne1-6/+6
The print.cpp source file is only used when building on Windows. Avoid including anything else but <__config> in the file in the case where there's nothing to compile here at all. As a drive-by change, use _LIBCPP_WIN32API consistently instead of _WIN32.
2023-11-05[libc++] Bump the C++ Standard used to compile the dylib to C++23 (#66824)Louis Dionne2-4/+6
This is necessary in order to implement some papers like P2467R1, which require using C++23 declarations in the dylib. It is a good habit to keep building the dylib with a recent standard version regardless. With this patch, we also stop strictly enforcing that the targets are built with C++23. Concretely, C++23 will soon be required in order to build the dylib, but not enforcing it strictly works around some issues like the documentation bots using an old and unsupported compiler. Since these bots do not actually build the library, not strictly enforcing the C++ Standard makes our CMake build more resilient to these kinds of situation. This is just a workaround though, the better way of going about would be to update the compiler on the documentation bot but we don't seem to have control over that.
2023-10-29[libc++] Remove a few transitive includes (#70553)philnik7771-0/+1
2023-10-18[libc++][NFC] Refactor the core logic of operator new into helper functions ↵Louis Dionne1-15/+21
(#69407) This will make it easier to implement new(nothrow) without calling the throwing version of new when exceptions are disabled. See https://llvm.org/D150610 for the full discussion.
2023-10-18[libc++][NFC] Reformat new.cpp and stdlib_new_delete.cppLouis Dionne1-213/+123
This makes it a lot easier to make wide ranging changes like I am about to do in https://llvm.org/D150610.
2023-10-06[libc++] Recategorize additional instantiations in the dylib as availability ↵Nikolas Klauser1-1/+1
macros Adding additional instantiations to the dylib isn't actually an ABI break as long as programs targeting an older dylib don't start to depend on them. Making additional instantiations a matter of availability allows us to add them without an ABI break. Reviewed By: #libc, ldionne, Mordante Spies: arichardson, ldionne, Mordante, libcxx-commits Differential Revision: https://reviews.llvm.org/D154796
2023-10-05[libc++] Make future_error constructor standard-compliantMarek Kurdej1-3/+1
This patch removes the non compliant constructor of std::future_error and adds the standards compliant constructor in C++17 instead. Note that we can't support the constructor as an extension in all standard modes because it uses delegating constructors, which require C++11. We could in theory support the constructor as an extension in C++11 and C++14 only, however I believe it is acceptable not to do that since I expect the breakage from this patch will be minimal. If it turns out that more code than we expect is broken by this, we can reconsider that decision. This was found during D99515. Differential Revision: https://reviews.llvm.org/D99567 Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2023-10-04[libc++] Remove dead code in legacy_debug_handler.cpp (#68155)Louis Dionne1-54/+0
We removed all traces of the legacy debug mode a while back, but we forgot to remove the actual `.cpp` file that implemented the legacy debug handler. The file is not referenced from anywhere so this is effectively a NFC.
2023-09-27[libc++] Don't add reference to system_category when exceptions disabled ↵Daniel Thornburgh1-2/+9
(#67504) This fixes a size regression in Fuchsia when building a static libc++ multilib with exceptions disabled. Referring to `system_category` in `__throw_system_error` brings in a relatively large amount of additional exception classes into the link without substantially improving the error message.