Modernize codebase by replacing NULL with nullptr
Fixes -Wzero-as-null-pointer-constant warning.
Test: m
Bug: 68236239
Change-Id: I5b4123bc6709641315120a191e36cc57541349b2
diff --git a/tests/stdatomic_test.cpp b/tests/stdatomic_test.cpp
index 389b251..d122d2f 100644
--- a/tests/stdatomic_test.cpp
+++ b/tests/stdatomic_test.cpp
@@ -206,7 +206,7 @@
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 @@
// 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 @@
// 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 @@
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);