Nullability check for dlfcn module
Bugs: b/245972273
Test: adb shell
Change-Id: I0ecde8a0f1f71b6ec2262ff637d33c518578d54d
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp
index 939c092..3f70279 100644
--- a/tests/dlfcn_test.cpp
+++ b/tests/dlfcn_test.cpp
@@ -889,11 +889,14 @@
void* sym;
#if defined(__BIONIC__) && !defined(__LP64__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
// RTLD_DEFAULT in lp32 bionic is not (void*)0
// so it can be distinguished from the NULL handle.
sym = dlsym(nullptr, "test");
ASSERT_TRUE(sym == nullptr);
ASSERT_STREQ("dlsym failed: library handle is null", dlerror());
+#pragma clang diagnostic pop
#endif
// Symbol that doesn't exist.
@@ -1008,9 +1011,12 @@
dlerror(); // Clear any pending errors.
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
// No symbol corresponding to NULL.
ASSERT_EQ(dladdr(nullptr, &info), 0); // Zero on error, non-zero on success.
ASSERT_TRUE(dlerror() == nullptr); // dladdr(3) doesn't set dlerror(3).
+#pragma clang diagnostic pop
// No symbol corresponding to a stack address.
ASSERT_EQ(dladdr(&info, &info), 0); // Zero on error, non-zero on success.