summaryrefslogtreecommitdiff
path: root/tests/stdatomic_test.cpp
diff options
context:
space:
mode:
authorYi Kong <yikong@google.com>2018-08-02 17:31:13 -0700
committerYi Kong <yikong@google.com>2018-08-02 18:09:44 -0700
commit32bc0fcf69dfccb3726fe572833a38b01179580e (patch)
treeabca656f500087493e0997d5cf38cbcc9ec98eb8 /tests/stdatomic_test.cpp
parent65f82092a17518080178ff7004cc6db362ebfbcd (diff)
Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning. Test: m Bug: 68236239 Change-Id: I5b4123bc6709641315120a191e36cc57541349b2
Diffstat (limited to 'tests/stdatomic_test.cpp')
-rw-r--r--tests/stdatomic_test.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/stdatomic_test.cpp b/tests/stdatomic_test.cpp
index 389b2511d..d122d2f39 100644
--- a/tests/stdatomic_test.cpp
+++ b/tests/stdatomic_test.cpp
@@ -206,7 +206,7 @@ static void* writer(void* arg) {
atomic_store_explicit(&a->z, i+1, memory_order_relaxed);
atomic_store_explicit(&a->y, i+1, memory_order_release);
}
- return 0;
+ return nullptr;
}
static void* reader(void* arg) {
@@ -224,13 +224,13 @@ static void* reader(void* arg) {
// Cant just ASSERT, since we are in a non-void function.
ADD_FAILURE() << "acquire-release ordering violation: "
<< zval << " < " << yval << ", " << xval << "\n";
- return 0; // Only report once.
+ return nullptr; // Only report once.
}
if (xval < yval) {
// Cant just ASSERT, since we are in a non-void function.
ADD_FAILURE() << "acquire-release ordering violation: "
<< xval << " < " << yval << ", " << zval << "\n";
- return 0; // Only report once.
+ return nullptr; // Only report once.
}
if (repeat < repeat_limit) ++repeat;
}
@@ -238,7 +238,7 @@ static void* reader(void* arg) {
// But if it fails to hold, this test was useless, and we have a
// serious scheduling issue that we should probably know about.
EXPECT_EQ(repeat, repeat_limit);
- return 0;
+ return nullptr;
}
TEST(stdatomic, ordering) {
@@ -249,12 +249,12 @@ TEST(stdatomic, ordering) {
atomic_init(&a.y, 0ul);
atomic_init(&a.z, 0ul);
pthread_t t1,t2;
- ASSERT_EQ(0, pthread_create(&t1, 0, reader, &a));
- ASSERT_EQ(0, pthread_create(&t2, 0, writer, &a));
+ ASSERT_EQ(0, pthread_create(&t1, nullptr, reader, &a));
+ ASSERT_EQ(0, pthread_create(&t2, nullptr, writer, &a));
ASSERT_EQ(0, pthread_join(t1, &result));
- EXPECT_EQ(0, result);
+ EXPECT_EQ(nullptr, result);
ASSERT_EQ(0, pthread_join(t2, &result));
- EXPECT_EQ(0, result);
+ EXPECT_EQ(nullptr, result);
EXPECT_EQ(atomic_load_explicit(&a.x, memory_order_consume), BIG + 1);
EXPECT_EQ(atomic_load_explicit(&a.y, memory_order_seq_cst), BIG + 1);
EXPECT_EQ(atomic_load(&a.z), BIG + 1);