From 9ba3fa0ba37c3b11b7129c3092a379711fd128e4 Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Tue, 15 Aug 2017 11:16:48 -0400 Subject: [PATCH] [runtime] Use HOST_ defines instead of PLATFORM_ defines. (#5362) --- configure.ac | 30 ++++++++++++---------- libgc/include/private/gcconfig.h | 4 +-- libgc/include/private/pthread_support.h | 2 +- libgc/pthread_stop_world.c | 6 ++--- libgc/pthread_support.c | 2 +- mono/dis/Makefile.am | 2 +- mono/eglib/Makefile.am | 2 +- mono/eglib/goutput.c | 2 +- mono/metadata/Makefile.am | 2 +- mono/metadata/assembly.c | 4 +-- mono/metadata/boehm-gc.c | 4 +-- mono/metadata/icall-def.h | 2 +- mono/metadata/loader.c | 2 +- mono/metadata/metadata-cross-helpers.c | 6 ++--- mono/metadata/mono-route.c | 6 ++--- mono/metadata/mono-route.h | 4 +-- mono/metadata/threadpool-worker-default.c | 2 +- mono/metadata/threads.c | 4 +-- mono/metadata/w32file-unix.c | 14 +++++----- mono/metadata/w32process-unix-default.c | 4 +-- mono/metadata/w32process-unix-internals.h | 2 +- mono/metadata/w32process-unix.c | 4 +-- mono/metadata/w32socket-unix.c | 2 +- mono/mini/Makefile.am.in | 8 +++--- mono/mini/aot-runtime.c | 2 +- mono/mini/debugger-agent.c | 6 ++--- mono/mini/debugger-agent.h | 2 +- mono/mini/exceptions-arm.c | 4 +-- mono/mini/mini-arm.c | 2 +- mono/mini/mini-exceptions.c | 12 ++++----- mono/mini/mini-generic-sharing.c | 2 +- mono/mini/mini-posix.c | 18 ++++++------- mono/mini/mini-runtime.c | 2 +- mono/mini/mini.c | 2 +- mono/mini/mini.h | 2 +- mono/mini/trace.c | 2 +- mono/profiler/Makefile.am | 4 +-- mono/sgen/sgen-marksweep.c | 2 +- mono/tests/Makefile.am | 4 +-- mono/unit-tests/Makefile.am | 2 +- mono/utils/mono-compiler.h | 2 +- mono/utils/mono-dl-posix.c | 2 +- mono/utils/mono-hwcap-arm.c | 4 +-- mono/utils/mono-log-android.c | 2 +- mono/utils/mono-logger-internals.h | 4 +-- mono/utils/mono-logger.c | 2 +- mono/utils/mono-os-mutex.h | 2 +- mono/utils/mono-path.c | 4 +-- mono/utils/mono-proclib.c | 6 ++--- mono/utils/mono-sigcontext.h | 6 ++--- mono/utils/mono-threads-android.c | 2 +- mono/utils/mono-threads-linux.c | 2 +- mono/utils/mono-threads-posix-signals.c | 8 +++--- mono/utils/mono-threads-posix.c | 4 +-- mono/utils/mono-threads.c | 2 +- mono/utils/mono-time.c | 4 +-- support/errno.c | 2 +- support/mph.h | 4 +-- support/sys-mman.c | 2 +- support/sys-sendfile.c | 2 +- support/unistd.c | 2 +- tools/monograph/Makefile.am | 2 +- tools/offsets-tool/MonoAotOffsetsDumper.cs | 6 ++--- tools/pedump/Makefile.am | 2 +- winconfig.h | 2 +- 65 files changed, 136 insertions(+), 132 deletions(-) diff --git a/configure.ac b/configure.ac index 0abf9ebb469..aa0111de8ae 100644 --- a/configure.ac +++ b/configure.ac @@ -110,7 +110,7 @@ host_darwin=no case "$host" in *-mingw*|*-*-cygwin*) AC_DEFINE(DISABLE_PORTABILITY,1,[Disable the io-portability layer]) - AC_DEFINE(PLATFORM_NO_SYMLINKS,1,[This platform does not support symlinks]) + AC_DEFINE(HOST_NO_SYMLINKS,1,[This platform does not support symlinks]) host_win32=yes mono_cv_clang=no if test "x$cross_compiling" = "xno"; then @@ -141,7 +141,7 @@ case "$host" in CPPFLAGS="$CPPFLAGS -D_REENTRANT -DGC_NETBSD_THREADS -D_GNU_SOURCE" libmono_cflags="-D_REENTRANT" LDFLAGS="$LDFLAGS -pthread" - CPPFLAGS="$CPPFLAGS -DPLATFORM_BSD" + CPPFLAGS="$CPPFLAGS -DHOST_BSD" libmono_ldflags="-pthread" need_link_unlink=yes libdl="-ldl" @@ -176,7 +176,7 @@ case "$host" in LDFLAGS="$LDFLAGS $PTHREAD_LIBS -L/usr/local/lib" libmono_ldflags="$PTHREAD_LIBS" fi - CPPFLAGS="$CPPFLAGS -DPLATFORM_BSD" + CPPFLAGS="$CPPFLAGS -DHOST_BSD" need_link_unlink=yes AC_DEFINE(PTHREAD_POINTER_ID, 1, [pthread is a pointer]) libdl= @@ -186,7 +186,7 @@ case "$host" in with_sgen_default_concurrent=yes ;; *-*-*openbsd*) - CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_OPENBSD_THREADS -DPLATFORM_BSD -D_REENTRANT -DUSE_MMAP" + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_OPENBSD_THREADS -DHOST_BSD -D_REENTRANT -DUSE_MMAP" if test "x$disable_munmap" != "xyes"; then CPPFLAGS="$CPPFLAGS -DUSE_MUNMAP" fi @@ -202,7 +202,7 @@ case "$host" in ;; *-*-linux-android*) platform_android=yes - AC_DEFINE(PLATFORM_ANDROID,1,[Targeting the Android platform]) + AC_DEFINE(HOST_ANDROID,1,[Targeting the Android platform]) AC_DEFINE(TARGET_ANDROID,1,[Targeting the Android platform]) CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP" @@ -284,7 +284,7 @@ case "$host" in use_sigposix=yes ;; *-*-solaris*) - CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_MMAP -DUSE_MUNMAP -DPLATFORM_SOLARIS" + CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_MMAP -DUSE_MUNMAP -DHOST_SOLARIS" need_link_unlink=yes libmono_cflags="-D_REENTRANT" libgc_threads=pthreads @@ -296,7 +296,7 @@ case "$host" in parallel_mark="Disabled_Currently_Hangs_On_MacOSX" host_darwin=yes target_mach=yes - CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_MACOSX_THREADS -DPLATFORM_MACOSX -DUSE_MMAP -DUSE_MUNMAP" + CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_MACOSX_THREADS -DUSE_MMAP -DUSE_MUNMAP" libmono_cflags="-D_THREAD_SAFE" need_link_unlink=yes AC_DEFINE(PTHREAD_POINTER_ID) @@ -364,6 +364,10 @@ if test x$target_win32 = xyes; then AC_DEFINE(TARGET_WIN32, 1, [Target Platform is Win32]) fi +if test x$host_darwin = xyes; then + AC_DEFINE(HOST_DARWIN, 1, [Host Platform is Darwin]) +fi + # Defined for all targets/platforms using classic Windows API support. AC_DEFINE(HAVE_CLASSIC_WINAPI_SUPPORT, 1, [Use classic Windows API support]) AC_DEFINE(HAVE_UWP_WINAPI_SUPPORT, 0, [Don't use UWP Windows API support]) @@ -371,16 +375,16 @@ AC_DEFINE(HAVE_UWP_WINAPI_SUPPORT, 0, [Don't use UWP Windows API support]) AC_SUBST(extra_runtime_ldflags) AM_CONDITIONAL(HOST_WIN32, test x$host_win32 = xyes) AM_CONDITIONAL(TARGET_WIN32, test x$target_win32 = xyes) -AM_CONDITIONAL(PLATFORM_LINUX, echo x$target_os | grep -q linux) -AM_CONDITIONAL(PLATFORM_DARWIN, test x$host_darwin = xyes) -AM_CONDITIONAL(PLATFORM_SIGPOSIX, test x$use_sigposix = xyes) -AM_CONDITIONAL(PLATFORM_ANDROID, test x$platform_android = xyes) +AM_CONDITIONAL(HOST_LINUX, echo x$target_os | grep -q linux) +AM_CONDITIONAL(HOST_DARWIN, test x$host_darwin = xyes) +AM_CONDITIONAL(HOST_SIGPOSIX, test x$use_sigposix = xyes) +AM_CONDITIONAL(HOST_ANDROID, test x$platform_android = xyes) -if test -z "$PLATFORM_DARWIN_TRUE"; then : +if test -z "$HOST_DARWIN_TRUE"; then : PLATFORM_AOT_SUFFIX=.dylib fi -if test -z "$PLATFORM_LINUX_TRUE"; then : +if test -z "$HOST_LINUX_TRUE"; then : PLATFORM_AOT_SUFFIX=.so fi diff --git a/libgc/include/private/gcconfig.h b/libgc/include/private/gcconfig.h index 3cbab919b94..03305b61de0 100644 --- a/libgc/include/private/gcconfig.h +++ b/libgc/include/private/gcconfig.h @@ -733,7 +733,7 @@ # if defined(__GLIBC__)&& __GLIBC__>=2 # define SEARCH_FOR_DATA_START # else /* !GLIBC2 */ -# if defined(PLATFORM_ANDROID) +# if defined(HOST_ANDROID) # define __environ environ # endif extern char **__environ; @@ -1965,7 +1965,7 @@ # include # if defined(__GLIBC__) && __GLIBC__ >= 2 # define SEARCH_FOR_DATA_START -# elif defined(PLATFORM_ANDROID) +# elif defined(HOST_ANDROID) # define SEARCH_FOR_DATA_START # else extern char **__environ; diff --git a/libgc/include/private/pthread_support.h b/libgc/include/private/pthread_support.h index bcb89b6a198..0abbd242a85 100644 --- a/libgc/include/private/pthread_support.h +++ b/libgc/include/private/pthread_support.h @@ -45,7 +45,7 @@ typedef struct GC_Thread_Rep { /* guaranteed to be dead, but we may */ /* not yet have registered the join.) */ pthread_t id; -#ifdef PLATFORM_ANDROID +#ifdef HOST_ANDROID pid_t kernel_id; #endif /* Extra bookkeeping information the stopping code uses */ diff --git a/libgc/pthread_stop_world.c b/libgc/pthread_stop_world.c index 3bfdfbf35ed..afa77dadfab 100644 --- a/libgc/pthread_stop_world.c +++ b/libgc/pthread_stop_world.c @@ -337,7 +337,7 @@ void GC_push_all_stacks() pthread_t GC_stopping_thread; int GC_stopping_pid; -#ifdef PLATFORM_ANDROID +#ifdef HOST_ANDROID static int android_thread_kill(pid_t tid, int sig) { @@ -379,7 +379,7 @@ int GC_suspend_all() GC_printf1("Sending suspend signal to 0x%lx\n", p -> id); #endif -#ifndef PLATFORM_ANDROID +#ifndef HOST_ANDROID result = pthread_kill(p -> id, SIG_SUSPEND); #else result = android_thread_kill(p -> kernel_id, SIG_SUSPEND); @@ -658,7 +658,7 @@ static void pthread_start_world() GC_printf1("Sending restart signal to 0x%lx\n", p -> id); #endif -#ifndef PLATFORM_ANDROID +#ifndef HOST_ANDROID result = pthread_kill(p -> id, SIG_THR_RESTART); #else result = android_thread_kill(p -> kernel_id, SIG_THR_RESTART); diff --git a/libgc/pthread_support.c b/libgc/pthread_support.c index cdca3325275..097d588a7b5 100644 --- a/libgc/pthread_support.c +++ b/libgc/pthread_support.c @@ -764,7 +764,7 @@ GC_thread GC_new_thread(pthread_t id) } if (result == 0) return(0); result -> id = id; -#ifdef PLATFORM_ANDROID +#ifdef HOST_ANDROID result -> kernel_id = gettid(); #endif result -> next = GC_threads[hv]; diff --git a/mono/dis/Makefile.am b/mono/dis/Makefile.am index 06085362c54..f1e79e31787 100644 --- a/mono/dis/Makefile.am +++ b/mono/dis/Makefile.am @@ -54,7 +54,7 @@ monodis_LDADD = \ $(GLIB_LIBS) \ $(LIBICONV) -if PLATFORM_DARWIN +if HOST_DARWIN monodis_LDFLAGS=-framework CoreFoundation -framework Foundation endif diff --git a/mono/eglib/Makefile.am b/mono/eglib/Makefile.am index 08cf40a763d..87051a6be13 100644 --- a/mono/eglib/Makefile.am +++ b/mono/eglib/Makefile.am @@ -55,7 +55,7 @@ AM_CPPFLAGS = -I$(srcdir) if HOST_WIN32 libeglib_la_LIBADD = -lm $(LIBICONV) -lpsapi else -if PLATFORM_ANDROID +if HOST_ANDROID libeglib_la_LIBADD = -llog endif endif diff --git a/mono/eglib/goutput.c b/mono/eglib/goutput.c index 7b1627c0cd2..e785170621c 100644 --- a/mono/eglib/goutput.c +++ b/mono/eglib/goutput.c @@ -137,7 +137,7 @@ g_assertion_message (const gchar *format, ...) exit (0); } -#if PLATFORM_ANDROID +#if HOST_ANDROID #include static android_LogPriority diff --git a/mono/metadata/Makefile.am b/mono/metadata/Makefile.am index 95867a3e4ca..2fbf826ceec 100644 --- a/mono/metadata/Makefile.am +++ b/mono/metadata/Makefile.am @@ -59,7 +59,7 @@ unix_sources = \ platform_sources = $(unix_sources) endif -if PLATFORM_ANDROID +if HOST_ANDROID platform_sources += ../../support/libm/complex.c endif diff --git a/mono/metadata/assembly.c b/mono/metadata/assembly.c index 35896715ac6..adfab7def01 100644 --- a/mono/metadata/assembly.c +++ b/mono/metadata/assembly.c @@ -50,7 +50,7 @@ #include #endif -#ifdef PLATFORM_MACOSX +#ifdef HOST_DARWIN #include #endif @@ -840,7 +840,7 @@ set_dirs (char *exe) void mono_set_rootdir (void) { -#if defined(HOST_WIN32) || (defined(PLATFORM_MACOSX) && !defined(TARGET_ARM)) +#if defined(HOST_WIN32) || (defined(HOST_DARWIN) && !defined(TARGET_ARM)) gchar *bindir, *installdir, *root, *name, *resolvedname, *config; #ifdef HOST_WIN32 diff --git a/mono/metadata/boehm-gc.c b/mono/metadata/boehm-gc.c index e642be65561..03d5147c782 100644 --- a/mono/metadata/boehm-gc.c +++ b/mono/metadata/boehm-gc.c @@ -44,7 +44,7 @@ #define THREAD_LOCAL_ALLOC 1 #include "private/pthread_support.h" -#if defined(PLATFORM_MACOSX) && defined(HAVE_PTHREAD_GET_STACKADDR_NP) +#if defined(HOST_DARWIN) && defined(HAVE_PTHREAD_GET_STACKADDR_NP) void *pthread_get_stackaddr_np(pthread_t); #endif @@ -179,7 +179,7 @@ mono_gc_base_init (void) default_push_other_roots = GC_push_other_roots; GC_push_other_roots = mono_push_other_roots; -#if !defined(PLATFORM_ANDROID) +#if !defined(HOST_ANDROID) /* If GC_no_dls is set to true, GC_find_limit is not called. This causes a seg fault on Android. */ GC_no_dls = TRUE; #endif diff --git a/mono/metadata/icall-def.h b/mono/metadata/icall-def.h index 2cc591e8c8c..ecd050a26e0 100644 --- a/mono/metadata/icall-def.h +++ b/mono/metadata/icall-def.h @@ -447,7 +447,7 @@ HANDLES(ICALL(NDNS_1, "GetHostByAddr_internal(string,string&,string[]&,string[]& HANDLES(ICALL(NDNS_2, "GetHostByName_internal(string,string&,string[]&,string[]&,int)", ves_icall_System_Net_Dns_GetHostByName_internal)) HANDLES(ICALL(NDNS_3, "GetHostName_internal(string&)", ves_icall_System_Net_Dns_GetHostName_internal)) -#if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD) +#if defined(HOST_DARWIN) || defined(HOST_BSD) ICALL_TYPE(MAC_IFACE_PROPS, "System.Net.NetworkInformation.MacOsIPInterfaceProperties", MAC_IFACE_PROPS_1) ICALL(MAC_IFACE_PROPS_1, "ParseRouteInfo_internal", ves_icall_System_Net_NetworkInformation_MacOsIPInterfaceProperties_ParseRouteInfo_internal) #endif diff --git a/mono/metadata/loader.c b/mono/metadata/loader.c index 61a6f941465..bf35693b83b 100644 --- a/mono/metadata/loader.c +++ b/mono/metadata/loader.c @@ -1143,7 +1143,7 @@ static MonoDl *internal_module; static gboolean is_absolute_path (const char *path) { -#ifdef PLATFORM_MACOSX +#ifdef HOST_DARWIN if (!strncmp (path, "@executable_path/", 17) || !strncmp (path, "@loader_path/", 13) || !strncmp (path, "@rpath/", 7)) return TRUE; diff --git a/mono/metadata/metadata-cross-helpers.c b/mono/metadata/metadata-cross-helpers.c index 119da77be3d..c4c81eaf32c 100644 --- a/mono/metadata/metadata-cross-helpers.c +++ b/mono/metadata/metadata-cross-helpers.c @@ -36,11 +36,11 @@ dump_arch (void) static int dump_os (void) { -#if defined (PLATFORM_WIN32) +#if defined (HOST_WIN32) g_print ("#ifdef TARGET_WIN32\n"); -#elif defined (PLATFORM_ANDROID) +#elif defined (HOST_ANDROID) g_print ("#ifdef TARGET_ANDROID\n"); -#elif defined (PLATFORM_MACOSX) +#elif defined (HOST_DARWIN) g_print ("#ifdef TARGET_OSX\n"); #elif defined (PLATFORM_IOS) g_print ("#ifdef TARGET_IOS\n"); diff --git a/mono/metadata/mono-route.c b/mono/metadata/mono-route.c index a35bd562743..c90af3cdfe3 100644 --- a/mono/metadata/mono-route.c +++ b/mono/metadata/mono-route.c @@ -7,9 +7,9 @@ * Ben Woods (woodsb02@gmail.com) */ -#if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD) - #include + +#if defined(HOST_DARWIN) || defined(HOST_BSD) #include #include #include @@ -134,4 +134,4 @@ in_addr_t gateway_from_rtm(struct rt_msghdr *rtm) return 0; } -#endif /* #if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD) */ +#endif /* #if defined(HOST_DARWIN) || defined(HOST_BSD) */ diff --git a/mono/metadata/mono-route.h b/mono/metadata/mono-route.h index 5086fbd3ef0..03d179d71c6 100644 --- a/mono/metadata/mono-route.h +++ b/mono/metadata/mono-route.h @@ -5,7 +5,7 @@ #ifndef __MONO_ROUTE_H__ #define __MONO_ROUTE_H__ -#if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD) +#if defined(HOST_DARWIN) || defined(HOST_BSD) #include @@ -23,5 +23,5 @@ in_addr_t gateway_from_rtm (struct rt_msghdr *rtm); /* Category icalls */ extern MonoBoolean ves_icall_System_Net_NetworkInformation_MacOsIPInterfaceProperties_ParseRouteInfo_internal (MonoString *iface, MonoArray **gw_addr_list); -#endif /* #if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD) */ +#endif /* #if defined(HOST_DARWIN) || defined(HOST_BSD) */ #endif /* __MONO_ROUTE_H__ */ diff --git a/mono/metadata/threadpool-worker-default.c b/mono/metadata/threadpool-worker-default.c index 87256b51187..724bfe81ff8 100644 --- a/mono/metadata/threadpool-worker-default.c +++ b/mono/metadata/threadpool-worker-default.c @@ -286,7 +286,7 @@ mono_threadpool_worker_init (MonoThreadPoolWorkerCallback callback) worker.limit_worker_min = threads_count; -#if defined (PLATFORM_ANDROID) || defined (HOST_IOS) +#if defined (HOST_ANDROID) || defined (HOST_IOS) worker.limit_worker_max = CLAMP (threads_count * 100, MIN (threads_count, 200), MAX (threads_count, 200)); #else worker.limit_worker_max = threads_count * 100; diff --git a/mono/metadata/threads.c b/mono/metadata/threads.c index 97efd32c1cd..120bd1a9458 100644 --- a/mono/metadata/threads.c +++ b/mono/metadata/threads.c @@ -62,11 +62,11 @@ #include #endif -#if defined(PLATFORM_ANDROID) && !defined(TARGET_ARM64) && !defined(TARGET_AMD64) +#if defined(HOST_ANDROID) && !defined(TARGET_ARM64) && !defined(TARGET_AMD64) #define USE_TKILL_ON_ANDROID 1 #endif -#ifdef PLATFORM_ANDROID +#ifdef HOST_ANDROID #include #ifdef USE_TKILL_ON_ANDROID diff --git a/mono/metadata/w32file-unix.c b/mono/metadata/w32file-unix.c index a3ac2264f6d..65547135b3b 100644 --- a/mono/metadata/w32file-unix.c +++ b/mono/metadata/w32file-unix.c @@ -1195,7 +1195,7 @@ static guint32 file_seek(FileHandle *filehandle, gint32 movedistance, mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: moving fd %d by %" G_GINT64_FORMAT " bytes from %d", __func__, ((MonoFDHandle*) filehandle)->fd, offset, whence); -#ifdef PLATFORM_ANDROID +#ifdef HOST_ANDROID /* bionic doesn't support -D_FILE_OFFSET_BITS=64 */ MONO_ENTER_GC_SAFE; newpos=lseek64(((MonoFDHandle*) filehandle)->fd, offset, whence); @@ -4245,7 +4245,7 @@ typedef struct { } _wapi_drive_type; static _wapi_drive_type _wapi_drive_types[] = { -#if PLATFORM_MACOSX +#if HOST_DARWIN { DRIVE_REMOTE, "afp" }, { DRIVE_REMOTE, "autofs" }, { DRIVE_CDROM, "cddafs" }, @@ -4402,7 +4402,7 @@ static guint32 _wapi_get_drive_type(const gchar* fstype) } #endif -#if defined (PLATFORM_MACOSX) || defined (__linux__) +#if defined (HOST_DARWIN) || defined (__linux__) static guint32 GetDriveTypeFromPath (const gchar *utf8_root_path_name) { @@ -4414,7 +4414,7 @@ GetDriveTypeFromPath (const gchar *utf8_root_path_name) MONO_EXIT_GC_SAFE; if (res == -1) return DRIVE_UNKNOWN; -#if PLATFORM_MACOSX +#if HOST_DARWIN return _wapi_get_drive_type (buf.f_fstypename); #else return _wapi_get_drive_type (buf.f_type); @@ -4507,11 +4507,11 @@ mono_w32file_get_drive_type(const gunichar2 *root_path_name) return (drive_type); } -#if defined (PLATFORM_MACOSX) || defined (__linux__) || defined(PLATFORM_BSD) || defined(__FreeBSD_kernel__) || defined(__HAIKU__) +#if defined (HOST_DARWIN) || defined (__linux__) || defined(HOST_BSD) || defined(__FreeBSD_kernel__) || defined(__HAIKU__) static gchar* get_fstypename (gchar *utfpath) { -#if defined (PLATFORM_MACOSX) || defined (__linux__) +#if defined (HOST_DARWIN) || defined (__linux__) struct statfs stat; #if __linux__ _wapi_drive_type *current; @@ -4522,7 +4522,7 @@ get_fstypename (gchar *utfpath) MONO_EXIT_GC_SAFE; if (statfs_res == -1) return NULL; -#if PLATFORM_MACOSX +#if HOST_DARWIN return g_strdup (stat.f_fstypename); #else current = &_wapi_drive_types[0]; diff --git a/mono/metadata/w32process-unix-default.c b/mono/metadata/w32process-unix-default.c index 3bc10906b8c..91e1d218ad5 100644 --- a/mono/metadata/w32process-unix-default.c +++ b/mono/metadata/w32process-unix-default.c @@ -9,7 +9,7 @@ #include -#ifdef PLATFORM_SOLARIS +#ifdef HOST_SOLARIS /* procfs.h cannot be included if this define is set, but it seems to work fine if it is undefined */ #if _FILE_OFFSET_BITS == 64 #undef _FILE_OFFSET_BITS @@ -41,7 +41,7 @@ mono_w32process_get_name (pid_t pid) gchar buf[256]; gchar *ret = NULL; -#if defined(PLATFORM_SOLARIS) +#if defined(HOST_SOLARIS) filename = g_strdup_printf ("/proc/%d/psinfo", pid); if ((fp = fopen (filename, "r")) != NULL) { struct psinfo info; diff --git a/mono/metadata/w32process-unix-internals.h b/mono/metadata/w32process-unix-internals.h index 5db6bd49446..ecab6c5ae12 100644 --- a/mono/metadata/w32process-unix-internals.h +++ b/mono/metadata/w32process-unix-internals.h @@ -12,7 +12,7 @@ * FOR EXCLUSIVE USE BY w32process-unix.c */ -#if defined(PLATFORM_MACOSX) +#if defined(HOST_DARWIN) #define USE_OSX_BACKEND #elif (defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(HAVE_LINK_H) #define USE_BSD_BACKEND diff --git a/mono/metadata/w32process-unix.c b/mono/metadata/w32process-unix.c index 280c3a9213d..8a55844b6e0 100644 --- a/mono/metadata/w32process-unix.c +++ b/mono/metadata/w32process-unix.c @@ -544,7 +544,7 @@ process_is_alive (pid_t pid) { #if defined(HOST_WATCHOS) return TRUE; // TODO: Rewrite using sysctl -#elif defined(PLATFORM_MACOSX) || defined(__OpenBSD__) || defined(__FreeBSD__) +#elif defined(HOST_DARWIN) || defined(__OpenBSD__) || defined(__FreeBSD__) if (pid == 0) return FALSE; if (kill (pid, 0) == 0) @@ -2105,7 +2105,7 @@ ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoW32ProcessStar goto done; } -#ifdef PLATFORM_MACOSX +#ifdef HOST_DARWIN handler = g_strdup ("/usr/bin/open"); #else /* diff --git a/mono/metadata/w32socket-unix.c b/mono/metadata/w32socket-unix.c index bc1b5ccd818..74e1fcceab5 100644 --- a/mono/metadata/w32socket-unix.c +++ b/mono/metadata/w32socket-unix.c @@ -1373,7 +1373,7 @@ mono_w32socket_get_available (SOCKET sock, guint64 *amount) return SOCKET_ERROR; } -#if defined (PLATFORM_MACOSX) +#if defined (HOST_DARWIN) // ioctl (socket, FIONREAD, XXX) returns the size of // the UDP header as well on Darwin. // diff --git a/mono/mini/Makefile.am.in b/mono/mini/Makefile.am.in index 848f75d3fe1..e33441b6d35 100755 --- a/mono/mini/Makefile.am.in +++ b/mono/mini/Makefile.am.in @@ -87,7 +87,7 @@ monobinldflags=$(export_ldflags) $(extra_runtime_ldflags) if HOST_WIN32 libmonoldflags=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags) else -if PLATFORM_ANDROID +if HOST_ANDROID libmonoldflags= -avoid-version $(monoldflags) else libmonoldflags=$(monoldflags) -version-info 1:0:0 @@ -168,7 +168,7 @@ if LOADED_LLVM lib_LTLIBRARIES += libmono-llvm.la libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp llvm-jit.cpp libmono_llvm_la_LIBADD = $(GLIB_LIBS) $(LLVM_LIBS) $(LLVM_LDFLAGS) -if PLATFORM_DARWIN +if HOST_DARWIN libmono_llvm_la_LDFLAGS=-Wl,-undefined -Wl,suppress -Wl,-flat_namespace else libmono_llvm_la_LIBADD += $(top_builddir)/mono/mini/libmonoboehm-$(API_VER).la $(boehm_libs) @@ -609,12 +609,12 @@ os_sources = $(windows_sources) monobin_platform_ldflags= endif -if PLATFORM_SIGPOSIX +if HOST_SIGPOSIX os_sources = $(posix_sources) monobin_platform_ldflags= endif -if PLATFORM_DARWIN +if HOST_DARWIN os_sources = $(darwin_sources) $(posix_sources) #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation -framework Foundation monobin_platform_ldflags=-framework CoreFoundation -framework Foundation diff --git a/mono/mini/aot-runtime.c b/mono/mini/aot-runtime.c index 01c2fe88393..d6c2486414f 100644 --- a/mono/mini/aot-runtime.c +++ b/mono/mini/aot-runtime.c @@ -5800,7 +5800,7 @@ mono_aot_is_pagefault (void *ptr) void mono_aot_handle_pagefault (void *ptr) { -#ifndef PLATFORM_WIN32 +#ifndef HOST_WIN32 guint8* start = (guint8*)ROUND_DOWN (((gssize)ptr), mono_pagesize ()); int res; diff --git a/mono/mini/debugger-agent.c b/mono/mini/debugger-agent.c index b625580c1fe..016423072bd 100644 --- a/mono/mini/debugger-agent.c +++ b/mono/mini/debugger-agent.c @@ -47,7 +47,7 @@ #include #endif -#ifdef PLATFORM_ANDROID +#ifdef HOST_ANDROID #include #include #include @@ -607,7 +607,7 @@ typedef struct ReplyPacket { #define DEBUG(level,s) do { if (G_UNLIKELY ((level) <= log_level)) { s; fflush (log_file); } } while (0) -#ifdef PLATFORM_ANDROID +#ifdef HOST_ANDROID #define DEBUG_PRINTF(level, ...) do { if (G_UNLIKELY ((level) <= log_level)) { g_print (__VA_ARGS__); } } while (0) #else #define DEBUG_PRINTF(level, ...) do { if (G_UNLIKELY ((level) <= log_level)) { fprintf (log_file, __VA_ARGS__); fflush (log_file); } } while (0) @@ -5941,7 +5941,7 @@ mono_debugger_agent_debug_log_is_enabled (void) return agent_config.enabled; } -#if defined(PLATFORM_ANDROID) || defined(TARGET_ANDROID) +#if defined(HOST_ANDROID) || defined(TARGET_ANDROID) void mono_debugger_agent_unhandled_exception (MonoException *exc) { diff --git a/mono/mini/debugger-agent.h b/mono/mini/debugger-agent.h index 41fe82ea98e..3267f82740e 100644 --- a/mono/mini/debugger-agent.h +++ b/mono/mini/debugger-agent.h @@ -28,7 +28,7 @@ debugger_agent_breakpoint_from_context (MonoContext *ctx); void mono_debugger_agent_free_domain_info (MonoDomain *domain); -#if defined(PLATFORM_ANDROID) || defined(TARGET_ANDROID) +#if defined(HOST_ANDROID) || defined(TARGET_ANDROID) void mono_debugger_agent_unhandled_exception (MonoException *exc); #endif diff --git a/mono/mini/exceptions-arm.c b/mono/mini/exceptions-arm.c index dac83f0bb43..de769c87fff 100644 --- a/mono/mini/exceptions-arm.c +++ b/mono/mini/exceptions-arm.c @@ -15,9 +15,9 @@ #include #ifndef MONO_CROSS_COMPILE -#ifdef PLATFORM_ANDROID +#ifdef HOST_ANDROID #include -#endif /* def PLATFORM_ANDROID */ +#endif /* def HOST_ANDROID */ #endif #ifdef HAVE_UCONTEXT_H diff --git a/mono/mini/mini-arm.c b/mono/mini/mini-arm.c index 98bc4bf7ee5..1f6b67f26fe 100644 --- a/mono/mini/mini-arm.c +++ b/mono/mini/mini-arm.c @@ -335,7 +335,7 @@ mono_arm_patchable_bl (guint8 *code, int cond) return code; } -#if defined(__ARM_EABI__) && defined(__linux__) && !defined(PLATFORM_ANDROID) && !defined(MONO_CROSS_COMPILE) +#if defined(__ARM_EABI__) && defined(__linux__) && !defined(HOST_ANDROID) && !defined(MONO_CROSS_COMPILE) #define HAVE_AEABI_READ_TP 1 #endif diff --git a/mono/mini/mini-exceptions.c b/mono/mini/mini-exceptions.c index 4f81d7c4c37..ad70319d744 100644 --- a/mono/mini/mini-exceptions.c +++ b/mono/mini/mini-exceptions.c @@ -2709,12 +2709,12 @@ mono_handle_native_crash (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_T * glibc fork acquires some locks, so if the crash happened inside malloc/free, * it will deadlock. Call the syscall directly instead. */ -#if defined(PLATFORM_ANDROID) +#if defined(HOST_ANDROID) /* SYS_fork is defined to be __NR_fork which is not defined in some ndk versions */ g_assert_not_reached (); -#elif !defined(PLATFORM_MACOSX) && defined(SYS_fork) +#elif !defined(HOST_DARWIN) && defined(SYS_fork) pid = (pid_t) syscall (SYS_fork); -#elif defined(PLATFORM_MACOSX) && HAVE_FORK +#elif defined(HOST_DARWIN) && HAVE_FORK pid = (pid_t) fork (); #else g_assert_not_reached (); @@ -2742,7 +2742,7 @@ mono_handle_native_crash (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_T #endif } #else -#ifdef PLATFORM_ANDROID +#ifdef HOST_ANDROID /* set DUMPABLE for this process so debuggerd can attach with ptrace(2), see: * https://android.googlesource.com/platform/bionic/+/151da681000c07da3c24cd30a3279b1ca017f452/linker/debugger.cpp#206 * this has changed on later versions of Android. Also, we don't want to @@ -2782,7 +2782,7 @@ mono_handle_native_crash (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_T if (!mono_do_crash_chaining) { /*Android abort is a fluke, it doesn't abort, it triggers another segv. */ -#if defined (PLATFORM_ANDROID) +#if defined (HOST_ANDROID) exit (-1); #else abort (); @@ -2845,7 +2845,7 @@ mono_print_thread_dump_internal (void *sigctx, MonoContext *start_ctx) mono_runtime_printf ("%s", text->str); -#if PLATFORM_WIN32 && TARGET_WIN32 && _DEBUG +#if HOST_WIN32 && TARGET_WIN32 && _DEBUG OutputDebugStringA(text->str); #endif diff --git a/mono/mini/mini-generic-sharing.c b/mono/mini/mini-generic-sharing.c index 9943d883966..243c83cbe5d 100644 --- a/mono/mini/mini-generic-sharing.c +++ b/mono/mini/mini-generic-sharing.c @@ -390,7 +390,7 @@ info_has_identity (MonoRgctxInfoType info_type) /* * LOCKING: loader lock */ -#if defined(PLATFORM_ANDROID) && defined(TARGET_ARM) +#if defined(HOST_ANDROID) && defined(TARGET_ARM) /* work around for HW bug on Nexus9 when running on armv7 */ #ifdef __clang__ static __attribute__ ((optnone)) void diff --git a/mono/mini/mini-posix.c b/mono/mini/mini-posix.c index 8b17287a21a..331b7ca3c02 100644 --- a/mono/mini/mini-posix.c +++ b/mono/mini/mini-posix.c @@ -68,7 +68,7 @@ #include "jit-icalls.h" -#ifdef PLATFORM_MACOSX +#ifdef HOST_DARWIN #include #include #include @@ -95,7 +95,7 @@ MONO_SIG_HANDLER_SIGNATURE (mono_chain_signal) return FALSE; } -#ifndef PLATFORM_MACOSX +#ifndef HOST_DARWIN void mono_runtime_install_handlers (void) { @@ -302,7 +302,7 @@ add_signal_handler (int signo, gpointer handler, int flags) #ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK /*Apple likes to deliver SIGBUS for *0 */ -#ifdef PLATFORM_MACOSX +#ifdef HOST_DARWIN if (signo == SIGSEGV || signo == SIGBUS) { #else if (signo == SIGSEGV) { @@ -396,7 +396,7 @@ mono_runtime_posix_install_handlers (void) add_signal_handler (SIGSEGV, mono_sigsegv_signal_handler, 0); } -#ifndef PLATFORM_MACOSX +#ifndef HOST_DARWIN void mono_runtime_install_handlers (void) { @@ -428,7 +428,7 @@ mono_runtime_cleanup_handlers (void) static volatile gint32 sampling_thread_running; -#ifdef PLATFORM_MACOSX +#ifdef HOST_DARWIN static clock_serv_t sampling_clock_service; @@ -699,7 +699,7 @@ mono_runtime_shutdown_stat_profiler (void) mono_profiler_sampling_thread_post (); -#ifndef PLATFORM_MACOSX +#ifndef HOST_DARWIN /* * There is a slight problem when we're using CLOCK_PROCESS_CPUTIME_ID: If * we're shutting down and there's largely no activity in the process other @@ -755,7 +755,7 @@ mono_runtime_setup_stat_profiler (void) * get us a 100% sampling rate. However, this may interfere with the GC's * STW logic. Could perhaps be solved by taking the suspend lock. */ -#if defined (USE_POSIX_BACKEND) && defined (SIGRTMIN) && !defined (PLATFORM_ANDROID) +#if defined (USE_POSIX_BACKEND) && defined (SIGRTMIN) && !defined (HOST_ANDROID) /* Just take the first real-time signal we can get. */ profiler_signal = mono_threads_suspend_search_alternative_signal (); #else @@ -855,7 +855,7 @@ mono_gdb_render_native_backtraces (pid_t crashed_pid) memset (argv, 0, sizeof (char*) * 10); -#if defined(PLATFORM_MACOSX) +#if defined(HOST_DARWIN) if (native_stack_with_lldb (crashed_pid, argv, commands, commands_filename)) goto exec; #endif @@ -863,7 +863,7 @@ mono_gdb_render_native_backtraces (pid_t crashed_pid) if (native_stack_with_gdb (crashed_pid, argv, commands, commands_filename)) goto exec; -#if !defined(PLATFORM_MACOSX) +#if !defined(HOST_DARWIN) if (native_stack_with_lldb (crashed_pid, argv, commands, commands_filename)) goto exec; #endif diff --git a/mono/mini/mini-runtime.c b/mono/mini/mini-runtime.c index b839e49f096..8f0f7dd5395 100644 --- a/mono/mini/mini-runtime.c +++ b/mono/mini/mini-runtime.c @@ -4045,7 +4045,7 @@ register_icalls (void) mono_add_internal_call ("Mono.Runtime::mono_runtime_cleanup_handlers", mono_runtime_cleanup_handlers); -#if defined(PLATFORM_ANDROID) || defined(TARGET_ANDROID) +#if defined(HOST_ANDROID) || defined(TARGET_ANDROID) mono_add_internal_call ("System.Diagnostics.Debugger::Mono_UnhandledException_internal", mono_debugger_agent_unhandled_exception); #endif diff --git a/mono/mini/mini.c b/mono/mini/mini.c index 5e6e718486f..ee3c3754ae2 100644 --- a/mono/mini/mini.c +++ b/mono/mini/mini.c @@ -3163,7 +3163,7 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl cfg->llvm_only = (flags & JIT_FLAG_LLVM_ONLY) != 0; cfg->backend = current_backend; -#ifdef PLATFORM_ANDROID +#ifdef HOST_ANDROID if (cfg->method->wrapper_type != MONO_WRAPPER_NONE) { /* FIXME: Why is this needed */ cfg->gen_seq_points = FALSE; diff --git a/mono/mini/mini.h b/mono/mini/mini.h index 7ce873a38ce..d15e9ec7164 100644 --- a/mono/mini/mini.h +++ b/mono/mini/mini.h @@ -123,7 +123,7 @@ #define mono_simd_shuffle_mask(a,b,c,d) ((a) | ((b) << 2) | ((c) << 4) | ((d) << 6)) /* Remap printf to g_print (we use a mix of these in the mini code) */ -#ifdef PLATFORM_ANDROID +#ifdef HOST_ANDROID #define printf g_print #endif diff --git a/mono/mini/trace.c b/mono/mini/trace.c index e5e36100f09..0e50ae55070 100644 --- a/mono/mini/trace.c +++ b/mono/mini/trace.c @@ -26,7 +26,7 @@ #include #include "trace.h" -#if defined (PLATFORM_ANDROID) || (defined (TARGET_IOS) && defined (TARGET_IOS)) +#if defined (HOST_ANDROID) || (defined (TARGET_IOS) && defined (TARGET_IOS)) # undef printf # define printf(...) g_log("mono", G_LOG_LEVEL_MESSAGE, __VA_ARGS__) # undef fprintf diff --git a/mono/profiler/Makefile.am b/mono/profiler/Makefile.am index f96c8a3fccc..88cd9d37a1a 100644 --- a/mono/profiler/Makefile.am +++ b/mono/profiler/Makefile.am @@ -30,7 +30,7 @@ lib_LTLIBRARIES = \ suppressiondir = $(datadir)/mono-$(API_VER)/mono/profiler suppression_DATA = mono-profiler-log.suppression -if PLATFORM_DARWIN +if HOST_DARWIN if BITCODE prof_ldflags = -no-undefined else @@ -44,7 +44,7 @@ else libmono_dep = $(monodir)/mono/mini/$(LIBMONO_LA) endif -if PLATFORM_ANDROID +if HOST_ANDROID prof_ldflags = -avoid-version endif diff --git a/mono/sgen/sgen-marksweep.c b/mono/sgen/sgen-marksweep.c index 35e1195dbfb..5f4185d4df7 100644 --- a/mono/sgen/sgen-marksweep.c +++ b/mono/sgen/sgen-marksweep.c @@ -1220,7 +1220,7 @@ major_get_and_reset_num_major_objects_marked (void) #endif /* gcc 4.2.1 from xcode4 crashes on sgen_card_table_get_card_address () when this is enabled */ -#if defined(PLATFORM_MACOSX) +#if defined(HOST_DARWIN) #if MONO_GNUC_VERSION <= 40300 #undef PREFETCH_CARDS #endif diff --git a/mono/tests/Makefile.am b/mono/tests/Makefile.am index e93fb7de81f..aeec29b075f 100755 --- a/mono/tests/Makefile.am +++ b/mono/tests/Makefile.am @@ -1139,10 +1139,10 @@ tests: compile-tests # # Test that no symbols are missed in eglib-remap.h # -if PLATFORM_LINUX +if HOST_LINUX test-platform: test-eglib-remap else -if PLATFORM_DARWIN +if HOST_DARWIN test-platform: test-eglib-remap endif endif diff --git a/mono/unit-tests/Makefile.am b/mono/unit-tests/Makefile.am index ec04c4d1c5f..82eb31b2157 100644 --- a/mono/unit-tests/Makefile.am +++ b/mono/unit-tests/Makefile.am @@ -3,7 +3,7 @@ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/mono $(LIBGC_CPPFLAGS) $(GLIB_CFLA test_cflags = $(AM_CFLAGS) $(SGEN_DEFINES) test_ldadd = libtestlib.la \ $(LIBGC_LIBS) $(GLIB_LIBS) -lm $(LIBICONV) -if PLATFORM_DARWIN +if HOST_DARWIN test_ldflags = -framework CoreFoundation -framework Foundation endif diff --git a/mono/utils/mono-compiler.h b/mono/utils/mono-compiler.h index 746c84fb513..3e1b4108b4e 100644 --- a/mono/utils/mono-compiler.h +++ b/mono/utils/mono-compiler.h @@ -74,7 +74,7 @@ typedef SSIZE_T ssize_t; #define MONO_EMPTY_SOURCE_FILE(x) #endif -#if !defined(_MSC_VER) && !defined(PLATFORM_SOLARIS) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MONOTOUCH) && HAVE_VISIBILITY_HIDDEN +#if !defined(_MSC_VER) && !defined(HOST_SOLARIS) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MONOTOUCH) && HAVE_VISIBILITY_HIDDEN #if MONO_LLVM_LOADED #define MONO_LLVM_INTERNAL MONO_API #else diff --git a/mono/utils/mono-dl-posix.c b/mono/utils/mono-dl-posix.c index 0ade0d54149..c2b2b96d9d7 100644 --- a/mono/utils/mono-dl-posix.c +++ b/mono/utils/mono-dl-posix.c @@ -61,7 +61,7 @@ mono_dl_get_system_dir (void) void * mono_dl_open_file (const char *file, int flags) { -#ifdef PLATFORM_ANDROID +#ifdef HOST_ANDROID /* Bionic doesn't support NULL filenames */ if (!file) return NULL; diff --git a/mono/utils/mono-hwcap-arm.c b/mono/utils/mono-hwcap-arm.c index 4ab9cd7b05e..a44f43ac9e7 100644 --- a/mono/utils/mono-hwcap-arm.c +++ b/mono/utils/mono-hwcap-arm.c @@ -22,7 +22,7 @@ #include "mono/utils/mono-hwcap.h" -#if defined(HAVE_SYS_AUXV_H) && !defined(PLATFORM_ANDROID) +#if defined(HAVE_SYS_AUXV_H) && !defined(HOST_ANDROID) #include #elif defined(__APPLE__) #include @@ -38,7 +38,7 @@ void mono_hwcap_arch_init (void) { -#if defined(HAVE_SYS_AUXV_H) && !defined(PLATFORM_ANDROID) +#if defined(HAVE_SYS_AUXV_H) && !defined(HOST_ANDROID) unsigned long hwcap; unsigned long platform; diff --git a/mono/utils/mono-log-android.c b/mono/utils/mono-log-android.c index 1072788a6f5..fba61f76077 100644 --- a/mono/utils/mono-log-android.c +++ b/mono/utils/mono-log-android.c @@ -10,7 +10,7 @@ */ #include -#if defined (PLATFORM_ANDROID) +#if defined (HOST_ANDROID) #include #include "mono-logger-internals.h" diff --git a/mono/utils/mono-logger-internals.h b/mono/utils/mono-logger-internals.h index e28b3f36103..4a83afd5228 100644 --- a/mono/utils/mono-logger-internals.h +++ b/mono/utils/mono-logger-internals.h @@ -134,7 +134,7 @@ mono_trace_message(MonoTraceMask mask, const char *format, ...) #endif /* !__GNUC__ */ -#if defined (PLATFORM_ANDROID) || (defined (TARGET_IOS) && defined (TARGET_IOS)) +#if defined (HOST_ANDROID) || (defined (TARGET_IOS) && defined (TARGET_IOS)) #define mono_gc_printf(gc_log_file, format, ...) g_log ("mono-gc", G_LOG_LEVEL_MESSAGE, format, ##__VA_ARGS__) #define mono_runtime_printf(format, ...) g_log ("mono-rt", G_LOG_LEVEL_MESSAGE, format "\n", ##__VA_ARGS__) @@ -184,7 +184,7 @@ void mono_log_open_logfile (const char *, void *); void mono_log_write_logfile (const char *, GLogLevelFlags, mono_bool, const char *); void mono_log_close_logfile (void); -#if PLATFORM_ANDROID +#if HOST_ANDROID void mono_log_open_logcat (const char *path, void *userData); void mono_log_write_logcat (const char *log_domain, GLogLevelFlags level, mono_bool hdr, const char *message); void mono_log_close_logcat (void); diff --git a/mono/utils/mono-logger.c b/mono/utils/mono-logger.c index aeaa3f97cee..d8d9e82ee44 100644 --- a/mono/utils/mono-logger.c +++ b/mono/utils/mono-logger.c @@ -154,7 +154,7 @@ mono_trace_set_logdest_string (const char *dest) if(level_stack == NULL) mono_trace_init(); -#if PLATFORM_ANDROID +#if HOST_ANDROID logger.opener = mono_log_open_logcat; logger.writer = mono_log_write_logcat; logger.closer = mono_log_close_logcat; diff --git a/mono/utils/mono-os-mutex.h b/mono/utils/mono-os-mutex.h index be1f6485886..eb7c4bb5b15 100644 --- a/mono/utils/mono-os-mutex.h +++ b/mono/utils/mono-os-mutex.h @@ -41,7 +41,7 @@ G_BEGIN_DECLS #if !defined(HOST_WIN32) -#if !defined(CLOCK_MONOTONIC) || defined(PLATFORM_MACOSX) || defined(PLATFORM_ANDROID) +#if !defined(CLOCK_MONOTONIC) || defined(HOST_DARWIN) || defined(HOST_ANDROID) #define BROKEN_CLOCK_SOURCE #endif diff --git a/mono/utils/mono-path.c b/mono/utils/mono-path.c index e93eb7e53f0..d0dd89b4c0d 100644 --- a/mono/utils/mono-path.c +++ b/mono/utils/mono-path.c @@ -108,7 +108,7 @@ mono_path_canonicalize (const char *path) * This ensures that the path that we store points to the final file * not a path to a symlink. */ -#if !defined(PLATFORM_NO_SYMLINKS) +#if !defined(HOST_NO_SYMLINKS) static gchar * resolve_symlink (const char *path) { @@ -147,7 +147,7 @@ resolve_symlink (const char *path) gchar * mono_path_resolve_symlinks (const char *path) { -#if defined(PLATFORM_NO_SYMLINKS) +#if defined(HOST_NO_SYMLINKS) return mono_path_canonicalize (path); #else gchar **split = g_strsplit (path, G_DIR_SEPARATOR_S, -1); diff --git a/mono/utils/mono-proclib.c b/mono/utils/mono-proclib.c index 5c5b891d607..714d9eb7a24 100644 --- a/mono/utils/mono-proclib.c +++ b/mono/utils/mono-proclib.c @@ -682,7 +682,7 @@ mono_process_current_pid () int mono_cpu_count (void) { -#ifdef PLATFORM_ANDROID +#ifdef HOST_ANDROID /* Android tries really hard to save power by powering off CPUs on SMP phones which * means the normal way to query cpu count returns a wrong value with userspace API. * Instead we use /sys entries to query the actual hardware CPU count. @@ -750,7 +750,7 @@ mono_cpu_count (void) * * use sched_getaffinity (+ fallback to _SC_NPROCESSORS_ONLN in case of error) on x86. This * ensures we're inline with what OpenJDK [4] and CoreCLR [5] do * * use _SC_NPROCESSORS_CONF exclusively on ARM (I think we could eventually even get rid of - * the PLATFORM_ANDROID special case) + * the HOST_ANDROID special case) * * Helpful links: * @@ -891,7 +891,7 @@ mono_cpu_get_data (int cpu_id, MonoCpuData data, MonoProcessError *error) int mono_atexit (void (*func)(void)) { -#ifdef PLATFORM_ANDROID +#ifdef HOST_ANDROID /* Some versions of android libc doesn't define atexit () */ return 0; #else diff --git a/mono/utils/mono-sigcontext.h b/mono/utils/mono-sigcontext.h index c067ce22512..479b8d4bf01 100644 --- a/mono/utils/mono-sigcontext.h +++ b/mono/utils/mono-sigcontext.h @@ -6,7 +6,7 @@ #define __MONO_MONO_SIGCONTEXT_H__ #include -#if defined(PLATFORM_ANDROID) +#if defined(HOST_ANDROID) #include #endif @@ -89,7 +89,7 @@ #define UCONTEXT_REG_ESI(ctx) (((ucontext_t*)(ctx))->sc_esi) #define UCONTEXT_REG_EDI(ctx) (((ucontext_t*)(ctx))->sc_edi) #define UCONTEXT_REG_EIP(ctx) (((ucontext_t*)(ctx))->sc_eip) -#elif defined(PLATFORM_SOLARIS) +#elif defined(HOST_SOLARIS) #define UCONTEXT_REG_EAX(ctx) (((ucontext_t*)(ctx))->uc_mcontext.gregs [EAX]) #define UCONTEXT_REG_EBX(ctx) (((ucontext_t*)(ctx))->uc_mcontext.gregs [EBX]) #define UCONTEXT_REG_ECX(ctx) (((ucontext_t*)(ctx))->uc_mcontext.gregs [ECX]) @@ -101,7 +101,7 @@ #define UCONTEXT_REG_EIP(ctx) (((ucontext_t*)(ctx))->uc_mcontext.gregs [EIP]) #else -#if defined(PLATFORM_ANDROID) && !defined(HAVE_UCONTEXT_H) +#if defined(HOST_ANDROID) && !defined(HAVE_UCONTEXT_H) /* No ucontext.h as of NDK v6b */ typedef int greg_t; #define NGREG 19 diff --git a/mono/utils/mono-threads-android.c b/mono/utils/mono-threads-android.c index c8c17a3d3cf..dd4307bca37 100644 --- a/mono/utils/mono-threads-android.c +++ b/mono/utils/mono-threads-android.c @@ -4,7 +4,7 @@ #include -#if defined(PLATFORM_ANDROID) +#if defined(HOST_ANDROID) #include #include diff --git a/mono/utils/mono-threads-linux.c b/mono/utils/mono-threads-linux.c index d757cd66c31..e73b86084fc 100644 --- a/mono/utils/mono-threads-linux.c +++ b/mono/utils/mono-threads-linux.c @@ -4,7 +4,7 @@ #include -#if (defined(__linux__) && !defined(PLATFORM_ANDROID)) || defined(__FreeBSD_kernel__) +#if (defined(__linux__) && !defined(HOST_ANDROID)) || defined(__FreeBSD_kernel__) #include #include diff --git a/mono/utils/mono-threads-posix-signals.c b/mono/utils/mono-threads-posix-signals.c index 289bd98cd66..5f762c83abe 100644 --- a/mono/utils/mono-threads-posix-signals.c +++ b/mono/utils/mono-threads-posix-signals.c @@ -62,7 +62,7 @@ signal_add_handler (int signo, void (*handler)(int, siginfo_t *, void *), int fl static int abort_signal_get (void) { -#if defined(PLATFORM_ANDROID) +#if defined(HOST_ANDROID) return SIGTTIN; #elif defined (SIGRTMIN) static int abort_signum = -1; @@ -79,7 +79,7 @@ abort_signal_get (void) static int suspend_signal_get (void) { -#if defined(PLATFORM_ANDROID) +#if defined(HOST_ANDROID) return SIGPWR; #elif defined (SIGRTMIN) static int suspend_signum = -1; @@ -98,7 +98,7 @@ suspend_signal_get (void) static int restart_signal_get (void) { -#if defined(PLATFORM_ANDROID) +#if defined(HOST_ANDROID) return SIGXCPU; #elif defined (SIGRTMIN) static int restart_signum = -1; @@ -244,7 +244,7 @@ mono_threads_suspend_init_signals (void) On 32bits arm Android, signals with values >=32 are not usable as their headers ship a broken sigset_t. See 5005c6f3fbc1da584c6a550281689cc23f59fe6d for more details. */ -#ifdef PLATFORM_ANDROID +#ifdef HOST_ANDROID g_assert (suspend_signal_num < 32); g_assert (restart_signal_num < 32); g_assert (abort_signal_num < 32); diff --git a/mono/utils/mono-threads-posix.c b/mono/utils/mono-threads-posix.c index 138cc9e4b6a..22fcb674add 100644 --- a/mono/utils/mono-threads-posix.c +++ b/mono/utils/mono-threads-posix.c @@ -22,7 +22,7 @@ #include -#if defined(PLATFORM_ANDROID) && !defined(TARGET_ARM64) && !defined(TARGET_AMD64) +#if defined(HOST_ANDROID) && !defined(TARGET_ARM64) && !defined(TARGET_AMD64) #define USE_TKILL_ON_ANDROID 1 #endif @@ -295,7 +295,7 @@ mono_threads_suspend_abort_syscall (MonoThreadInfo *info) void mono_threads_suspend_register (MonoThreadInfo *info) { -#if defined (PLATFORM_ANDROID) +#if defined (HOST_ANDROID) info->native_handle = gettid (); #endif } diff --git a/mono/utils/mono-threads.c b/mono/utils/mono-threads.c index e26ca1760c6..9ba005e01b5 100644 --- a/mono/utils/mono-threads.c +++ b/mono/utils/mono-threads.c @@ -1313,7 +1313,7 @@ mono_thread_info_sleep (guint32 ms, gboolean *alerted) } while (1); } else { int ret; -#if defined (__linux__) && !defined(PLATFORM_ANDROID) +#if defined (__linux__) && !defined(HOST_ANDROID) struct timespec start, target; /* Use clock_nanosleep () to prevent time drifting problems when nanosleep () is interrupted by signals */ diff --git a/mono/utils/mono-time.c b/mono/utils/mono-time.c index ddca2c9ebb8..4a3b2705563 100644 --- a/mono/utils/mono-time.c +++ b/mono/utils/mono-time.c @@ -84,7 +84,7 @@ mono_100ns_datetime (void) #include #endif -#if defined(PLATFORM_MACOSX) +#if defined(HOST_DARWIN) #include #include #endif @@ -143,7 +143,7 @@ gint64 mono_100ns_ticks (void) { struct timeval tv; -#if defined(PLATFORM_MACOSX) +#if defined(HOST_DARWIN) /* http://developer.apple.com/library/mac/#qa/qa1398/_index.html */ static mach_timebase_info_data_t timebase; guint64 now = mach_absolute_time (); diff --git a/support/errno.c b/support/errno.c index b066d462b16..76b4b388e98 100644 --- a/support/errno.c +++ b/support/errno.c @@ -86,7 +86,7 @@ Mono_Posix_Syscall_strerror_r (int errnum, char *buf, mph_size_t n) mph_return_if_size_t_overflow (n); /* first, check for valid errnum */ -#if PLATFORM_ANDROID +#if HOST_ANDROID /* Android NDK defines _GNU_SOURCE but strerror_r follows the XSI semantics * not the GNU one. XSI version returns an integer, as opposed to the GNU one * which returns pointer to the buffer. diff --git a/support/mph.h b/support/mph.h index 141b675c010..e5992e5e71f 100644 --- a/support/mph.h +++ b/support/mph.h @@ -78,11 +78,11 @@ * OS X doesn't define MAP_ANONYMOUS, but it does define MAP_ANON. * Alias them to fix: https://bugzilla.xamarin.com/show_bug.cgi?id=3419 */ -#ifdef PLATFORM_MACOSX +#ifdef HOST_DARWIN #ifndef MAP_ANONYMOUS #define MAP_ANONYMOUS MAP_ANON #endif /* ndef MAP_ANONYMOUS */ -#endif /* ndef PLATFORM_MACOSX */ +#endif /* ndef HOST_DARWIN */ /* * XATTR_AUTO is a synonym for 0 within XattrFlags, but most systems don't diff --git a/support/sys-mman.c b/support/sys-mman.c index afbe4662444..143148f8ca3 100644 --- a/support/sys-mman.c +++ b/support/sys-mman.c @@ -13,7 +13,7 @@ #define _XOPEN_SOURCE 600 #endif -#ifdef PLATFORM_MACOSX +#ifdef HOST_DARWIN /* For mincore () */ #define _DARWIN_C_SOURCE #endif diff --git a/support/sys-sendfile.c b/support/sys-sendfile.c index 3edf7be4163..7b6797acb04 100644 --- a/support/sys-sendfile.c +++ b/support/sys-sendfile.c @@ -31,7 +31,7 @@ Mono_Posix_Syscall_sendfile (int out_fd, int in_fd, mph_off_t *offset, mph_size_ _offset = *offset; -#if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD) +#if defined(HOST_DARWIN) || defined(HOST_BSD) /* The BSD version has 6 arguments */ g_assert_not_reached (); #else diff --git a/support/unistd.c b/support/unistd.c index 1123f2bc0fa..0f560e28d00 100644 --- a/support/unistd.c +++ b/support/unistd.c @@ -230,7 +230,7 @@ Mono_Posix_Syscall_setdomainname (const char *name, mph_size_t len) /* Android implements truncate, but doesn't declare it. * Result is a warning during compilation, so skip it. */ -#ifndef PLATFORM_ANDROID +#ifndef HOST_ANDROID gint32 Mono_Posix_Syscall_truncate (const char *path, mph_off_t length) { diff --git a/tools/monograph/Makefile.am b/tools/monograph/Makefile.am index 1a53e3772b7..b64d44c231e 100644 --- a/tools/monograph/Makefile.am +++ b/tools/monograph/Makefile.am @@ -38,7 +38,7 @@ monograph_LDADD = \ $(LIBICONV) \ -lm -if PLATFORM_DARWIN +if HOST_DARWIN monograph_LDFLAGS=-framework CoreFoundation endif diff --git a/tools/offsets-tool/MonoAotOffsetsDumper.cs b/tools/offsets-tool/MonoAotOffsetsDumper.cs index 517cdbd0de4..81c438f810a 100644 --- a/tools/offsets-tool/MonoAotOffsetsDumper.cs +++ b/tools/offsets-tool/MonoAotOffsetsDumper.cs @@ -126,7 +126,7 @@ namespace CppSharp });*/ foreach (var target in AndroidTargets) - target.Defines.AddRange (new string[] { "PLATFORM_ANDROID", + target.Defines.AddRange (new string[] { "HOST_ANDROID", "TARGET_ANDROID", "MONO_CROSS_COMPILE", "USE_MONO_CTX" }); } @@ -148,7 +148,7 @@ namespace CppSharp }); foreach (var target in iOSTargets) { - target.Defines.AddRange (new string[] { "PLATFORM_DARWIN", + target.Defines.AddRange (new string[] { "HOST_DARWIN", "TARGET_IOS", "TARGET_MACH", "MONO_CROSS_COMPILE", "USE_MONO_CTX", "_XOPEN_SOURCE" }); @@ -162,7 +162,7 @@ namespace CppSharp }); foreach (var target in DarwinTargets) { - target.Defines.AddRange (new string[] { "PLATFORM_DARWIN", + target.Defines.AddRange (new string[] { "HOST_DARWIN", "TARGET_IOS", "TARGET_MACH", "MONO_CROSS_COMPILE", "USE_MONO_CTX", "_XOPEN_SOURCE" }); diff --git a/tools/pedump/Makefile.am b/tools/pedump/Makefile.am index 4fb8260abdb..7a2776c8514 100644 --- a/tools/pedump/Makefile.am +++ b/tools/pedump/Makefile.am @@ -25,6 +25,6 @@ pedump_LDADD = \ $(GLIB_LIBS) \ $(LIBICONV) -if PLATFORM_DARWIN +if HOST_DARWIN pedump_LDFLAGS=-framework CoreFoundation -framework Foundation endif diff --git a/winconfig.h b/winconfig.h index 97d9f4c433a..00edfeec2f7 100644 --- a/winconfig.h +++ b/winconfig.h @@ -55,7 +55,7 @@ #define DISABLE_PORTABILITY 1 /* Windows does not have symlinks */ -#define PLATFORM_NO_SYMLINKS 1 +#define HOST_NO_SYMLINKS 1 /* String of disabled features */ #define DISABLED_FEATURES "none" -- 2.25.1