labath created this revision.
labath added reviewers: tberghammer, zturner.
labath added a subscriber: lldb-commits.
Herald added subscribers: mgorny, srhines, danalbert.

This replaces all the uses of the __ANDROID_NDK__ define with ANDROID. This is a
preparatory step to remove our custom android toolchain file and rely on the
standard android NDK one instead. Our toolchain file defined both ANDROID and
__ANDROID_NDK__, while the NDK one just defines ANDROID. So, make things
consistent and just use ANDROID everywhere.

I haven't yet removed the cmake variable with the same name, as we will need to
do something completely different there -- NDK toolchain defines
CMAKE_SYSTEM_NAME to Android, while our current one pretends it's linux.


https://reviews.llvm.org/D27305

Files:
  cmake/platforms/Android.cmake
  include/lldb/Core/RegularExpression.h
  include/lldb/Host/Config.h
  include/lldb/Host/Editline.h
  include/lldb/Host/Host.h
  include/lldb/Host/HostInfo.h
  include/lldb/Host/Time.h
  include/lldb/Host/linux/Personality.h
  include/lldb/Host/posix/Fcntl.h
  source/Host/common/Host.cpp
  source/Host/common/Socket.cpp
  source/Host/linux/ProcessLauncherLinux.cpp
  source/Host/posix/HostInfoPosix.cpp
  source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
  source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
  source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp
  source/Utility/PseudoTerminal.cpp
  tools/driver/Driver.cpp

Index: tools/driver/Driver.cpp
===================================================================
--- tools/driver/Driver.cpp
+++ tools/driver/Driver.cpp
@@ -19,7 +19,7 @@
 #if defined(_WIN32)
 #include <fcntl.h>
 #include <io.h>
-#elif defined(__ANDROID_NDK__)
+#elif defined(ANDROID)
 #include <errno.h>
 #else
 #include <unistd.h>
Index: source/Utility/PseudoTerminal.cpp
===================================================================
--- source/Utility/PseudoTerminal.cpp
+++ source/Utility/PseudoTerminal.cpp
@@ -20,7 +20,7 @@
 
 #include "lldb/Host/PosixApi.h"
 
-#if defined(__ANDROID_NDK__)
+#if defined(ANDROID)
 int posix_openpt(int flags);
 #endif
 
Index: source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp
===================================================================
--- source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp
+++ source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp
@@ -120,7 +120,7 @@
 // the same bytes size as "double"
 #if !defined(__arm__) && !defined(__arm64__) && !defined(__aarch64__) &&       \
     !defined(_MSC_VER) && !defined(__mips__) && !defined(__powerpc__) &&       \
-    !defined(__ANDROID_NDK__)
+    !defined(ANDROID)
     case sizeof(long double):
       if (sizeof(long double) == sizeof(uint32_t)) {
         value.SetUInt32(reg_value, RegisterValue::eTypeLongDouble);
Index: source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
===================================================================
--- source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
+++ source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
@@ -9,7 +9,7 @@
 
 #include "ObjectContainerBSDArchive.h"
 
-#if defined(_WIN32) || defined(__ANDROID_NDK__)
+#if defined(_WIN32) || defined(ANDROID)
 // Defines from ar, missing on Windows
 #define ARMAG "!<arch>\n"
 #define SARMAG 8
Index: source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
===================================================================
--- source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
+++ source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp
@@ -28,7 +28,7 @@
 
 #include <algorithm>
 
-#if __ANDROID_NDK__
+#if ANDROID
 #include <sys/types.h>
 #endif
 
Index: source/Host/posix/HostInfoPosix.cpp
===================================================================
--- source/Host/posix/HostInfoPosix.cpp
+++ source/Host/posix/HostInfoPosix.cpp
@@ -48,7 +48,7 @@
   return false;
 }
 
-#ifdef __ANDROID_NDK__
+#ifdef ANDROID
 #include <android/api-level.h>
 #endif
 #if defined(__ANDROID_API__) && __ANDROID_API__ < 21
Index: source/Host/linux/ProcessLauncherLinux.cpp
===================================================================
--- source/Host/linux/ProcessLauncherLinux.cpp
+++ source/Host/linux/ProcessLauncherLinux.cpp
@@ -26,7 +26,7 @@
 using namespace lldb_private;
 
 static void FixupEnvironment(Args &env) {
-#ifdef __ANDROID_NDK__
+#ifdef ANDROID
   // If there is no PATH variable specified inside the environment then set the
   // path to /system/bin. It is required because the default path used by
   // execve() is wrong on android.
Index: source/Host/common/Socket.cpp
===================================================================
--- source/Host/common/Socket.cpp
+++ source/Host/common/Socket.cpp
@@ -33,7 +33,7 @@
 #include "lldb/Host/linux/AbstractSocket.h"
 #endif
 
-#ifdef __ANDROID_NDK__
+#ifdef ANDROID
 #include <arpa/inet.h>
 #include <asm-generic/errno-base.h>
 #include <bits/error_constants.h>
@@ -44,7 +44,7 @@
 #include <sys/syscall.h>
 #include <unistd.h>
 #endif // ANDROID_ARM_BUILD_STATIC || ANDROID_MIPS_BUILD_STATIC
-#endif // __ANDROID_NDK__
+#endif // ANDROID
 
 using namespace lldb;
 using namespace lldb_private;
Index: source/Host/common/Host.cpp
===================================================================
--- source/Host/common/Host.cpp
+++ source/Host/common/Host.cpp
@@ -29,7 +29,7 @@
 
 #if defined(__linux__) || defined(__FreeBSD__) ||                              \
     defined(__FreeBSD_kernel__) || defined(__APPLE__) || defined(__NetBSD__)
-#if !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
+#if !defined(ANDROID)
 #include <spawn.h>
 #endif
 #include <sys/syscall.h>
@@ -320,7 +320,7 @@
   return thread_self;
 #elif defined(__FreeBSD__)
   return lldb::tid_t(pthread_getthreadid_np());
-#elif defined(__ANDROID_NDK__)
+#elif defined(ANDROID)
   return lldb::tid_t(gettid());
 #elif defined(__linux__)
   return lldb::tid_t(syscall(SYS_gettid));
@@ -454,7 +454,7 @@
 
 FileSpec Host::GetModuleFileSpecForHostAddress(const void *host_addr) {
   FileSpec module_filespec;
-#if !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
+#if !defined(ANDROID)
   Dl_info info;
   if (::dladdr(host_addr, &info)) {
     if (info.dli_fname)
@@ -622,7 +622,7 @@
 
 #if defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) ||        \
     defined(__GLIBC__) || defined(__NetBSD__)
-#if !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
+#if !defined(ANDROID)
 // this method needs to be visible to macosx/Host.cpp and
 // common/Host.cpp.
 
@@ -956,7 +956,7 @@
   }
   return error.Success();
 }
-#endif // !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
+#endif // !defined(ANDROID)
 #endif // defined (__APPLE__) || defined (__linux__) || defined (__FreeBSD__) ||
        // defined (__GLIBC__) || defined(__NetBSD__)
 
Index: include/lldb/Host/posix/Fcntl.h
===================================================================
--- include/lldb/Host/posix/Fcntl.h
+++ include/lldb/Host/posix/Fcntl.h
@@ -12,7 +12,7 @@
 #ifndef liblldb_Host_posix_Fcntl_h_
 #define liblldb_Host_posix_Fcntl_h_
 
-#ifdef __ANDROID_NDK__
+#ifdef ANDROID
 #include <android/api-level.h>
 #endif
 
Index: include/lldb/Host/linux/Personality.h
===================================================================
--- include/lldb/Host/linux/Personality.h
+++ include/lldb/Host/linux/Personality.h
@@ -12,7 +12,7 @@
 #ifndef liblldb_Host_linux_Personality_h_
 #define liblldb_Host_linux_Personality_h_
 
-#ifdef __ANDROID_NDK__
+#ifdef ANDROID
 #include <android/api-level.h>
 #endif
 
Index: include/lldb/Host/Time.h
===================================================================
--- include/lldb/Host/Time.h
+++ include/lldb/Host/Time.h
@@ -12,7 +12,7 @@
 #ifndef liblldb_Host_Time_h_
 #define liblldb_Host_Time_h_
 
-#ifdef __ANDROID_NDK__
+#ifdef ANDROID
 #include <android/api-level.h>
 #endif
 
Index: include/lldb/Host/HostInfo.h
===================================================================
--- include/lldb/Host/HostInfo.h
+++ include/lldb/Host/HostInfo.h
@@ -38,7 +38,7 @@
 #include "lldb/Host/windows/HostInfoWindows.h"
 #define HOST_INFO_TYPE HostInfoWindows
 #elif defined(__linux__)
-#if defined(__ANDROID_NDK__)
+#if defined(ANDROID)
 #include "lldb/Host/android/HostInfoAndroid.h"
 #define HOST_INFO_TYPE HostInfoAndroid
 #else
Index: include/lldb/Host/Host.h
===================================================================
--- include/lldb/Host/Host.h
+++ include/lldb/Host/Host.h
@@ -211,7 +211,7 @@
 
 #if defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) ||        \
     defined(__GLIBC__) || defined(__NetBSD__)
-#if !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
+#if !defined(ANDROID)
 
   static short GetPosixspawnFlags(const ProcessLaunchInfo &launch_info);
 
@@ -223,7 +223,7 @@
                                       const FileAction *info, Log *log,
                                       Error &error);
 
-#endif // !defined(__ANDROID__) && !defined(__ANDROID_NDK__)
+#endif // !defined(ANDROID)
 #endif // defined (__APPLE__) || defined (__linux__) || defined (__FreeBSD__) ||
        // defined (__GLIBC__) || defined(__NetBSD__)
 
Index: include/lldb/Host/Editline.h
===================================================================
--- include/lldb/Host/Editline.h
+++ include/lldb/Host/Editline.h
@@ -56,7 +56,7 @@
 #if defined(_WIN32)
 #include "lldb/Host/windows/editlinewin.h"
 #else
-#if !defined(__ANDROID_NDK__)
+#if !defined(ANDROID)
 #include <histedit.h>
 #endif
 #endif
Index: include/lldb/Host/Config.h
===================================================================
--- include/lldb/Host/Config.h
+++ include/lldb/Host/Config.h
@@ -14,7 +14,7 @@
 
 #include "lldb/Host/macosx/Config.h"
 
-#elif defined(__ANDROID_NDK__)
+#elif defined(ANDROID)
 
 #include "lldb/Host/android/Config.h"
 
Index: include/lldb/Core/RegularExpression.h
===================================================================
--- include/lldb/Core/RegularExpression.h
+++ include/lldb/Core/RegularExpression.h
@@ -31,7 +31,7 @@
 
 inline void regfree(llvm_regex_t *a) { llvm_regfree(a); }
 #else
-#if __ANDROID_NDK__
+#if ANDROID
 #include <regex>
 #endif
 #include <regex.h>
Index: cmake/platforms/Android.cmake
===================================================================
--- cmake/platforms/Android.cmake
+++ cmake/platforms/Android.cmake
@@ -34,7 +34,7 @@
 
 # flags and definitions
 remove_definitions( -DANDROID -D__ANDROID__ )
-add_definitions( -DANDROID -D__ANDROID_NDK__ -DLLDB_DISABLE_LIBEDIT )
+add_definitions( -DANDROID -DLLDB_DISABLE_LIBEDIT )
 set( ANDROID True )
 set( __ANDROID_NDK__ True )
 set( LLDB_DEFAULT_DISABLE_LIBEDIT True )
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to