Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(866)

Unified Diff: runtime/platform/globals.h

Issue 2757783003: Set TARGET_OS_* from GN, falling back to HOST_OS_*. (Closed)
Patch Set: . Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/platform/globals.h
diff --git a/runtime/platform/globals.h b/runtime/platform/globals.h
index c504430fd09aeb7529b915b095fcb11b167e385e..21eb19a9b3e01f0ed82f759fb70c387af49e7ecc 100644
--- a/runtime/platform/globals.h
+++ b/runtime/platform/globals.h
@@ -102,9 +102,6 @@
// the value defined in TargetConditionals.h
#define HOST_OS_MACOS 1
#if TARGET_OS_IPHONE
-// Test for this #define by saying '#if TARGET_OS_IOS' rather than the usual
-// '#if defined(TARGET_OS_IOS)'. TARGET_OS_IOS is defined to be 0 in
-// XCode >= 7.0. See Issue #24453.
#define HOST_OS_IOS 1
#endif
@@ -384,17 +381,45 @@ typedef simd128_value_t fpu_register_t;
#endif
-#if defined(TARGET_ARCH_ARM)
-#if defined(TARGET_ABI_IOS) && defined(TARGET_ABI_EABI)
-#error Both TARGET_ABI_IOS and TARGET_ABI_EABI defined.
-#elif !defined(TARGET_ABI_IOS) && !defined(TARGET_ABI_EABI)
-#if defined(HOST_OS_MAC)
-#define TARGET_ABI_IOS 1
+#if !defined(TARGET_OS_ANDROID)
zra 2017/03/17 17:24:24 Why not: #if !defined(...) && \ !defined(...)
rmacnak 2017/03/17 18:22:16 Copied idiom from the equivalent section for TARGE
+#if !defined(TARGET_OS_FUCHSIA)
+#if !defined(TARGET_OS_IOS)
+#if !defined(TARGET_OS_LINUX)
+#if !defined(TARGET_OS_MACOS)
+#if !defined(TARGET_OS_WINDOWS)
+// No target OS specified; pick the one matching the host OS.
+#if defined(HOST_OS_ANDROID)
+#define TARGET_OS_ANDROID 1
+#elif defined(HOST_OS_FUCHSIA)
+#define TARGET_OS_FUCHSIA 1
+#elif defined(HOST_OS_IOS)
+#define TARGET_OS_MACOS 1
+// Test for this #define by saying '#if TARGET_OS_IOS' rather than the usual
+// '#if defined(TARGET_OS_IOS)'. TARGET_OS_IOS is defined to be 0 in
+// XCode >= 7.0. See Issue #24453.
zra 2017/03/17 17:24:24 Can we use a different symbol? Maybe TARGET_OS_MAC
rmacnak 2017/03/17 18:22:16 Sure. TARGET_OS_MACOS_IOS seems like a good choice
+#define TARGET_OS_IOS 1
+#elif defined(HOST_OS_LINUX)
+#define TARGET_OS_LINUX 1
+#elif defined(HOST_OS_MACOS)
+#define TARGET_OS_MACOS 1
+#elif defined(HOST_OS_WINDOWS)
+#define TARGET_OS_WINDOWS 1
#else
-#define TARGET_ABI_EABI 1
+#error Automatic target OS detection failed.
+#endif
#endif
#endif
-#endif // TARGET_ARCH_ARM
+#endif
+#endif
+#endif
+#endif
+
+
+// TARGET_OS_IOS is defined as 0 on macOS. Always define it so we can test
+// uniformly.
+#if !defined(TARGET_OS_IOS)
+#define TARGET_OS_IOS 0
+#endif
// Short form printf format specifiers
« no previous file with comments | « runtime/BUILD.gn ('k') | runtime/vm/constants_arm.h » ('j') | runtime/vm/snapshot.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698