Author: labath Date: Fri Dec 2 05:15:15 2016 New Revision: 288494 URL: http://llvm.org/viewvc/llvm-project?rev=288494&view=rev Log: Replace __ANDROID_NDK__ with __ANDROID__
Summary: 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, which does not provide this define. Instead I rely, on __ANDROID__, which is set by the compiler. 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. Reviewers: tberghammer, zturner Subscribers: danalbert, srhines, mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D27305 Modified: lldb/trunk/cmake/platforms/Android.cmake lldb/trunk/include/lldb/Core/RegularExpression.h lldb/trunk/include/lldb/Host/Config.h lldb/trunk/include/lldb/Host/Editline.h lldb/trunk/include/lldb/Host/Host.h lldb/trunk/include/lldb/Host/HostInfo.h lldb/trunk/include/lldb/Host/Time.h lldb/trunk/include/lldb/Host/linux/Personality.h lldb/trunk/include/lldb/Host/posix/Fcntl.h lldb/trunk/source/Host/common/Host.cpp lldb/trunk/source/Host/common/Socket.cpp lldb/trunk/source/Host/linux/ProcessLauncherLinux.cpp lldb/trunk/source/Host/posix/HostInfoPosix.cpp lldb/trunk/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp lldb/trunk/source/Utility/PseudoTerminal.cpp lldb/trunk/tools/driver/Driver.cpp Modified: lldb/trunk/cmake/platforms/Android.cmake URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/platforms/Android.cmake?rev=288494&r1=288493&r2=288494&view=diff ============================================================================== --- lldb/trunk/cmake/platforms/Android.cmake (original) +++ lldb/trunk/cmake/platforms/Android.cmake Fri Dec 2 05:15:15 2016 @@ -33,8 +33,7 @@ set( CMAKE_SYSTEM_NAME Linux ) include( CMakeForceCompiler ) # 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 ) Modified: lldb/trunk/include/lldb/Core/RegularExpression.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/RegularExpression.h?rev=288494&r1=288493&r2=288494&view=diff ============================================================================== --- lldb/trunk/include/lldb/Core/RegularExpression.h (original) +++ lldb/trunk/include/lldb/Core/RegularExpression.h Fri Dec 2 05:15:15 2016 @@ -31,7 +31,7 @@ inline int regexec(const llvm_regex_t *a inline void regfree(llvm_regex_t *a) { llvm_regfree(a); } #else -#if __ANDROID_NDK__ +#ifdef __ANDROID__ #include <regex> #endif #include <regex.h> Modified: lldb/trunk/include/lldb/Host/Config.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Config.h?rev=288494&r1=288493&r2=288494&view=diff ============================================================================== --- lldb/trunk/include/lldb/Host/Config.h (original) +++ lldb/trunk/include/lldb/Host/Config.h Fri Dec 2 05:15:15 2016 @@ -14,7 +14,7 @@ #include "lldb/Host/macosx/Config.h" -#elif defined(__ANDROID_NDK__) +#elif defined(__ANDROID__) #include "lldb/Host/android/Config.h" Modified: lldb/trunk/include/lldb/Host/Editline.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Editline.h?rev=288494&r1=288493&r2=288494&view=diff ============================================================================== --- lldb/trunk/include/lldb/Host/Editline.h (original) +++ lldb/trunk/include/lldb/Host/Editline.h Fri Dec 2 05:15:15 2016 @@ -55,11 +55,9 @@ #if defined(_WIN32) #include "lldb/Host/windows/editlinewin.h" -#else -#if !defined(__ANDROID_NDK__) +#elif !defined(__ANDROID__) #include <histedit.h> #endif -#endif #include <mutex> #include <string> Modified: lldb/trunk/include/lldb/Host/Host.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Host.h?rev=288494&r1=288493&r2=288494&view=diff ============================================================================== --- lldb/trunk/include/lldb/Host/Host.h (original) +++ lldb/trunk/include/lldb/Host/Host.h Fri Dec 2 05:15:15 2016 @@ -209,9 +209,9 @@ public: static bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info); -#if defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) || \ - defined(__GLIBC__) || defined(__NetBSD__) -#if !defined(__ANDROID__) && !defined(__ANDROID_NDK__) +#if (defined(__APPLE__) || defined(__linux__) || defined(__FreeBSD__) || \ + defined(__GLIBC__) || defined(__NetBSD__)) && \ + !defined(__ANDROID__) static short GetPosixspawnFlags(const ProcessLaunchInfo &launch_info); @@ -223,9 +223,7 @@ public: const FileAction *info, Log *log, Error &error); -#endif // !defined(__ANDROID__) && !defined(__ANDROID_NDK__) -#endif // defined (__APPLE__) || defined (__linux__) || defined (__FreeBSD__) || - // defined (__GLIBC__) || defined(__NetBSD__) +#endif static const lldb::UnixSignalsSP &GetUnixSignals(); Modified: lldb/trunk/include/lldb/Host/HostInfo.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/HostInfo.h?rev=288494&r1=288493&r2=288494&view=diff ============================================================================== --- lldb/trunk/include/lldb/Host/HostInfo.h (original) +++ lldb/trunk/include/lldb/Host/HostInfo.h Fri Dec 2 05:15:15 2016 @@ -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 Modified: lldb/trunk/include/lldb/Host/Time.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/Time.h?rev=288494&r1=288493&r2=288494&view=diff ============================================================================== --- lldb/trunk/include/lldb/Host/Time.h (original) +++ lldb/trunk/include/lldb/Host/Time.h Fri Dec 2 05:15:15 2016 @@ -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 Modified: lldb/trunk/include/lldb/Host/linux/Personality.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/linux/Personality.h?rev=288494&r1=288493&r2=288494&view=diff ============================================================================== --- lldb/trunk/include/lldb/Host/linux/Personality.h (original) +++ lldb/trunk/include/lldb/Host/linux/Personality.h Fri Dec 2 05:15:15 2016 @@ -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 Modified: lldb/trunk/include/lldb/Host/posix/Fcntl.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/posix/Fcntl.h?rev=288494&r1=288493&r2=288494&view=diff ============================================================================== --- lldb/trunk/include/lldb/Host/posix/Fcntl.h (original) +++ lldb/trunk/include/lldb/Host/posix/Fcntl.h Fri Dec 2 05:15:15 2016 @@ -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 Modified: lldb/trunk/source/Host/common/Host.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Host.cpp?rev=288494&r1=288493&r2=288494&view=diff ============================================================================== --- lldb/trunk/source/Host/common/Host.cpp (original) +++ lldb/trunk/source/Host/common/Host.cpp Fri Dec 2 05:15:15 2016 @@ -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 @@ lldb::tid_t Host::GetCurrentThreadID() { 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 @@ bool Host::ResolveExecutableInBundle(Fil 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 @@ Error Host::RunShellCommand(const Args & #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 @@ bool Host::AddPosixSpawnFileAction(void } return error.Success(); } -#endif // !defined(__ANDROID__) && !defined(__ANDROID_NDK__) +#endif // !defined(__ANDROID__) #endif // defined (__APPLE__) || defined (__linux__) || defined (__FreeBSD__) || // defined (__GLIBC__) || defined(__NetBSD__) Modified: lldb/trunk/source/Host/common/Socket.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/Socket.cpp?rev=288494&r1=288493&r2=288494&view=diff ============================================================================== --- lldb/trunk/source/Host/common/Socket.cpp (original) +++ lldb/trunk/source/Host/common/Socket.cpp Fri Dec 2 05:15:15 2016 @@ -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; Modified: lldb/trunk/source/Host/linux/ProcessLauncherLinux.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/ProcessLauncherLinux.cpp?rev=288494&r1=288493&r2=288494&view=diff ============================================================================== --- lldb/trunk/source/Host/linux/ProcessLauncherLinux.cpp (original) +++ lldb/trunk/source/Host/linux/ProcessLauncherLinux.cpp Fri Dec 2 05:15:15 2016 @@ -26,7 +26,7 @@ using namespace lldb; 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. Modified: lldb/trunk/source/Host/posix/HostInfoPosix.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/posix/HostInfoPosix.cpp?rev=288494&r1=288493&r2=288494&view=diff ============================================================================== --- lldb/trunk/source/Host/posix/HostInfoPosix.cpp (original) +++ lldb/trunk/source/Host/posix/HostInfoPosix.cpp Fri Dec 2 05:15:15 2016 @@ -48,7 +48,7 @@ bool HostInfoPosix::GetHostname(std::str return false; } -#ifdef __ANDROID_NDK__ +#ifdef __ANDROID__ #include <android/api-level.h> #endif #if defined(__ANDROID_API__) && __ANDROID_API__ < 21 Modified: lldb/trunk/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp?rev=288494&r1=288493&r2=288494&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp (original) +++ lldb/trunk/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp Fri Dec 2 05:15:15 2016 @@ -20,6 +20,7 @@ #include "lldb/DataFormatters/StringPrinter.h" #include "lldb/DataFormatters/TypeSummary.h" #include "lldb/Host/Endian.h" +#include "lldb/Host/Time.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" @@ -28,12 +29,6 @@ #include <algorithm> -#if __ANDROID_NDK__ -#include <sys/types.h> -#endif - -#include "lldb/Host/Time.h" - using namespace lldb; using namespace lldb_private; using namespace lldb_private::formatters; Modified: lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp?rev=288494&r1=288493&r2=288494&view=diff ============================================================================== --- lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp (original) +++ lldb/trunk/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp Fri Dec 2 05:15:15 2016 @@ -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 Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp?rev=288494&r1=288493&r2=288494&view=diff ============================================================================== --- lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp (original) +++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextMacOSXFrameBackchain.cpp Fri Dec 2 05:15:15 2016 @@ -120,7 +120,7 @@ bool RegisterContextMacOSXFrameBackchain // 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); Modified: lldb/trunk/source/Utility/PseudoTerminal.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/PseudoTerminal.cpp?rev=288494&r1=288493&r2=288494&view=diff ============================================================================== --- lldb/trunk/source/Utility/PseudoTerminal.cpp (original) +++ lldb/trunk/source/Utility/PseudoTerminal.cpp Fri Dec 2 05:15:15 2016 @@ -20,7 +20,7 @@ #include "lldb/Host/PosixApi.h" -#if defined(__ANDROID_NDK__) +#if defined(__ANDROID__) int posix_openpt(int flags); #endif Modified: lldb/trunk/tools/driver/Driver.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=288494&r1=288493&r2=288494&view=diff ============================================================================== --- lldb/trunk/tools/driver/Driver.cpp (original) +++ lldb/trunk/tools/driver/Driver.cpp Fri Dec 2 05:15:15 2016 @@ -19,8 +19,6 @@ #if defined(_WIN32) #include <fcntl.h> #include <io.h> -#elif defined(__ANDROID_NDK__) -#include <errno.h> #else #include <unistd.h> #endif _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits