summaryrefslogtreecommitdiff
path: root/libcxx/include/condition_variable
AgeCommit message (Collapse)Author
2025-10-09[libc++] Remove availability annotations that aren't required anymore (#161640)Nikolas Klauser
Apple dropped support for some older platforms, so we can also remove the annotations for them. See https://developer.apple.com/support/xcode/ for the supported versions.
2025-05-28Revert "[libc++] Introduce ABI sensitive areas to avoid requiring ↵James Y Knight
_LIBCPP_HIDE_FROM_ABI everywhere (#131156)" (#141756) This reverts commit c861fe8a71e64f3d2108c58147e7375cd9314521. Unfortunately, this use of hidden visibility attributes causes user-defined specializations of standard-library types to also be marked hidden by default, which is incorrect. See discussion thread on #131156. ...and also reverts the follow-up commits: Revert "[libc++] Add explicit ABI annotations to functions from the block runtime declared in <__functional/function.h> (#140592)" This reverts commit 3e4c9dc299c35155934688184319d391b298fff7. Revert "[libc++] Make ABI annotations explicit for windows-specific code (#140507)" This reverts commit f73287e623a6c2e4a3485832bc3e10860cd26eb5. Revert "[libc++][NFC] Replace a few "namespace std" with the correct macro (#140510)" This reverts commit 1d411f27c769a32cb22ce50b9dc4421e34fd40dd.
2025-05-18[libc++] Introduce ABI sensitive areas to avoid requiring ↵Nikolas Klauser
_LIBCPP_HIDE_FROM_ABI everywhere (#131156) This patch introduces `_LIBCPP_{BEGIN,END}_EXPLICIT_ABI_ANNOTATIONS`, which allow us to have implicit annotations for most functions, and just where it's not "hide_from_abi everything" we add explicit annotations. This allows us to drop the `_LIBCPP_HIDE_FROM_ABI` macro from most functions in libc++.
2025-04-19[libc++] Backport segmented iterator optimization for std::for_each to C++11 ↵Peng Liu
(#134960) Previously, the segmented iterator optimization for `std::for_each` was restricted to C++23 and later due to its dependency on `__movable_box`, which is not available in earlier standards. This patch eliminates that restriction, enabling consistent optimizations starting from C++11. By backporting this enhancement, we improve performance across older standards and create opportunities to extend similar optimizations to other algorithms by forwarding their calls to `std::for_each`.
2025-04-08[libc++] Remove _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS (#111964)Nikolas Klauser
This macro isn't required if we define all the functions inline. In fact, quite a few of the marked functions have already been inlined. This patch basically only moves code around and adds `_LIBCPP_HIDE_FROM_ABI` to the places where it's been missing so far. This also removes inlining hints, since it dropps `inline` in some places, but that shouldn't make much of a difference. The functions tend to be either really small, so should be inlined anyways, or are big enough that they shouldn't be inlined even with an inlinehint.
2024-12-21[libc++][C++03] Use `__cxx03/` headers in C++03 mode (#109002)Nikolas Klauser
This patch implements the forwarding to frozen C++03 headers as discussed in https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc. In the RFC, we initially proposed selecting the right headers from the Clang driver, however consensus seemed to steer towards handling this in the library itself. This patch implements that direction. At a high level, the changes basically amount to making each public header look like this: ``` // inside <vector> #ifdef _LIBCPP_CXX03_LANG # include <__cxx03/vector> #else // normal <vector> content #endif ``` In most cases, public headers are simple umbrella headers so there isn't much code in the #else branch. In other cases, the #else branch contains the actual implementation of the header.
2024-12-10[libc++] Add #if 0 block to all the top-level headers (#119234)Nikolas Klauser
Including The frozen C++03 headers results in a lot of formatting changes in the main headers, so this splits these changes into a separate commit instead. This is part of https://discourse.llvm.org/t/rfc-freezing-c-03-headers-in-libc.
2024-11-06[libc++] Refactor the configuration macros to being always defined (#112094)Nikolas Klauser
This is a follow-up to #89178. This updates the `<__config_site>` macros.
2024-09-12[libc++] Make std::jthread supported in non-experimental mode (#107900)Louis Dionne
We waited before supporting std::jthread fully because we wanted to investigate other implementation strategies (in particular one involving std::mutex). Since then, we did some benchmarking and decided that we wouldn't be moving forward with std::mutex. Hence, there is no real reason to punt on making std::jthread & friends non-experimental.
2024-05-28[libc++] Make the __availability header a sub-header of __config (#93083)Louis Dionne
In essence, this header has always been related to configuration of the library but we didn't want to put it inside <__config> due to complexity reasons. Now that we have sub-headers in <__config>, we can move <__availability> to it and stop including it everywhere since we already obtain the required macros via <__config>.
2024-02-29[libc++] Clean up includes of <__assert> (#80091)Louis Dionne
Originally, we used __libcpp_verbose_abort to handle assertion failures. That function was declared from all public headers. Since we don't use that mechanism anymore, we don't need to declare __libcpp_verbose_abort from all public headers, and we can clean up a lot of unnecessary includes. This patch also moves the definition of the various assertion categories to the <__assert> header, since we now rely on regular IWYU for these assertion macros. rdar://105510916
2024-01-25[libc++] Fix missing and incorrect push/pop macros (#79204)Louis Dionne
We recently noticed that the unwrap_iter.h file was pushing macros, but it was pushing them again instead of popping them at the end of the file. This led to libc++ basically swallowing any custom definition of these macros in user code: #define min HELLO #include <algorithm> // min is not HELLO anymore, it's not defined While investigating this issue, I noticed that our push/pop pragmas were actually entirely wrong too. Indeed, instead of pushing macros like `move`, we'd push `move(int, int)` in the pragma, which is not a valid macro name. As a result, we would not actually push macros like `move` -- instead we'd simply undefine them. This led to the following code not working: #define move HELLO #include <algorithm> // move is not HELLO anymore Fixing the pragma push/pop incantations led to a cascade of issues because we use identifiers like `move` in a large number of places, and all of these headers would now need to do the push/pop dance. This patch fixes all these issues. First, it adds a check that we don't swallow important names like min, max, move or refresh as explained above. This is done by augmenting the existing system_reserved_names.gen.py test to also check that the macros are what we expect after including each header. Second, it fixes the push/pop pragmas to work properly and adds missing pragmas to all the files I could detect a failure in via the newly added test. rdar://121365472
2024-01-20[libc++] fix condition_variable_any hangs on stop_request (#77127)Hui
When I implemented `condition_variable_any::wait`, I missed the most important paragraph in the spec: > The following wait functions will be notified when there is a stop request on the passed stop_token. > In that case the functions return immediately, returning false if the predicate evaluates to false. From https://eel.is/c++draft/thread.condition#thread.condvarany.intwait-1. Fixes #76807
2023-12-18[libc++] Format the code base (#74334)Louis Dionne
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 Dionne
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++] Rename _LIBCPP_INLINE_VISIBILITY to _LIBCPP_HIDE_FROM_ABI (#74095)Louis Dionne
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-10-29[libc++] Remove a few transitive includes (#70553)philnik777
2023-09-29[libc++] Implement `std::condition_variable_any::wait[_for/until]` overloads ↵Hui
that take `stop_token` - This is section 32.6.4 of P0660R10 - https://eel.is/c++draft/thread.condvarany.intwait Differential Revision: https://reviews.llvm.org/D153441
2023-06-15[libc++] Merge _LIBCPP_FUNC_VIS, _LIBCPP_TYPE_VIS and _LIBCPP_EXCEPTION_ABI ↵Nikolas Klauser
into _LIBCPP_EXPORTED_FROM_ABI These macros are always defined identically, so we can simplify the code a bit by merging them. Reviewed By: ldionne, #libc Spies: libcxx-commits, krytarowski, smeenai Differential Revision: https://reviews.llvm.org/D152652
2023-04-16[libc++] Add hide_from_abi check for classesNikolas Klauser
We already have a clang-tidy check for making sure that `_LIBCPP_HIDE_FROM_ABI` is on free functions. This patch extends this to class members. The places where we don't check for `_LIBCPP_HIDE_FROM_ABI` are classes for which we have an instantiation in the library. Reviewed By: ldionne, Mordante, #libc Spies: jplehr, mikhail.ramalho, sstefan1, libcxx-commits, krytarowski, miyuki, smeenai Differential Revision: https://reviews.llvm.org/D142332
2023-04-09[libc++] Granularize system_error.Mark de Wever
Reviewed By: #libc, philnik Differential Revision: https://reviews.llvm.org/D147853
2023-03-22[libc++] Granularize __mutex_baseNikolas Klauser
This also updates the moved code to the current style. (i.e. `_VSTD` -> `std`, `_LIBCPP_INLINE_VISIBILITY` -> `_LIBCPP_HIDE_FROM_ABI`, clang-format). Reviewed By: Mordante, #libc, EricWF Spies: arichardson, libcxx-commits, mikhail.ramalho Differential Revision: https://reviews.llvm.org/D146228
2023-03-19[libc++] Remove C++03 extensions for std::allocator_arg & friendsLouis Dionne
As explained in the release note, libc++ used to provide various global variables as an extension in C++03 mode. Unfortunately, that made our definition non-conforming in all standard modes. This was never a big problem until recently, since we are trying to support C++20 Modules in libc++, and that requires cleaning up the definition of these variables. This change is the first in a series of changes to achieve our end goal. This patch removes the ability for users to rely on the (incorrect) definition of those global variables inside the shared library. The plan is to then remove those definitions from the shared library (which is an ABI break but I don't think it will have impact), and finally to make our definition of those variables conforming in all standard modes. Differential Revision: https://reviews.llvm.org/D145422
2023-03-10[libc++] Granularize <atomic> includesNikolas Klauser
Reviewed By: ldionne, Mordante, #libc Spies: arichardson, libcxx-commits Differential Revision: https://reviews.llvm.org/D144255
2022-12-23[libc++] Granularize <type_traits> includes in <compare>Nikolas Klauser
Reviewed By: Mordante, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D140480
2022-11-05[libc++] Granularize <concept> includesNikolas Klauser
Reviewed By: ldionne, #libc Spies: libcxx-commits Differential Revision: https://reviews.llvm.org/D137283
2022-09-05[libc++] Granularize the rest of memoryNikolas Klauser
Reviewed By: ldionne, #libc Spies: vitalybuka, paulkirth, libcxx-commits, mgorny Differential Revision: https://reviews.llvm.org/D132790
2022-09-02Revert "[libc++] Granularize the rest of memory"Vitaly Buka
Breaks buildbots. This reverts commit 30adaa730c4768b5eb06719c808b2884fcf53cf3.
2022-09-02[libc++] Granularize the rest of memoryNikolas Klauser
Reviewed By: ldionne, #libc Spies: libcxx-commits, mgorny Differential Revision: https://reviews.llvm.org/D132790
2022-07-08[libc++] Make parameter names consistent and enforce the naming style using ↵Nikolas Klauser
readability-identifier-naming Ensure that parameter names have the style `__lower_case` Reviewed By: ldionne, #libc Spies: aheejin, sstefan1, libcxx-commits, miyuki Differential Revision: https://reviews.llvm.org/D129051
2022-03-30[libc++] Ensure that all public C++ headers include <__assert>Louis Dionne
This patch changes the requirement for getting the declaration of the assertion handler from including <__assert> to including any public C++ header of the library. Note that C compatibility headers are excluded because we don't implement all the C headers ourselves -- some of them are taken straight from the C library, like assert.h. It also adds a generated test to check it. Furthermore, this new generated test is designed in a way that will make it possible to replace almost all the existing test-generation scripts with this system in upcoming patches. Differential Revision: https://reviews.llvm.org/D122506
2022-02-04[libc++] Normalize all our '#pragma GCC system_header', and regression-test.Arthur O'Dwyer
Now we'll notice if a header forgets to include this magic phrase. Differential Revision: https://reviews.llvm.org/D118800
2022-01-04[libc++] Add the version header to all headers.Mark de Wever
Some headers which require the version header depend on other headers to provide it. Include the version header in all top-level headers to make sure a header cleanup can't remove the version header. Note this doesn't add the version header to the c headers. Reviewed By: #libc, Quuxplusone, ldionne Differential Revision: https://reviews.llvm.org/D116172
2021-11-17[runtimes][NFC] Remove filenames at the top of the license noticeLouis Dionne
We've stopped doing it in libc++ for a while now because these names would end up rotting as we move things around and copy/paste stuff. This cleans up all the existing files so as to stop the spreading as people copy-paste headers around.
2021-04-20[libc++] NFC: Normalize `#endif //` comment indentationLouis Dionne
2019-01-19Update more file headers across all of the LLVM projects in the monorepoChandler Carruth
to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
2017-03-02[libc++] Make _LIBCPP_TYPE_VIS export membersShoaib Meenai
Summary: Most classes annotated with _LIBCPP_TYPE_VIS need to have at least some of their members exported, otherwise we have a lot of link errors when linking against a libc++ built with hidden visibility. This also makes _LIBCPP_TYPE_VIS be consistent across platforms, since on Windows it already exports members. With this change made, any template methods of a class marked _LIBCPP_TYPE_VIS will also get default visibility when instantiatied, which is not desirable for clients of libc++ headers who wish to control their visibility; this is the same issue as PR30642. Annotate all problematic methods with an explicit visibility specifier to avoid this. The problematic methods were found by running bad-visibility-finder [1] against the libc++ headers after making the _LIBCPP_TYPE_VIS change. The small methods were marked for inlining; the larger ones hidden. [1] https://github.com/smeenai/bad-visibility-finder Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25208 llvm-svn: 296732
2015-11-07Cleanup: move visibility/linkage attributes to the first declaration.Evgeniy Stepanov
This change moves visibility attributes from out-of-class method definitions to in-class declaration. This is needed for a switch to attribute((internal_linkage)) (see http://reviews.llvm.org/D13925) which can only appear on the first declaration. This change does not touch istream/ostream/streambuf. They are handled separately in http://reviews.llvm.org/D14409. llvm-svn: 252385
2014-09-05Allow libc++ to be built on systems without POSIX threadsJonathan Roelofs
If you're crazy enough to want this sort of thing, then add -D_LIBCPP_HAS_NO_THREADS to your CXXFLAGS and --param=additiona_features=libcpp-has-no-threads to your lit commnad line. http://reviews.llvm.org/D3969 llvm-svn: 217271
2013-03-06No functionality change at this time. I've split _LIBCPP_VISIBLE up into ↵Howard Hinnant
two flags: _LIBCPP_TYPE_VIS and _LIBCPP_FUNC_VIS. This is in preparation for taking advantage of clang's new __type_visibility__ attribute. llvm-svn: 176593
2012-10-30Rename uses of _ and __ because these are getting stepped on by macros from ↵Howard Hinnant
other system code. llvm-svn: 167038
2012-07-21noexcept applied to <condition_variable>.Howard Hinnant
llvm-svn: 160605
2011-10-17Windows support by Ruben Van Boxem.Howard Hinnant
llvm-svn: 142235
2011-06-30_STD -> _VSTD to avoid macro clash on windowsHoward Hinnant
llvm-svn: 134190
2010-11-20N3191: C++ Timeout SpecificationHoward Hinnant
llvm-svn: 119909
2010-11-16license changeHoward Hinnant
llvm-svn: 119395
2010-09-21visibility-decoration.Howard Hinnant
llvm-svn: 114486
2010-09-03[futures.atomic_future] and notify_all_at_thread_exit. This completes the ↵Howard Hinnant
header <future> and all of Chapter 30 (for C++0x enabled compilers). llvm-svn: 113017
2010-08-27future continues ...Howard Hinnant
llvm-svn: 112284
2010-05-11Wiped out some non-ascii characters that snuck into the copyright.Howard Hinnant
llvm-svn: 103516