diff options
Diffstat (limited to 'libcxx')
32 files changed, 153 insertions, 65 deletions
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst index c7f01e6..8fba6db 100644 --- a/libcxx/docs/FeatureTestMacroTable.rst +++ b/libcxx/docs/FeatureTestMacroTable.rst @@ -418,6 +418,8 @@ Status ---------------------------------------------------------- ----------------- ``__cpp_lib_atomic_min_max`` *unimplemented* ---------------------------------------------------------- ----------------- + ``__cpp_lib_atomic_ref`` ``202411L`` + ---------------------------------------------------------- ----------------- ``__cpp_lib_bind_front`` ``202306L`` ---------------------------------------------------------- ----------------- ``__cpp_lib_bitset`` ``202306L`` diff --git a/libcxx/docs/ReleaseNotes/22.rst b/libcxx/docs/ReleaseNotes/22.rst index ec23ba9..1a450218 100644 --- a/libcxx/docs/ReleaseNotes/22.rst +++ b/libcxx/docs/ReleaseNotes/22.rst @@ -43,6 +43,7 @@ Implemented Papers - P3044R2: sub-``string_view`` from ``string`` (`Github <https://llvm.org/PR148140>`__) - P3223R2: Making ``std::istream::ignore`` less surprising (`Github <https://llvm.org/PR148178>`__) - P3060R3: Add ``std::views::indices(n)`` (`Github <https://llvm.org/PR148175>`__) +- P2835R7: Expose ``std::atomic_ref``'s object address (`Github <https://llvm.org/PR118377>`__) - P3168R2: Give ``std::optional`` Range Support (`Github <https://llvm.org/PR105430>`__) Improvements and New Features diff --git a/libcxx/docs/Status/Cxx2cPapers.csv b/libcxx/docs/Status/Cxx2cPapers.csv index 69b9984..9b83047 100644 --- a/libcxx/docs/Status/Cxx2cPapers.csv +++ b/libcxx/docs/Status/Cxx2cPapers.csv @@ -85,7 +85,7 @@ "`P3222R0 <https://wg21.link/P3222R0>`__","Fix C++26 by adding transposed special cases for P2642 layouts","2024-11 (Wrocław)","","","`#118374 <https://github.com/llvm/llvm-project/issues/118374>`__","" "`P3050R2 <https://wg21.link/P3050R2>`__","Fix C++26 by optimizing ``linalg::conjugated`` for noncomplex value types","2024-11 (Wrocław)","","","`#118375 <https://github.com/llvm/llvm-project/issues/118375>`__","" "`P3396R1 <https://wg21.link/P3396R1>`__","``std::execution`` wording fixes","2024-11 (Wrocław)","","","`#118376 <https://github.com/llvm/llvm-project/issues/118376>`__","" -"`P2835R7 <https://wg21.link/P2835R7>`__","Expose ``std::atomic_ref``'s object address","2024-11 (Wrocław)","","","`#118377 <https://github.com/llvm/llvm-project/issues/118377>`__","" +"`P2835R7 <https://wg21.link/P2835R7>`__","Expose ``std::atomic_ref``'s object address","2024-11 (Wrocław)","|Complete|","22","`#118377 <https://github.com/llvm/llvm-project/issues/118377>`__","" "`P3323R1 <https://wg21.link/P3323R1>`__","cv-qualified types in ``atomic`` and ``atomic_ref``","2024-11 (Wrocław)","","","`#118378 <https://github.com/llvm/llvm-project/issues/118378>`__","" "`P3508R0 <https://wg21.link/P3508R0>`__","Wording for ""constexpr for specialized memory algorithms""","2024-11 (Wrocław)","","","`#118379 <https://github.com/llvm/llvm-project/issues/118379>`__","" "`P3369R0 <https://wg21.link/P3369R0>`__","constexpr for ``uninitialized_default_construct``","2024-11 (Wrocław)","","","`#118380 <https://github.com/llvm/llvm-project/issues/118380>`__","" diff --git a/libcxx/include/__atomic/atomic_ref.h b/libcxx/include/__atomic/atomic_ref.h index 9bdc6b1..ec5ae2c 100644 --- a/libcxx/include/__atomic/atomic_ref.h +++ b/libcxx/include/__atomic/atomic_ref.h @@ -220,6 +220,9 @@ public: } _LIBCPP_HIDE_FROM_ABI void notify_one() const noexcept { std::__atomic_notify_one(*this); } _LIBCPP_HIDE_FROM_ABI void notify_all() const noexcept { std::__atomic_notify_all(*this); } +# if _LIBCPP_STD_VER >= 26 + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp* address() const noexcept { return __ptr_; } +# endif protected: using _Aligned_Tp [[__gnu__::__aligned__(required_alignment), __gnu__::__nodebug__]] = _Tp; diff --git a/libcxx/include/__cxx03/__atomic/atomic.h b/libcxx/include/__cxx03/__atomic/atomic.h index bc4a393..f2e8493 100644 --- a/libcxx/include/__cxx03/__atomic/atomic.h +++ b/libcxx/include/__cxx03/__atomic/atomic.h @@ -34,9 +34,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp> struct atomic : public __atomic_base<_Tp> { - using __base = __atomic_base<_Tp>; - using value_type = _Tp; - using difference_type = value_type; + using __base = __atomic_base<_Tp>; _LIBCPP_HIDE_FROM_ABI atomic() _NOEXCEPT = default; @@ -59,8 +57,8 @@ struct atomic : public __atomic_base<_Tp> { template <class _Tp> struct atomic<_Tp*> : public __atomic_base<_Tp*> { - using __base = __atomic_base<_Tp*>; - using value_type = _Tp*; + using __base = __atomic_base<_Tp*>; + using difference_type = ptrdiff_t; _LIBCPP_HIDE_FROM_ABI atomic() _NOEXCEPT = default; diff --git a/libcxx/include/__cxx03/__atomic/atomic_base.h b/libcxx/include/__cxx03/__atomic/atomic_base.h index a2b40c6..d79ef7d 100644 --- a/libcxx/include/__cxx03/__atomic/atomic_base.h +++ b/libcxx/include/__cxx03/__atomic/atomic_base.h @@ -32,6 +32,8 @@ struct __atomic_base // false { mutable __cxx_atomic_impl<_Tp> __a_; + using value_type = _Tp; + _LIBCPP_HIDE_FROM_ABI bool is_lock_free() const volatile _NOEXCEPT { return __cxx_atomic_is_lock_free(sizeof(__cxx_atomic_impl<_Tp>)); } @@ -127,6 +129,8 @@ template <class _Tp> struct __atomic_base<_Tp, true> : public __atomic_base<_Tp, false> { using __base = __atomic_base<_Tp, false>; + using difference_type = typename __base::value_type; + _LIBCPP_HIDE_FROM_ABI __atomic_base() _NOEXCEPT = default; _LIBCPP_HIDE_FROM_ABI __atomic_base(_Tp __d) _NOEXCEPT : __base(__d) {} diff --git a/libcxx/include/__cxx03/regex b/libcxx/include/__cxx03/regex index b96d59d..b6a78f2 100644 --- a/libcxx/include/__cxx03/regex +++ b/libcxx/include/__cxx03/regex @@ -2100,7 +2100,7 @@ public: __ranges_.push_back( std::make_pair(__traits_.transform(__b.begin(), __b.end()), __traits_.transform(__e.begin(), __e.end()))); } else { - if (__b.size() != 1 || __e.size() != 1) + if (__b.size() != 1 || __e.size() != 1 || char_traits<typename string_type::value_type>::lt(__e[0], __b[0])) __throw_regex_error<regex_constants::error_range>(); if (__icase_) { __b[0] = __traits_.translate_nocase(__b[0]); @@ -3911,7 +3911,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_character_escape( ++__first; break; default: - if (*__first != '_' && !__traits_.isctype(*__first, ctype_base::alnum)) { + if (!__traits_.isctype(*__first, ctype_base::alnum)) { if (__str) *__str = *__first; else diff --git a/libcxx/include/__cxx03/sstream b/libcxx/include/__cxx03/sstream index 44c2423..741158a 100644 --- a/libcxx/include/__cxx03/sstream +++ b/libcxx/include/__cxx03/sstream @@ -354,9 +354,15 @@ private: public: // [stringbuf.cons] constructors: - _LIBCPP_HIDE_FROM_ABI basic_stringbuf() : __hm_(nullptr), __mode_(ios_base::in | ios_base::out) {} + _LIBCPP_HIDE_FROM_ABI basic_stringbuf() : __hm_(nullptr), __mode_(ios_base::in | ios_base::out) { + // it is implementation-defined whether we initialize eback() & friends to nullptr, and libc++ doesn't + __init_buf_ptrs(); + } - _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(ios_base::openmode __wch) : __hm_(nullptr), __mode_(__wch) {} + _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(ios_base::openmode __wch) : __hm_(nullptr), __mode_(__wch) { + // it is implementation-defined whether we initialize eback() & friends to nullptr, and libc++ doesn't + __init_buf_ptrs(); + } _LIBCPP_HIDE_FROM_ABI explicit basic_stringbuf(const string_type& __s, ios_base::openmode __wch = ios_base::in | ios_base::out) diff --git a/libcxx/include/__cxx03/vector b/libcxx/include/__cxx03/vector index 4b62e0b..dbaa33c 100644 --- a/libcxx/include/__cxx03/vector +++ b/libcxx/include/__cxx03/vector @@ -432,10 +432,12 @@ public: template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI vector(size_type __n, const value_type& __x, const allocator_type& __a) : __end_cap_(nullptr, __a) { + auto __guard = std::__make_exception_guard(__destroy_vector(*this)); if (__n > 0) { __vallocate(__n); __construct_at_end(__n, __x); } + __guard.__complete(); } template <class _InputIterator, @@ -1054,9 +1056,7 @@ inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocator>::vector(vector&& __x, const __x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr; } else { typedef move_iterator<iterator> _Ip; - auto __guard = std::__make_exception_guard(__destroy_vector(*this)); - assign(_Ip(__x.begin()), _Ip(__x.end())); - __guard.__complete(); + __init_with_size(_Ip(__x.begin()), _Ip(__x.end()), __x.size()); } } diff --git a/libcxx/include/version b/libcxx/include/version index 44d7908..0fef1bb 100644 --- a/libcxx/include/version +++ b/libcxx/include/version @@ -37,7 +37,8 @@ __cpp_lib_atomic_float 201711L <atomic> __cpp_lib_atomic_is_always_lock_free 201603L <atomic> __cpp_lib_atomic_lock_free_type_aliases 201907L <atomic> __cpp_lib_atomic_min_max 202403L <atomic> -__cpp_lib_atomic_ref 201806L <atomic> +__cpp_lib_atomic_ref 202411L <atomic> + 201806L // C++20 __cpp_lib_atomic_shared_ptr 201711L <atomic> __cpp_lib_atomic_value_initialization 201911L <atomic> <memory> __cpp_lib_atomic_wait 201907L <atomic> @@ -544,6 +545,8 @@ __cpp_lib_void_t 201411L <type_traits> # define __cpp_lib_aligned_accessor 202411L // # define __cpp_lib_associative_heterogeneous_insertion 202306L // # define __cpp_lib_atomic_min_max 202403L +# undef __cpp_lib_atomic_ref +# define __cpp_lib_atomic_ref 202411L # undef __cpp_lib_bind_front # define __cpp_lib_bind_front 202306L # define __cpp_lib_bitset 202306L diff --git a/libcxx/test/benchmarks/bitset.bench.cpp b/libcxx/test/benchmarks/bitset.bench.cpp index 8fcf52e..b4c7e6f 100644 --- a/libcxx/test/benchmarks/bitset.bench.cpp +++ b/libcxx/test/benchmarks/bitset.bench.cpp @@ -103,7 +103,7 @@ BENCHMARK(BM_BitsetToString<262144>)->Arg(50)->Name("BM_BitsetToString<262144>/U BENCHMARK(BM_BitsetToString<524288>)->Arg(50)->Name("BM_BitsetToString<524288>/Uniform (50%)"); BENCHMARK(BM_BitsetToString<1048576>)->Arg(50)->Name("BM_BitsetToString<1048576>/Uniform (50%)"); // 1 << 20 -static void BM_ctor_ull(benchmark::State& state) { +static void BM_Bitset_ctor_ull(benchmark::State& state) { unsigned long long val = (1ULL << state.range(0)) - 1; for (auto _ : state) { std::bitset<128> b(val); @@ -111,6 +111,6 @@ static void BM_ctor_ull(benchmark::State& state) { } } -BENCHMARK(BM_ctor_ull)->DenseRange(1, 63); +BENCHMARK(BM_Bitset_ctor_ull)->DenseRange(1, 63); BENCHMARK_MAIN(); diff --git a/libcxx/test/benchmarks/containers/associative/associative_container_benchmarks.h b/libcxx/test/benchmarks/containers/associative/associative_container_benchmarks.h index b395698..22a6d0d 100644 --- a/libcxx/test/benchmarks/containers/associative/associative_container_benchmarks.h +++ b/libcxx/test/benchmarks/containers/associative/associative_container_benchmarks.h @@ -305,11 +305,19 @@ void associative_container_benchmarks(std::string container) { // The insert(hint, ...) methods are only relevant for ordered containers, and we lack // a good way to compute a hint for unordered ones. if constexpr (is_ordered_container) { - bench("insert(hint, value) (good hint)", [=](auto& st) { + auto insert_good_hint_bench = [=](bool bench_end_iter, auto& st) { const std::size_t size = st.range(0); std::vector<Value> in = make_value_types(generate_unique_keys(size + 1)); - Value to_insert = in.back(); - in.pop_back(); + auto skipped_val = bench_end_iter ? in.size() - 1 : in.size() / 2; + Value to_insert = in[skipped_val]; + { // Remove the element + std::vector<Value> tmp; + tmp.reserve(in.size() - 1); + for (size_t i = 0; i != in.size(); ++i) + if (i != skipped_val) + tmp.emplace_back(in[i]); + in = std::move(tmp); + } std::vector<Container> c(BatchSize, Container(in.begin(), in.end())); typename Container::iterator hints[BatchSize]; @@ -332,13 +340,23 @@ void associative_container_benchmarks(std::string container) { } st.ResumeTiming(); } - }); + }; + bench("insert(hint, value) (good hint, end)", [=](auto& state) { insert_good_hint_bench(true, state); }); + bench("insert(hint, value) (good hint, middle)", [=](auto& state) { insert_good_hint_bench(false, state); }); - bench("insert(hint, value) (bad hint)", [=](auto& st) { + auto insert_bad_hint_bench = [=](bool bench_end_iter, auto& st) { const std::size_t size = st.range(0); std::vector<Value> in = make_value_types(generate_unique_keys(size + 1)); - Value to_insert = in.back(); - in.pop_back(); + auto skipped_val = bench_end_iter ? in.size() - 1 : in.size() / 2; + Value to_insert = in[skipped_val]; + { // Remove the element + std::vector<Value> tmp; + tmp.reserve(in.size() - 1); + for (size_t i = 0; i != in.size(); ++i) + if (i != skipped_val) + tmp.emplace_back(in[i]); + in = std::move(tmp); + } std::vector<Container> c(BatchSize, Container(in.begin(), in.end())); while (st.KeepRunningBatch(BatchSize)) { @@ -355,7 +373,10 @@ void associative_container_benchmarks(std::string container) { } st.ResumeTiming(); } - }); + }; + + bench("insert(hint, value) (bad hint, end)", [=](auto& state) { insert_bad_hint_bench(true, state); }); + bench("insert(hint, value) (bad hint, middle)", [=](auto& state) { insert_bad_hint_bench(false, state); }); } bench("insert(iterator, iterator) (all new keys)", [=](auto& st) { diff --git a/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp b/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp index 320ef57..1bd5792 100644 --- a/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp +++ b/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add.verify.cpp @@ -6,8 +6,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: FROZEN-CXX03-HEADERS-FIXME - // <atomic> // template <class T> @@ -48,12 +46,12 @@ void pointer_to_incomplete_type() { void function_pointer() { { volatile std::atomic<void (*)(int)> fun; - // expected-error-re@*:* {{static assertion failed due to requirement '!is_function<void (int)>::value'{{.*}}Pointer to function isn't allowed}} + // expected-error-re@*:* {{static assertion failed due to requirement {{.+}}Pointer to function isn't allowed}} std::atomic_fetch_add(&fun, 0); } { std::atomic<void (*)(int)> fun; - // expected-error-re@*:* {{static assertion failed due to requirement '!is_function<void (int)>::value'{{.*}}Pointer to function isn't allowed}} + // expected-error-re@*:* {{static assertion failed due to requirement {{.+}}Pointer to function isn't allowed}} std::atomic_fetch_add(&fun, 0); } } diff --git a/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.verify.cpp b/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.verify.cpp index bdd8089..bdd4a83 100644 --- a/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.verify.cpp +++ b/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_add_explicit.verify.cpp @@ -6,8 +6,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: FROZEN-CXX03-HEADERS-FIXME - // <atomic> // template <class T> @@ -51,12 +49,12 @@ void pointer_to_incomplete_type() { void function_pointer() { { volatile std::atomic<void (*)(int)> fun; - // expected-error-re@*:* {{static assertion failed due to requirement '!is_function<void (int)>::value'{{.*}}Pointer to function isn't allowed}} + // expected-error-re@*:* {{static assertion failed due to requirement {{.+}}Pointer to function isn't allowed}} std::atomic_fetch_add_explicit(&fun, 0, std::memory_order_relaxed); } { std::atomic<void (*)(int)> fun; - // expected-error-re@*:* {{static assertion failed due to requirement '!is_function<void (int)>::value'{{.*}}Pointer to function isn't allowed}} + // expected-error-re@*:* {{static assertion failed due to requirement {{.+}}Pointer to function isn't allowed}} std::atomic_fetch_add_explicit(&fun, 0, std::memory_order_relaxed); } } diff --git a/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.verify.cpp b/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.verify.cpp index 2c9f898..105a010 100644 --- a/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.verify.cpp +++ b/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub.verify.cpp @@ -6,8 +6,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: FROZEN-CXX03-HEADERS-FIXME - // <atomic> // template <class T> @@ -48,12 +46,12 @@ void pointer_to_incomplete_type() { void function_pointer() { { volatile std::atomic<void (*)(int)> fun; - // expected-error-re@*:* {{static assertion failed due to requirement '!is_function<void (int)>::value'{{.*}}Pointer to function isn't allowed}} + // expected-error-re@*:* {{static assertion failed due to requirement {{.+}}Pointer to function isn't allowed}} std::atomic_fetch_sub(&fun, 0); } { std::atomic<void (*)(int)> fun; - // expected-error-re@*:* {{static assertion failed due to requirement '!is_function<void (int)>::value'{{.*}}Pointer to function isn't allowed}} + // expected-error-re@*:* {{static assertion failed due to requirement {{.+}}Pointer to function isn't allowed}} std::atomic_fetch_sub(&fun, 0); } } diff --git a/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.verify.cpp b/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.verify.cpp index 88c4275..1647ed3 100644 --- a/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.verify.cpp +++ b/libcxx/test/libcxx-03/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_sub_explicit.verify.cpp @@ -6,8 +6,6 @@ // //===----------------------------------------------------------------------===// -// XFAIL: FROZEN-CXX03-HEADERS-FIXME - // <atomic> // template <class T> @@ -51,12 +49,12 @@ void pointer_to_incomplete_type() { void function_pointer() { { volatile std::atomic<void (*)(int)> fun; - // expected-error-re@*:* {{static assertion failed due to requirement '!is_function<void (int)>::value'{{.*}}Pointer to function isn't allowed}} + // expected-error-re@*:* {{static assertion failed due to requirement {{.+}}Pointer to function isn't allowed}} std::atomic_fetch_sub_explicit(&fun, 0, std::memory_order_relaxed); } { std::atomic<void (*)(int)> fun; - // expected-error-re@*:* {{static assertion failed due to requirement '!is_function<void (int)>::value'{{.*}}Pointer to function isn't allowed}} + // expected-error-re@*:* {{static assertion failed due to requirement {{.+}}Pointer to function isn't allowed}} std::atomic_fetch_sub_explicit(&fun, 0, std::memory_order_relaxed); } } diff --git a/libcxx/test/libcxx-03/input.output/string.streams/stringbuf/const_sso_buffer.pass.cpp b/libcxx/test/libcxx-03/input.output/string.streams/stringbuf/const_sso_buffer.pass.cpp index 2b6c380..d6caa33 100644 --- a/libcxx/test/libcxx-03/input.output/string.streams/stringbuf/const_sso_buffer.pass.cpp +++ b/libcxx/test/libcxx-03/input.output/string.streams/stringbuf/const_sso_buffer.pass.cpp @@ -8,8 +8,6 @@ // <sstream> -// XFAIL: FROZEN-CXX03-HEADERS-FIXME - // How the constructors of basic_stringbuf initialize the buffer pointers is // not specified. For some constructors it's implementation defined whether the // pointers are set to nullptr. Libc++'s implementation directly uses the SSO diff --git a/libcxx/test/libcxx/diagnostics/atomic.nodiscard.verify.cpp b/libcxx/test/libcxx/diagnostics/atomic.nodiscard.verify.cpp new file mode 100644 index 0000000..85e5f0b --- /dev/null +++ b/libcxx/test/libcxx/diagnostics/atomic.nodiscard.verify.cpp @@ -0,0 +1,33 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// REQUIRES: std-at-least-c++26 + +// check that <atomic> functions are marked [[nodiscard]] + +#include <atomic> + +#include "atomic_helpers.h" +#include "test_macros.h" + +template <typename T> +struct TestAtomicRef { + void operator()() const { + T x(T(1)); + const std::atomic_ref<T> a(x); + + a.address(); // expected-warning 4 {{ignoring return value of function declared with 'nodiscard' attribute}} + } +}; + +void test() { + TestAtomicRef<UserAtomicType>()(); + TestAtomicRef<int>()(); + TestAtomicRef<float>()(); + TestAtomicRef<char*>()(); +} diff --git a/libcxx/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.verify.cpp b/libcxx/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.verify.cpp index fcbf649..283adbc 100644 --- a/libcxx/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.verify.cpp +++ b/libcxx/test/libcxx/input.output/file.streams/fstreams/filebuf/traits_mismatch.verify.cpp @@ -15,8 +15,6 @@ // UNSUPPORTED: no-wide-characters -// XFAIL: FROZEN-CXX03-HEADERS-FIXME - #include <fstream> std::basic_filebuf<char, std::char_traits<wchar_t> > f; diff --git a/libcxx/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.verify.cpp b/libcxx/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.verify.cpp index 8eca76c..ba6f3c3 100644 --- a/libcxx/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.verify.cpp +++ b/libcxx/test/libcxx/input.output/file.streams/fstreams/traits_mismatch.verify.cpp @@ -15,8 +15,6 @@ // UNSUPPORTED: no-wide-characters -// XFAIL: FROZEN-CXX03-HEADERS-FIXME - #include <fstream> std::basic_fstream<char, std::char_traits<wchar_t> > f; diff --git a/libcxx/test/std/atomics/atomics.ref/address.pass.cpp b/libcxx/test/std/atomics/atomics.ref/address.pass.cpp new file mode 100644 index 0000000..e0db6a9 --- /dev/null +++ b/libcxx/test/std/atomics/atomics.ref/address.pass.cpp @@ -0,0 +1,37 @@ +// +// 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 +// +//===----------------------------------------------------------------------===// + +// REQUIRES: std-at-least-c++26 + +// constexpr T* address() const noexcept; + +#include <atomic> +#include <cassert> +#include <concepts> +#include <memory> + +#include "atomic_helpers.h" +#include "test_macros.h" + +template <typename T> +struct TestAddress { + void operator()() const { + T x(T(1)); + const std::atomic_ref<T> a(x); + + std::same_as<T*> decltype(auto) p = a.address(); + assert(std::addressof(x) == p); + + static_assert(noexcept((a.address()))); + } +}; + +int main(int, char**) { + TestEachAtomicType<TestAddress>()(); + + return 0; +} diff --git a/libcxx/test/std/atomics/types.pass.cpp b/libcxx/test/std/atomics/types.pass.cpp index c979392..b1edec5 100644 --- a/libcxx/test/std/atomics/types.pass.cpp +++ b/libcxx/test/std/atomics/types.pass.cpp @@ -17,9 +17,6 @@ // typedef T value_type; // }; -// atomic still has a difference_type in the C++03 frozen headers -// XFAIL: FROZEN-CXX03-HEADERS-FIXME - #include <atomic> #include <chrono> #include <cstdint> diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp index 00de053..679eec2 100644 --- a/libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp @@ -11,8 +11,6 @@ // (bug report: https://llvm.org/PR58392) // Check that vector constructors don't leak memory when an operation inside the constructor throws an exception -// XFAIL: FROZEN-CXX03-HEADERS-FIXME - #include <cstddef> #include <memory> #include <type_traits> diff --git a/libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp b/libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp index dac4396..d131f5c 100644 --- a/libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp +++ b/libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.cons/default.pass.cpp @@ -15,8 +15,6 @@ // basic_stringbuf() : basic_stringbuf(ios_base::in | ios_base::out) {} // C++20 // explicit basic_stringbuf(ios_base::openmode which); // C++20 -// XFAIL: FROZEN-CXX03-HEADERS-FIXME - #include <sstream> #include <cassert> diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.compile.pass.cpp index 93eb43c..8bd0274 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/atomic.version.compile.pass.cpp @@ -355,8 +355,8 @@ # ifndef __cpp_lib_atomic_ref # error "__cpp_lib_atomic_ref should be defined in c++26" # endif -# if __cpp_lib_atomic_ref != 201806L -# error "__cpp_lib_atomic_ref should have the value 201806L in c++26" +# if __cpp_lib_atomic_ref != 202411L +# error "__cpp_lib_atomic_ref should have the value 202411L in c++26" # endif # if !defined(_LIBCPP_VERSION) diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp index d1fd55f..05af1fb 100644 --- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp +++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp @@ -6325,8 +6325,8 @@ # ifndef __cpp_lib_atomic_ref # error "__cpp_lib_atomic_ref should be defined in c++26" # endif -# if __cpp_lib_atomic_ref != 201806L -# error "__cpp_lib_atomic_ref should have the value 201806L in c++26" +# if __cpp_lib_atomic_ref != 202411L +# error "__cpp_lib_atomic_ref should have the value 202411L in c++26" # endif # if !defined(_LIBCPP_VERSION) diff --git a/libcxx/test/std/re/re.alg/re.alg.match/ecma.pass.cpp b/libcxx/test/std/re/re.alg/re.alg.match/ecma.pass.cpp index 799a362..0184a38 100644 --- a/libcxx/test/std/re/re.alg/re.alg.match/ecma.pass.cpp +++ b/libcxx/test/std/re/re.alg/re.alg.match/ecma.pass.cpp @@ -7,8 +7,6 @@ //===----------------------------------------------------------------------===// // -// XFAIL: FROZEN-CXX03-HEADERS-FIXME - // <regex> // template <class BidirectionalIterator, class Allocator, class charT, class traits> diff --git a/libcxx/test/std/re/re.regex/re.regex.construct/bad_range.pass.cpp b/libcxx/test/std/re/re.regex/re.regex.construct/bad_range.pass.cpp index ecfdaee..cabd9eb 100644 --- a/libcxx/test/std/re/re.regex/re.regex.construct/bad_range.pass.cpp +++ b/libcxx/test/std/re/re.regex/re.regex.construct/bad_range.pass.cpp @@ -14,8 +14,6 @@ // template <class ST, class SA> // basic_regex(const basic_string<charT, ST, SA>& s); -// XFAIL: FROZEN-CXX03-HEADERS-FIXME - #include <regex> #include <cassert> #include "test_macros.h" diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_implicit_lifetime.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_implicit_lifetime.pass.cpp index 5264e770..881a5d2 100644 --- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_implicit_lifetime.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_implicit_lifetime.pass.cpp @@ -226,7 +226,9 @@ constexpr bool test() { #ifdef _LIBCPP_VERSION // These types should be implicit-lifetime, but they are not guaranteed to be so. +# ifndef _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR test_is_implicit_lifetime<std::pair<int, float>>(); +# endif test_is_implicit_lifetime<std::tuple<int, float>>(); #endif diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml index d564ea6..ca83af9 100644 --- a/libcxx/utils/ci/buildkite-pipeline.yml +++ b/libcxx/utils/ci/buildkite-pipeline.yml @@ -122,8 +122,8 @@ steps: - label: FreeBSD 13 amd64 command: libcxx/utils/ci/run-buildbot generic-cxx26 env: - CC: clang19 - CXX: clang++19 + CC: clang20 + CXX: clang++20 agents: queue: libcxx-builders os: freebsd diff --git a/libcxx/utils/ci/docker-compose.yml b/libcxx/utils/ci/docker-compose.yml index cac97a9..9367a8f 100644 --- a/libcxx/utils/ci/docker-compose.yml +++ b/libcxx/utils/ci/docker-compose.yml @@ -23,7 +23,7 @@ services: dockerfile: Dockerfile target: actions-builder args: - GITHUB_RUNNER_VERSION: "2.328.0" + GITHUB_RUNNER_VERSION: "2.329.0" <<: [*image_versions, *compiler_versions] android-buildkite-builder: diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py index 63204d7..f6f2527 100644 --- a/libcxx/utils/generate_feature_test_macro_components.py +++ b/libcxx/utils/generate_feature_test_macro_components.py @@ -195,7 +195,10 @@ feature_test_macros = [ }, { "name": "__cpp_lib_atomic_ref", - "values": {"c++20": 201806}, + "values": { + "c++20": 201806, + "c++26": 202411, # P2835R7: Expose std::atomic_ref 's object address + }, "headers": ["atomic"], }, { |