Consistently use `#if defined(__BIONIC__)`.

Test: treehugger
Change-Id: I844b909404532eb9165cba1ed6f237bdd4a46990
diff --git a/tests/android_get_device_api_level.cpp b/tests/android_get_device_api_level.cpp
index 9bd6b3a..2e51022 100644
--- a/tests/android_get_device_api_level.cpp
+++ b/tests/android_get_device_api_level.cpp
@@ -28,12 +28,12 @@
 
 #include <gtest/gtest.h>
 
-#if __BIONIC__
+#if __has_include(<android/api-level.h>)
 #include <android/api-level.h>
 #endif
 
 TEST(android_get_device_api_level, smoke) {
-#if __BIONIC__
+#if defined(__BIONIC__)
   // This will fail if you run the tests on an old device, but who does that?
   ASSERT_GE(android_get_device_api_level(), 29);
 #endif
diff --git a/tests/fcntl_test.cpp b/tests/fcntl_test.cpp
index f8f559b..b3be18e 100644
--- a/tests/fcntl_test.cpp
+++ b/tests/fcntl_test.cpp
@@ -320,7 +320,7 @@
 }
 
 TEST(fcntl, open_O_TMPFILE_mode) {
-#if __BIONIC__ // Our glibc is too old for O_TMPFILE.
+#if defined(__BIONIC__)  // Our glibc is too old for O_TMPFILE.
   TemporaryDir dir;
   // Without O_EXCL, we're allowed to give this a name later.
   // (This is unrelated to the O_CREAT interaction with O_EXCL.)
diff --git a/tests/fortify_test.cpp b/tests/fortify_test.cpp
index cc3080d..29aba60 100644
--- a/tests/fortify_test.cpp
+++ b/tests/fortify_test.cpp
@@ -29,7 +29,7 @@
 
 #include <android-base/silent_death_test.h>
 
-#if __BIONIC__
+#if defined(__BIONIC__)
 #define ASSERT_FORTIFY(expr) ASSERT_EXIT(expr, testing::KilledBySignal(SIGABRT), "FORTIFY")
 #else
 #define ASSERT_FORTIFY(expr) ASSERT_EXIT(expr, testing::KilledBySignal(SIGABRT), "")
@@ -1014,7 +1014,7 @@
 }
 
 TEST_F(DEATHTEST, ppoll64_fortified) {
-#if __BIONIC__ // glibc doesn't have ppoll64.
+#if defined(__BIONIC__)        // glibc doesn't have ppoll64.
   nfds_t fd_count = atoi("2"); // suppress compiler optimizations
   pollfd buf[1] = {{0, POLLIN, 0}};
   // Set timeout to zero to prevent waiting in ppoll when fortify test fails.
@@ -1030,7 +1030,7 @@
 }
 
 TEST_F(DEATHTEST, open_O_TMPFILE_without_mode_fortified) {
-#if __BIONIC__ // Our glibc is too old for O_TMPFILE.
+#if defined(__BIONIC__)  // Our glibc is too old for O_TMPFILE.
   int flags = O_TMPFILE; // Fool the compiler.
   ASSERT_FORTIFY(open("", flags));
 #endif
diff --git a/tests/poll_test.cpp b/tests/poll_test.cpp
index 33143f8..5799fea 100644
--- a/tests/poll_test.cpp
+++ b/tests/poll_test.cpp
@@ -49,7 +49,7 @@
 }
 
 TEST(poll, ppoll64_null_fds) {
-#if __BIONIC__
+#if defined(__BIONIC__)
   // Because nanosleep(2) is relatively new to POSIX, code sometimes abuses poll.
   errno = 0;
   timespec ts = { .tv_nsec = 100 };
diff --git a/tests/time_test.cpp b/tests/time_test.cpp
index 5e97c63..ca8e260 100644
--- a/tests/time_test.cpp
+++ b/tests/time_test.cpp
@@ -1269,7 +1269,7 @@
 }
 
 TEST(time, timespec_get) {
-#if __BIONIC__
+#if defined(__BIONIC__)
   timespec ts = {};
   ASSERT_EQ(TIME_UTC, timespec_get(&ts, TIME_UTC));
   ASSERT_EQ(TIME_MONOTONIC, timespec_get(&ts, TIME_MONOTONIC));
@@ -1281,7 +1281,7 @@
 }
 
 TEST(time, timespec_get_invalid) {
-#if __BIONIC__
+#if defined(__BIONIC__)
   timespec ts = {};
   ASSERT_EQ(0, timespec_get(&ts, 123));
 #else
@@ -1290,7 +1290,7 @@
 }
 
 TEST(time, timespec_getres) {
-#if __BIONIC__
+#if defined(__BIONIC__)
   timespec ts = {};
   ASSERT_EQ(TIME_UTC, timespec_getres(&ts, TIME_UTC));
   ASSERT_EQ(1, ts.tv_nsec);
@@ -1301,7 +1301,7 @@
 }
 
 TEST(time, timespec_getres_invalid) {
-#if __BIONIC__
+#if defined(__BIONIC__)
   timespec ts = {};
   ASSERT_EQ(0, timespec_getres(&ts, 123));
 #else
@@ -1315,7 +1315,7 @@
 }
 
 TEST(time, tzfree_null) {
-#if __BIONIC__
+#if defined(__BIONIC__)
   tzfree(nullptr);
 #else
   GTEST_SKIP() << "glibc doesn't have timezone_t";
@@ -1323,7 +1323,7 @@
 }
 
 TEST(time, localtime_rz) {
-#if __BIONIC__
+#if defined(__BIONIC__)
   setenv("TZ", "America/Los_Angeles", 1);
   tzset();
 
@@ -1377,7 +1377,7 @@
 }
 
 TEST(time, mktime_z) {
-#if __BIONIC__
+#if defined(__BIONIC__)
   setenv("TZ", "America/Los_Angeles", 1);
   tzset();
 
@@ -1417,7 +1417,7 @@
 }
 
 TEST(time, tzalloc_nullptr) {
-#if __BIONIC__
+#if defined(__BIONIC__)
   // tzalloc(nullptr) returns the system timezone.
   timezone_t default_tz = tzalloc(nullptr);
   ASSERT_NE(nullptr, default_tz);
@@ -1453,7 +1453,7 @@
 }
 
 TEST(time, tzalloc_unique_ptr) {
-#if __BIONIC__
+#if defined(__BIONIC__)
   std::unique_ptr<std::remove_pointer_t<timezone_t>, decltype(&tzfree)> tz{tzalloc("Asia/Seoul"),
                                                                            tzfree};
 #else