[libcxx] r281921 - Replace __ANDROID__ with __BIONIC__.

Dan Albert via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 19 11:00:46 PDT 2016


Author: danalbert
Date: Mon Sep 19 13:00:45 2016
New Revision: 281921

URL: http://llvm.org/viewvc/llvm-project?rev=281921&view=rev
Log:
Replace __ANDROID__ with __BIONIC__.

Summary:
None of these checks are specific to Android devices. If libc++ was
used with Bionic on a normal Linux system these checks would still be
needed.

Reviewers: mclow.lists, EricWF

Subscribers: compnerd, tberghammer, danalbert, srhines, cfe-commits

Differential Revision: https://reviews.llvm.org/D24690

Modified:
    libcxx/trunk/include/__config
    libcxx/trunk/include/support/android/locale_bionic.h
    libcxx/trunk/src/locale.cpp

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=281921&r1=281920&r2=281921&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Mon Sep 19 13:00:45 2016
@@ -85,6 +85,13 @@
 #define __is_identifier(__x) 1
 #endif
 
+// Need to detect which libc we're using if we're on Linux.
+#if defined(__linux__)
+#include <features.h>
+#if !defined(__GLIBC_PREREQ)
+#define __GLIBC_PREREQ(a, b) 0
+#endif // !defined(__GLIBC_PREREQ)
+#endif // defined(__linux__)
 
 #ifdef __LITTLE_ENDIAN__
 #if __LITTLE_ENDIAN__
@@ -333,12 +340,9 @@ typedef __char32_t char32_t;
 #if defined(__FreeBSD__)
 #define _LIBCPP_HAS_QUICK_EXIT
 #define _LIBCPP_HAS_C11_FEATURES
-#elif defined(__ANDROID__)
-#define _LIBCPP_HAS_QUICK_EXIT
 #elif defined(__linux__)
 #if !defined(_LIBCPP_HAS_MUSL_LIBC)
-# include <features.h>
-#if __GLIBC_PREREQ(2, 15)
+#if __GLIBC_PREREQ(2, 15) || defined(__BIONIC__)
 #define _LIBCPP_HAS_QUICK_EXIT
 #endif
 #if __GLIBC_PREREQ(2, 17)
@@ -759,7 +763,7 @@ template <unsigned> struct __static_asse
 
 #if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
 // Most unix variants have catopen.  These are the specific ones that don't.
-#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(_NEWLIB_VERSION)
+#if !defined(_WIN32) && !defined(__BIONIC__) && !defined(_NEWLIB_VERSION)
 #define _LIBCPP_HAS_CATOPEN 1
 #endif
 #endif
@@ -885,7 +889,8 @@ extern "C" void __sanitizer_annotate_con
 #define _LIBCPP_HAS_NO_STDOUT
 #endif
 
-#if defined(__ANDROID__) || defined(__CloudABI__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#if defined(__BIONIC__) || defined(__CloudABI__) ||                            \
+    defined(_LIBCPP_HAS_MUSL_LIBC)
 #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
 #endif
 

Modified: libcxx/trunk/include/support/android/locale_bionic.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/support/android/locale_bionic.h?rev=281921&r1=281920&r2=281921&view=diff
==============================================================================
--- libcxx/trunk/include/support/android/locale_bionic.h (original)
+++ libcxx/trunk/include/support/android/locale_bionic.h Mon Sep 19 13:00:45 2016
@@ -11,7 +11,7 @@
 #ifndef _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H
 #define _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H
 
-#if defined(__ANDROID__)
+#if defined(__BIONIC__)
 
 #ifdef __cplusplus
 extern "C" {
@@ -27,5 +27,5 @@ extern "C" {
 #include <support/xlocale/__posix_l_fallback.h>
 #include <support/xlocale/__strtonum_fallback.h>
 
-#endif // defined(__ANDROID__)
+#endif // defined(__BIONIC__)
 #endif // _LIBCPP_SUPPORT_ANDROID_LOCALE_BIONIC_H

Modified: libcxx/trunk/src/locale.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/locale.cpp?rev=281921&r1=281920&r2=281921&view=diff
==============================================================================
--- libcxx/trunk/src/locale.cpp (original)
+++ libcxx/trunk/src/locale.cpp Mon Sep 19 13:00:45 2016
@@ -28,7 +28,7 @@
 #include "__sso_allocator"
 #if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
 #include "support/win32/locale_win32.h"
-#elif !defined(__ANDROID__)
+#elif !defined(__BIONIC__)
 #include <langinfo.h>
 #endif
 #include <stdlib.h>




More information about the cfe-commits mailing list