Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
971 B
C++
Raw Normal View History

//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: no-threads
[libc++] Drop support for the C++20 Synchronization Library before C++20 (#82008) When we initially implemented the C++20 synchronization library, we reluctantly accepted for the implementation to be backported to C++03 upon request from the person who provided the patch. This was when we were only starting to have experience with the issues this can create, so we flinched. Nowadays, we have a much stricter stance about not backporting features to previous standards. We have recently started fixing several bugs (and near bugs) in our implementation of the synchronization library. A recurring theme during these reviews has been how difficult to understand the current code is, and upon inspection it becomes clear that being able to use a few recent C++ features (in particular lambdas) would help a great deal. The code would still be pretty intricate, but it would be a lot easier to reason about the flow of callbacks through things like __thread_poll_with_backoff. As a result, this patch drops support for the synchronization library before C++20. This makes us more strictly conforming and opens the door to major simplifications, in particular around atomic_wait which was supported all the way to C++03. This change will probably have some impact on downstream users, however since the C++20 synchronization library was added only in LLVM 10 (~3 years ago) and it's quite a niche feature, the set of people trying to use this part of the library before C++20 should be reasonably small.
2024-07-31 16:53:09 -05:00
// UNSUPPORTED: c++03, c++11, c++14, c++17
[libc++] Use named Lit features to flag back-deployment XFAILs Instead of writing something like `XFAIL: use_system_cxx_lib && target=...` to XFAIL back-deployment tests, introduce named Lit features like `availability-shared_mutex-missing` to represent those. This makes the XFAIL annotations leaner, and solves the problem of XFAIL comments potentially getting out of sync. This would also make it easier for another vendor to add their own annotations to the test suite by simply changing how the feature is defined for their OS releases, instead of having to modify hundreds of tests to add repetitive annotations. This doesn't touch *all* annotations -- only annotations that were widely duplicated are given named features (e.g. when filesystem or shared_mutex were introduced). I still think it probably doesn't make sense to have a named feature for every single fix we make to the dylib. This is in essence a revert of 2659663, but since then the test suite has changed significantly. Back when I did 2659663, the configuration files we have for the test suite right now were being bootstrapped and it wasn't clear how to provide these features for back-deployment in that context. Since then, we have a streamlined way of defining these features in `features.py` and that doesn't impact the ability for a configuration file to stay minimal. The original motivation for this change was that I am about to propose a change that would touch essentially all XFAIL annotations for back-deployment in the test suite, and this greatly reduces the number of lines changed by that upcoming change, in addition to making the test suite generally better. Differential Revision: https://reviews.llvm.org/D146359
2023-03-18 10:05:19 -04:00
// XFAIL: availability-synchronization_library-missing
// <barrier>
#include <barrier>
#include <thread>
#include <cassert>
#include "make_test_thread.h"
#include "test_macros.h"
int main(int, char**)
{
int x = 0;
auto comp = [&]() noexcept { x += 1; };
std::barrier<decltype(comp)> b(2, comp);
std::thread t = support::make_test_thread([&](){
for(int i = 0; i < 10; ++i)
b.arrive_and_wait();
});
for(int i = 0; i < 10; ++i)
b.arrive_and_wait();
assert(x == 10);
t.join();
return 0;
}