Nullability check for stdlib module.

Bugs: b/245972273
Test: None

Change-Id: Ib33a5359a924c21888f268158c4d7f824740dd55
diff --git a/tests/clang_fortify_tests.cpp b/tests/clang_fortify_tests.cpp
index 40cb83f..544af43 100644
--- a/tests/clang_fortify_tests.cpp
+++ b/tests/clang_fortify_tests.cpp
@@ -387,6 +387,8 @@
 }
 
 static void testStdlib() {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
   char path_buffer[PATH_MAX - 1];
   // expected-warning@+2{{ignoring return value of function}}
   // expected-error@+1{{must be NULL or a pointer to a buffer with >= PATH_MAX bytes}}
@@ -401,6 +403,7 @@
   // expected-warning@+2{{ignoring return value of function}}
   // expected-error@+1{{flipped arguments?}}
   realpath(nullptr, nullptr);
+#pragma clang diagnostic pop
 }
 }  // namespace compilation_tests
 #endif
diff --git a/tests/stdlib_test.cpp b/tests/stdlib_test.cpp
index f507e08..45169e3 100644
--- a/tests/stdlib_test.cpp
+++ b/tests/stdlib_test.cpp
@@ -494,7 +494,10 @@
 TEST(stdlib, system_NULL) {
   // "The system() function shall always return non-zero when command is NULL."
   // http://pubs.opengroup.org/onlinepubs/9699919799/functions/system.html
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
   ASSERT_NE(0, system(nullptr));
+#pragma clang diagnostic pop
 }
 
 // https://austingroupbugs.net/view.php?id=1440
diff --git a/tests/unistd_test.cpp b/tests/unistd_test.cpp
index 5fce5b8..2a36460 100644
--- a/tests/unistd_test.cpp
+++ b/tests/unistd_test.cpp
@@ -294,10 +294,13 @@
 }
 
 TEST(UNISTD_TEST, setenv_EINVAL) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnonnull"
   EXPECT_EQ(-1, setenv(nullptr, "value", 0));
   EXPECT_EQ(EINVAL, errno);
   EXPECT_EQ(-1, setenv(nullptr, "value", 1));
   EXPECT_EQ(EINVAL, errno);
+#pragma clang diagnostic pop
   EXPECT_EQ(-1, setenv("", "value", 0));
   EXPECT_EQ(EINVAL, errno);
   EXPECT_EQ(-1, setenv("", "value", 1));