Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions libcxx/include/__cxx03/__atomic/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions libcxx/include/__cxx03/__atomic/atomic_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>));
}
Expand Down Expand Up @@ -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) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//

// XFAIL: FROZEN-CXX03-HEADERS-FIXME

// <atomic>

// template <class T>
Expand Down Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//

// XFAIL: FROZEN-CXX03-HEADERS-FIXME

// <atomic>

// template <class T>
Expand Down Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//

// XFAIL: FROZEN-CXX03-HEADERS-FIXME

// <atomic>

// template <class T>
Expand Down Expand Up @@ -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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//

// XFAIL: FROZEN-CXX03-HEADERS-FIXME

// <atomic>

// template <class T>
Expand Down Expand Up @@ -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);
}
}
Expand Down
3 changes: 0 additions & 3 deletions libcxx/test/std/atomics/types.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Loading