| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // 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: c++98, c++03 | ||
| // REQUIRES: verify-support | ||
| // REQUIRES: with_system_cxx_lib=macosx | ||
| // REQUIRES: availability=macosx10.7 || availability=macosx10.8 || availability=macosx10.9 || availability=macosx10.10 || availability=macosx10.11 || availability=macosx10.12 || availability=macosx10.13 || availability=macosx10.14 || availability=macosx10.15 | ||
|
|
||
| // Test the availability markup on the C++20 Synchronization Library | ||
| // additions to <atomic>. | ||
|
|
||
| #include <atomic> | ||
|
|
||
|
|
||
| int main(int, char**) | ||
| { | ||
| { | ||
| std::atomic<int> i(3); | ||
| std::memory_order m = std::memory_order_relaxed; | ||
|
|
||
| i.wait(4); // expected-error {{is unavailable}} | ||
| i.wait(4, m); // expected-error {{is unavailable}} | ||
| i.notify_one(); // expected-error {{is unavailable}} | ||
| i.notify_all(); // expected-error {{is unavailable}} | ||
|
|
||
| std::atomic_wait(&i, 4); // expected-error {{is unavailable}} | ||
| std::atomic_wait_explicit(&i, 4, m); // expected-error {{is unavailable}} | ||
| std::atomic_notify_one(&i); // expected-error {{is unavailable}} | ||
| std::atomic_notify_all(&i); // expected-error {{is unavailable}} | ||
| } | ||
|
|
||
| { | ||
| std::atomic<int> volatile i(3); | ||
| std::memory_order m = std::memory_order_relaxed; | ||
|
|
||
| i.wait(4); // expected-error {{is unavailable}} | ||
| i.wait(4, m); // expected-error {{is unavailable}} | ||
| i.notify_one(); // expected-error {{is unavailable}} | ||
| i.notify_all(); // expected-error {{is unavailable}} | ||
|
|
||
| std::atomic_wait(&i, 4); // expected-error {{is unavailable}} | ||
| std::atomic_wait_explicit(&i, 4, m); // expected-error {{is unavailable}} | ||
| std::atomic_notify_one(&i); // expected-error {{is unavailable}} | ||
| std::atomic_notify_all(&i); // expected-error {{is unavailable}} | ||
| } | ||
|
|
||
| { | ||
| std::atomic_flag flag; | ||
| bool b = false; | ||
| std::memory_order m = std::memory_order_relaxed; | ||
| flag.wait(b); // expected-error {{is unavailable}} | ||
| flag.wait(b, m); // expected-error {{is unavailable}} | ||
| flag.notify_one(); // expected-error {{is unavailable}} | ||
| flag.notify_all(); // expected-error {{is unavailable}} | ||
|
|
||
| std::atomic_flag_wait(&flag, b); // expected-error {{is unavailable}} | ||
| std::atomic_flag_wait_explicit(&flag, b, m); // expected-error {{is unavailable}} | ||
| std::atomic_flag_notify_one(&flag); // expected-error {{is unavailable}} | ||
| std::atomic_flag_notify_all(&flag); // expected-error {{is unavailable}} | ||
| } | ||
|
|
||
| { | ||
| std::atomic_flag volatile flag; | ||
| bool b = false; | ||
| std::memory_order m = std::memory_order_relaxed; | ||
| flag.wait(b); // expected-error {{is unavailable}} | ||
| flag.wait(b, m); // expected-error {{is unavailable}} | ||
| flag.notify_one(); // expected-error {{is unavailable}} | ||
| flag.notify_all(); // expected-error {{is unavailable}} | ||
|
|
||
| std::atomic_flag_wait(&flag, b); // expected-error {{is unavailable}} | ||
| std::atomic_flag_wait_explicit(&flag, b, m); // expected-error {{is unavailable}} | ||
| std::atomic_flag_notify_one(&flag); // expected-error {{is unavailable}} | ||
| std::atomic_flag_notify_all(&flag); // expected-error {{is unavailable}} | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // 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: c++98, c++03 | ||
| // REQUIRES: verify-support | ||
| // REQUIRES: with_system_cxx_lib=macosx | ||
| // REQUIRES: availability=macosx10.7 || availability=macosx10.8 || availability=macosx10.9 || availability=macosx10.10 || availability=macosx10.11 || availability=macosx10.12 || availability=macosx10.13 || availability=macosx10.14 || availability=macosx10.15 | ||
|
|
||
| // Test the availability markup on std::barrier. | ||
|
|
||
| #include <barrier> | ||
| #include <utility> | ||
|
|
||
| struct CompletionF { | ||
| void operator()() { } | ||
| }; | ||
|
|
||
| int main(int, char**) | ||
| { | ||
| // Availability markup on std::barrier<> | ||
| { | ||
| std::barrier<> b(10); // expected-error {{is unavailable}} | ||
| auto token = b.arrive(); // expected-error {{is unavailable}} | ||
| (void)b.arrive(10); // expected-error {{is unavailable}} | ||
| b.wait(std::move(token)); // expected-error {{is unavailable}} | ||
| b.arrive_and_wait(); // expected-error {{is unavailable}} | ||
| b.arrive_and_drop(); // expected-error {{is unavailable}} | ||
| } | ||
|
|
||
| // Availability markup on std::barrier<CompletionF> with non-default CompletionF | ||
| { | ||
| std::barrier<CompletionF> b(10); // expected-error {{is unavailable}} | ||
| auto token = b.arrive(); // expected-error {{is unavailable}} | ||
| (void)b.arrive(10); // expected-error {{is unavailable}} | ||
| b.wait(std::move(token)); // expected-error {{is unavailable}} | ||
| b.arrive_and_wait(); // expected-error {{is unavailable}} | ||
| b.arrive_and_drop(); // expected-error {{is unavailable}} | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // 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: c++98, c++03 | ||
| // REQUIRES: verify-support | ||
| // REQUIRES: with_system_cxx_lib=macosx | ||
| // REQUIRES: availability=macosx10.7 || availability=macosx10.8 || availability=macosx10.9 || availability=macosx10.10 || availability=macosx10.11 || availability=macosx10.12 || availability=macosx10.13 || availability=macosx10.14 || availability=macosx10.15 | ||
|
|
||
| // Test the availability markup on std::latch. | ||
|
|
||
| #include <latch> | ||
|
|
||
|
|
||
| int main(int, char**) | ||
| { | ||
| std::latch latch(10); | ||
| latch.count_down(); // expected-error {{is unavailable}} | ||
| latch.count_down(3); // expected-error {{is unavailable}} | ||
| latch.wait(); // expected-error {{is unavailable}} | ||
| latch.arrive_and_wait(); // expected-error {{is unavailable}} | ||
| latch.arrive_and_wait(3); // expected-error {{is unavailable}} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| //===----------------------------------------------------------------------===// | ||
| // | ||
| // 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: c++98, c++03 | ||
| // REQUIRES: verify-support | ||
| // REQUIRES: with_system_cxx_lib=macosx | ||
| // REQUIRES: availability=macosx10.7 || availability=macosx10.8 || availability=macosx10.9 || availability=macosx10.10 || availability=macosx10.11 || availability=macosx10.12 || availability=macosx10.13 || availability=macosx10.14 || availability=macosx10.15 | ||
|
|
||
| // Test the availability markup on std::counting_semaphore and std::binary_semaphore. | ||
|
|
||
| #include <chrono> | ||
| #include <semaphore> | ||
|
|
||
|
|
||
| int main(int, char**) | ||
| { | ||
| { | ||
| // Tests for std::counting_semaphore with non-default template argument | ||
| std::counting_semaphore<20> sem(10); | ||
| sem.release(); // expected-error {{is unavailable}} | ||
| sem.release(5); // expected-error {{is unavailable}} | ||
| sem.acquire(); // expected-error {{is unavailable}} | ||
| sem.try_acquire_for(std::chrono::milliseconds{3}); // expected-error 1-2 {{is unavailable}} | ||
| sem.try_acquire(); // expected-error {{is unavailable}} | ||
| sem.try_acquire_until(std::chrono::steady_clock::now()); // expected-error 1-2 {{is unavailable}} | ||
| } | ||
| { | ||
| // Tests for std::counting_semaphore with default template argument | ||
| std::counting_semaphore<> sem(10); | ||
| sem.release(); // expected-error {{is unavailable}} | ||
| sem.release(5); // expected-error {{is unavailable}} | ||
| sem.acquire(); // expected-error {{is unavailable}} | ||
| sem.try_acquire_for(std::chrono::milliseconds{3}); // expected-error 1-2 {{is unavailable}} | ||
| sem.try_acquire(); // expected-error {{is unavailable}} | ||
| sem.try_acquire_until(std::chrono::steady_clock::now()); // expected-error 1-2 {{is unavailable}} | ||
| } | ||
| { | ||
| // Tests for std::binary_semaphore | ||
| std::binary_semaphore sem(10); | ||
| sem.release(); // expected-error {{is unavailable}} | ||
| sem.release(5); // expected-error {{is unavailable}} | ||
| sem.acquire(); // expected-error {{is unavailable}} | ||
| sem.try_acquire_for(std::chrono::milliseconds{3}); // expected-error 1-2 {{is unavailable}} | ||
| sem.try_acquire(); // expected-error {{is unavailable}} | ||
| sem.try_acquire_until(std::chrono::steady_clock::now()); // expected-error 1-2 {{is unavailable}} | ||
| } | ||
| } |