OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef RUNTIME_PLATFORM_GLOBALS_H_ | 5 #ifndef RUNTIME_PLATFORM_GLOBALS_H_ |
6 #define RUNTIME_PLATFORM_GLOBALS_H_ | 6 #define RUNTIME_PLATFORM_GLOBALS_H_ |
7 | 7 |
8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to | 8 // __STDC_FORMAT_MACROS has to be defined before including <inttypes.h> to |
9 // enable platform independent printf format specifiers. | 9 // enable platform independent printf format specifiers. |
10 #ifndef __STDC_FORMAT_MACROS | 10 #ifndef __STDC_FORMAT_MACROS |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 #include "platform/floating_point.h" | 80 #include "platform/floating_point.h" |
81 #endif // !defined(_WIN32) | 81 #endif // !defined(_WIN32) |
82 | 82 |
83 // Target OS detection. | 83 // Target OS detection. |
84 // for more information on predefined macros: | 84 // for more information on predefined macros: |
85 // - http://msdn.microsoft.com/en-us/library/b0084kay.aspx | 85 // - http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
86 // - with gcc, run: "echo | gcc -E -dM -" | 86 // - with gcc, run: "echo | gcc -E -dM -" |
87 #if defined(__ANDROID__) | 87 #if defined(__ANDROID__) |
88 | 88 |
89 // Check for Android first, to determine its difference from Linux. | 89 // Check for Android first, to determine its difference from Linux. |
90 #define TARGET_OS_ANDROID 1 | 90 #define HOST_OS_ANDROID 1 |
91 | 91 |
92 #elif defined(__linux__) || defined(__FreeBSD__) | 92 #elif defined(__linux__) || defined(__FreeBSD__) |
93 | 93 |
94 // Generic Linux. | 94 // Generic Linux. |
95 #define TARGET_OS_LINUX 1 | 95 #define HOST_OS_LINUX 1 |
96 | 96 |
97 #elif defined(__APPLE__) | 97 #elif defined(__APPLE__) |
98 | 98 |
99 // Define the flavor of Mac OS we are running on. | 99 // Define the flavor of Mac OS we are running on. |
100 #include <TargetConditionals.h> | 100 #include <TargetConditionals.h> |
101 // TODO(iposva): Rename TARGET_OS_MACOS to TARGET_OS_MAC to inherit | 101 // TODO(iposva): Rename HOST_OS_MACOS to HOST_OS_MAC to inherit |
102 // the value defined in TargetConditionals.h | 102 // the value defined in TargetConditionals.h |
103 #define TARGET_OS_MACOS 1 | 103 #define HOST_OS_MACOS 1 |
104 #if TARGET_OS_IPHONE | 104 #if TARGET_OS_IPHONE |
105 // Test for this #define by saying '#if TARGET_OS_IOS' rather than the usual | 105 // Test for this #define by saying '#if TARGET_OS_IOS' rather than the usual |
106 // '#if defined(TARGET_OS_IOS)'. TARGET_OS_IOS is defined to be 0 in | 106 // '#if defined(TARGET_OS_IOS)'. TARGET_OS_IOS is defined to be 0 in |
107 // XCode >= 7.0. See Issue #24453. | 107 // XCode >= 7.0. See Issue #24453. |
108 #define TARGET_OS_IOS 1 | 108 #define HOST_OS_IOS 1 |
109 #endif | 109 #endif |
110 | 110 |
111 #elif defined(_WIN32) | 111 #elif defined(_WIN32) |
112 | 112 |
113 // Windows, both 32- and 64-bit, regardless of the check for _WIN32. | 113 // Windows, both 32- and 64-bit, regardless of the check for _WIN32. |
114 #define TARGET_OS_WINDOWS 1 | 114 #define HOST_OS_WINDOWS 1 |
115 | 115 |
116 #elif defined(__Fuchsia__) | 116 #elif defined(__Fuchsia__) |
117 #define TARGET_OS_FUCHSIA | 117 #define HOST_OS_FUCHSIA |
118 | 118 |
119 #elif !defined(TARGET_OS_FUCHSIA) | 119 #elif !defined(HOST_OS_FUCHSIA) |
120 #error Automatic target os detection failed. | 120 #error Automatic target os detection failed. |
121 #endif | 121 #endif |
122 | 122 |
123 | 123 |
124 // Setup product, release or debug build related macros. | 124 // Setup product, release or debug build related macros. |
125 #if defined(PRODUCT) && defined(DEBUG) | 125 #if defined(PRODUCT) && defined(DEBUG) |
126 #error Both PRODUCT and DEBUG defined. | 126 #error Both PRODUCT and DEBUG defined. |
127 #endif // defined(PRODUCT) && defined(DEBUG) | 127 #endif // defined(PRODUCT) && defined(DEBUG) |
128 | 128 |
129 #if defined(PRODUCT) | 129 #if defined(PRODUCT) |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 // implementations are uniprocessors. | 381 // implementations are uniprocessors. |
382 #if !defined(TARGET_ARCH_ARM_5TE) | 382 #if !defined(TARGET_ARCH_ARM_5TE) |
383 #define ARCH_IS_MULTI_CORE 1 | 383 #define ARCH_IS_MULTI_CORE 1 |
384 #endif | 384 #endif |
385 | 385 |
386 | 386 |
387 #if defined(TARGET_ARCH_ARM) | 387 #if defined(TARGET_ARCH_ARM) |
388 #if defined(TARGET_ABI_IOS) && defined(TARGET_ABI_EABI) | 388 #if defined(TARGET_ABI_IOS) && defined(TARGET_ABI_EABI) |
389 #error Both TARGET_ABI_IOS and TARGET_ABI_EABI defined. | 389 #error Both TARGET_ABI_IOS and TARGET_ABI_EABI defined. |
390 #elif !defined(TARGET_ABI_IOS) && !defined(TARGET_ABI_EABI) | 390 #elif !defined(TARGET_ABI_IOS) && !defined(TARGET_ABI_EABI) |
391 #if defined(TARGET_OS_MAC) | 391 #if defined(HOST_OS_MAC) |
392 #define TARGET_ABI_IOS 1 | 392 #define TARGET_ABI_IOS 1 |
393 #else | 393 #else |
394 #define TARGET_ABI_EABI 1 | 394 #define TARGET_ABI_EABI 1 |
395 #endif | 395 #endif |
396 #endif | 396 #endif |
397 #endif // TARGET_ARCH_ARM | 397 #endif // TARGET_ARCH_ARM |
398 | 398 |
399 | 399 |
400 // Short form printf format specifiers | 400 // Short form printf format specifiers |
401 #define Pd PRIdPTR | 401 #define Pd PRIdPTR |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 template <typename T> | 665 template <typename T> |
666 static inline T ReadUnaligned(const T* ptr) { | 666 static inline T ReadUnaligned(const T* ptr) { |
667 T value; | 667 T value; |
668 memcpy(&value, ptr, sizeof(value)); | 668 memcpy(&value, ptr, sizeof(value)); |
669 return value; | 669 return value; |
670 } | 670 } |
671 | 671 |
672 | 672 |
673 // On Windows the reentrent version of strtok is called | 673 // On Windows the reentrent version of strtok is called |
674 // strtok_s. Unify on the posix name strtok_r. | 674 // strtok_s. Unify on the posix name strtok_r. |
675 #if defined(TARGET_OS_WINDOWS) | 675 #if defined(HOST_OS_WINDOWS) |
676 #define snprintf _snprintf | 676 #define snprintf _snprintf |
677 #define strtok_r strtok_s | 677 #define strtok_r strtok_s |
678 #endif | 678 #endif |
679 | 679 |
680 #if !defined(TARGET_OS_WINDOWS) | 680 #if !defined(HOST_OS_WINDOWS) |
681 #if defined(TEMP_FAILURE_RETRY) | 681 #if defined(TEMP_FAILURE_RETRY) |
682 // TEMP_FAILURE_RETRY is defined in unistd.h on some platforms. We should | 682 // TEMP_FAILURE_RETRY is defined in unistd.h on some platforms. We should |
683 // not use that version, but instead the one in signal_blocker.h, to ensure | 683 // not use that version, but instead the one in signal_blocker.h, to ensure |
684 // we disable signal interrupts. | 684 // we disable signal interrupts. |
685 #undef TEMP_FAILURE_RETRY | 685 #undef TEMP_FAILURE_RETRY |
686 #endif // defined(TEMP_FAILURE_RETRY) | 686 #endif // defined(TEMP_FAILURE_RETRY) |
687 #endif // !defined(TARGET_OS_WINDOWS) | 687 #endif // !defined(HOST_OS_WINDOWS) |
688 | 688 |
689 #if defined(TARGET_OS_LINUX) || defined(TARGET_OS_MACOS) | 689 #if defined(HOST_OS_LINUX) || defined(HOST_OS_MACOS) |
690 // Tell the compiler to do printf format string checking if the | 690 // Tell the compiler to do printf format string checking if the |
691 // compiler supports it; see the 'format' attribute in | 691 // compiler supports it; see the 'format' attribute in |
692 // <http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Function-Attributes.html>. | 692 // <http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Function-Attributes.html>. |
693 // | 693 // |
694 // N.B.: As the GCC manual states, "[s]ince non-static C++ methods | 694 // N.B.: As the GCC manual states, "[s]ince non-static C++ methods |
695 // have an implicit 'this' argument, the arguments of such methods | 695 // have an implicit 'this' argument, the arguments of such methods |
696 // should be counted from two, not one." | 696 // should be counted from two, not one." |
697 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ | 697 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ |
698 __attribute__((__format__(__printf__, string_index, first_to_check))) | 698 __attribute__((__format__(__printf__, string_index, first_to_check))) |
699 #else | 699 #else |
(...skipping 10 matching lines...) Expand all Loading... |
710 // tag in the ICData and check it when recreating the flow graph in | 710 // tag in the ICData and check it when recreating the flow graph in |
711 // optimizing compiler. Enable it for other modes (product, release) if needed | 711 // optimizing compiler. Enable it for other modes (product, release) if needed |
712 // for debugging. | 712 // for debugging. |
713 #if defined(DEBUG) | 713 #if defined(DEBUG) |
714 #define TAG_IC_DATA | 714 #define TAG_IC_DATA |
715 #endif | 715 #endif |
716 | 716 |
717 } // namespace dart | 717 } // namespace dart |
718 | 718 |
719 #endif // RUNTIME_PLATFORM_GLOBALS_H_ | 719 #endif // RUNTIME_PLATFORM_GLOBALS_H_ |
OLD | NEW |