forked from OSchip/llvm-project
[libcxx] [test] Replace non-Standard "atomic_flag f(false);" with Standard "atomic_flag f;"
Summary: Replace non-Standard "atomic_flag f(false);" with Standard "atomic_flag f;" in clear tests. Although the value of 'f' is unspecified it shouldn't matter because these tests always call `f.test_and_set()` without checking the result, so the initial state shouldn't matter. The test init03.pass.cpp is explicitly testing this non-Standard extension; It has been moved into the `test/libcxx` directory. Reviewers: mclow.lists, STL_MSFT Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D19758 llvm-svn: 268355
This commit is contained in:
parent
43a10eb637
commit
15a297212f
|
@ -1689,7 +1689,7 @@ typedef struct atomic_flag
|
||||||
#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||||
|
|
||||||
_LIBCPP_INLINE_VISIBILITY
|
_LIBCPP_INLINE_VISIBILITY
|
||||||
atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {}
|
atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} // EXTENSION
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||||
atomic_flag(const atomic_flag&) = delete;
|
atomic_flag(const atomic_flag&) = delete;
|
||||||
|
|
|
@ -20,6 +20,12 @@
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
std::atomic_flag f(false);
|
{
|
||||||
assert(f.test_and_set() == 0);
|
std::atomic_flag f(false);
|
||||||
|
assert(f.test_and_set() == 0);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::atomic_flag f(true);
|
||||||
|
assert(f.test_and_set() == 1);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -22,13 +22,13 @@
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::atomic_flag f(false);
|
std::atomic_flag f;
|
||||||
f.test_and_set();
|
f.test_and_set();
|
||||||
atomic_flag_clear(&f);
|
atomic_flag_clear(&f);
|
||||||
assert(f.test_and_set() == 0);
|
assert(f.test_and_set() == 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
volatile std::atomic_flag f(false);
|
volatile std::atomic_flag f;
|
||||||
f.test_and_set();
|
f.test_and_set();
|
||||||
atomic_flag_clear(&f);
|
atomic_flag_clear(&f);
|
||||||
assert(f.test_and_set() == 0);
|
assert(f.test_and_set() == 0);
|
||||||
|
|
|
@ -22,37 +22,37 @@
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::atomic_flag f(false);
|
std::atomic_flag f;
|
||||||
f.test_and_set();
|
f.test_and_set();
|
||||||
atomic_flag_clear_explicit(&f, std::memory_order_relaxed);
|
atomic_flag_clear_explicit(&f, std::memory_order_relaxed);
|
||||||
assert(f.test_and_set() == 0);
|
assert(f.test_and_set() == 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::atomic_flag f(false);
|
std::atomic_flag f;
|
||||||
f.test_and_set();
|
f.test_and_set();
|
||||||
atomic_flag_clear_explicit(&f, std::memory_order_release);
|
atomic_flag_clear_explicit(&f, std::memory_order_release);
|
||||||
assert(f.test_and_set() == 0);
|
assert(f.test_and_set() == 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::atomic_flag f(false);
|
std::atomic_flag f;
|
||||||
f.test_and_set();
|
f.test_and_set();
|
||||||
atomic_flag_clear_explicit(&f, std::memory_order_seq_cst);
|
atomic_flag_clear_explicit(&f, std::memory_order_seq_cst);
|
||||||
assert(f.test_and_set() == 0);
|
assert(f.test_and_set() == 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
volatile std::atomic_flag f(false);
|
volatile std::atomic_flag f;
|
||||||
f.test_and_set();
|
f.test_and_set();
|
||||||
atomic_flag_clear_explicit(&f, std::memory_order_relaxed);
|
atomic_flag_clear_explicit(&f, std::memory_order_relaxed);
|
||||||
assert(f.test_and_set() == 0);
|
assert(f.test_and_set() == 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
volatile std::atomic_flag f(false);
|
volatile std::atomic_flag f;
|
||||||
f.test_and_set();
|
f.test_and_set();
|
||||||
atomic_flag_clear_explicit(&f, std::memory_order_release);
|
atomic_flag_clear_explicit(&f, std::memory_order_release);
|
||||||
assert(f.test_and_set() == 0);
|
assert(f.test_and_set() == 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
volatile std::atomic_flag f(false);
|
volatile std::atomic_flag f;
|
||||||
f.test_and_set();
|
f.test_and_set();
|
||||||
atomic_flag_clear_explicit(&f, std::memory_order_seq_cst);
|
atomic_flag_clear_explicit(&f, std::memory_order_seq_cst);
|
||||||
assert(f.test_and_set() == 0);
|
assert(f.test_and_set() == 0);
|
||||||
|
|
|
@ -22,49 +22,49 @@
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::atomic_flag f(false);
|
std::atomic_flag f;
|
||||||
f.test_and_set();
|
f.test_and_set();
|
||||||
f.clear();
|
f.clear();
|
||||||
assert(f.test_and_set() == 0);
|
assert(f.test_and_set() == 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::atomic_flag f(false);
|
std::atomic_flag f;
|
||||||
f.test_and_set();
|
f.test_and_set();
|
||||||
f.clear(std::memory_order_relaxed);
|
f.clear(std::memory_order_relaxed);
|
||||||
assert(f.test_and_set() == 0);
|
assert(f.test_and_set() == 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::atomic_flag f(false);
|
std::atomic_flag f;
|
||||||
f.test_and_set();
|
f.test_and_set();
|
||||||
f.clear(std::memory_order_release);
|
f.clear(std::memory_order_release);
|
||||||
assert(f.test_and_set() == 0);
|
assert(f.test_and_set() == 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::atomic_flag f(false);
|
std::atomic_flag f;
|
||||||
f.test_and_set();
|
f.test_and_set();
|
||||||
f.clear(std::memory_order_seq_cst);
|
f.clear(std::memory_order_seq_cst);
|
||||||
assert(f.test_and_set() == 0);
|
assert(f.test_and_set() == 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
volatile std::atomic_flag f(false);
|
volatile std::atomic_flag f;
|
||||||
f.test_and_set();
|
f.test_and_set();
|
||||||
f.clear();
|
f.clear();
|
||||||
assert(f.test_and_set() == 0);
|
assert(f.test_and_set() == 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
volatile std::atomic_flag f(false);
|
volatile std::atomic_flag f;
|
||||||
f.test_and_set();
|
f.test_and_set();
|
||||||
f.clear(std::memory_order_relaxed);
|
f.clear(std::memory_order_relaxed);
|
||||||
assert(f.test_and_set() == 0);
|
assert(f.test_and_set() == 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
volatile std::atomic_flag f(false);
|
volatile std::atomic_flag f;
|
||||||
f.test_and_set();
|
f.test_and_set();
|
||||||
f.clear(std::memory_order_release);
|
f.clear(std::memory_order_release);
|
||||||
assert(f.test_and_set() == 0);
|
assert(f.test_and_set() == 0);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
volatile std::atomic_flag f(false);
|
volatile std::atomic_flag f;
|
||||||
f.test_and_set();
|
f.test_and_set();
|
||||||
f.clear(std::memory_order_seq_cst);
|
f.clear(std::memory_order_seq_cst);
|
||||||
assert(f.test_and_set() == 0);
|
assert(f.test_and_set() == 0);
|
||||||
|
|
Loading…
Reference in New Issue