[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 git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@268355 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
31
test/libcxx/atomics/atomics.flag/init_bool.pass.cpp
Normal file
31
test/libcxx/atomics/atomics.flag/init_bool.pass.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <atomic>
|
||||
|
||||
// struct atomic_flag
|
||||
|
||||
// TESTING EXTENSION atomic_flag(bool)
|
||||
|
||||
#include <atomic>
|
||||
#include <cassert>
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
std::atomic_flag f(false);
|
||||
assert(f.test_and_set() == 0);
|
||||
}
|
||||
{
|
||||
std::atomic_flag f(true);
|
||||
assert(f.test_and_set() == 1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user