Change stdatomic.h check from defined(_USING_LIBCXX) to __has_include(<atomic>)
The previous check was causing some problems with platform builds
using the NDK. The new check is more accurate.
Move the C definitions from stdatomic.h to bits/stdatomic.h since
with the new check, we no longer can use the #undef trick to test
them.
Test: build platform NDK with stdatomic.h in pthread.h header
Test: stdatomic bionic-unit-tests
Change-Id: Ia0bc3cc8344f2ba4e6e55a52248fb6efee799d1d
diff --git a/tests/stdatomic_test.cpp b/tests/stdatomic_test.cpp
index d122d2f..a9665d1 100644
--- a/tests/stdatomic_test.cpp
+++ b/tests/stdatomic_test.cpp
@@ -15,9 +15,14 @@
*/
#include <gtest/gtest.h>
-// Fool stdatomic.h into not using <atomic>.
-#undef _USING_LIBCXX
+
+#if defined(__ANDROID__)
+#include <bits/stdatomic.h>
+#else
+#undef _USING_LIBCXX //TODO(b/137876753): Remove this
#include <stdatomic.h>
+#endif
+
#include <pthread.h>
#include <stdint.h>