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 PLATFORM_GLOBALS_H_ | 5 #ifndef PLATFORM_GLOBALS_H_ |
6 #define PLATFORM_GLOBALS_H_ | 6 #define 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // or with gcc, run: "echo | gcc -E -dM -" | 78 // or with gcc, run: "echo | gcc -E -dM -" |
79 #if defined(_M_X64) || defined(__x86_64__) | 79 #if defined(_M_X64) || defined(__x86_64__) |
80 #define HOST_ARCH_X64 1 | 80 #define HOST_ARCH_X64 1 |
81 #define ARCH_IS_64_BIT 1 | 81 #define ARCH_IS_64_BIT 1 |
82 #elif defined(_M_IX86) || defined(__i386__) | 82 #elif defined(_M_IX86) || defined(__i386__) |
83 #define HOST_ARCH_IA32 1 | 83 #define HOST_ARCH_IA32 1 |
84 #define ARCH_IS_32_BIT 1 | 84 #define ARCH_IS_32_BIT 1 |
85 #elif defined(__ARMEL__) | 85 #elif defined(__ARMEL__) |
86 #define HOST_ARCH_ARM 1 | 86 #define HOST_ARCH_ARM 1 |
87 #define ARCH_IS_32_BIT 1 | 87 #define ARCH_IS_32_BIT 1 |
| 88 #elif defined(__MIPSEL__) |
| 89 #define HOST_ARCH_MIPS 1 |
| 90 #define ARCH_IS_32_BIT 1 |
88 #else | 91 #else |
89 #error Architecture was not detected as supported by Dart. | 92 #error Architecture was not detected as supported by Dart. |
90 #endif | 93 #endif |
91 | 94 |
| 95 #if !defined(TARGET_ARCH_MIPS) |
92 #if !defined(TARGET_ARCH_ARM) | 96 #if !defined(TARGET_ARCH_ARM) |
93 #if !defined(TARGET_ARCH_X64) | 97 #if !defined(TARGET_ARCH_X64) |
94 #if !defined(TARGET_ARCH_IA32) | 98 #if !defined(TARGET_ARCH_IA32) |
95 // No target architecture specified pick the one matching the host architecture. | 99 // No target architecture specified pick the one matching the host architecture. |
96 #if defined(HOST_ARCH_ARM) | 100 #if defined(HOST_ARCH_MIPS) |
| 101 #define TARGET_ARCH_MIPS 1 |
| 102 #elif defined(HOST_ARCH_ARM) |
97 #define TARGET_ARCH_ARM 1 | 103 #define TARGET_ARCH_ARM 1 |
98 #elif defined(HOST_ARCH_X64) | 104 #elif defined(HOST_ARCH_X64) |
99 #define TARGET_ARCH_X64 1 | 105 #define TARGET_ARCH_X64 1 |
100 #elif defined(HOST_ARCH_IA32) | 106 #elif defined(HOST_ARCH_IA32) |
101 #define TARGET_ARCH_IA32 1 | 107 #define TARGET_ARCH_IA32 1 |
102 #else | 108 #else |
103 #error Automatic target architecture detection failed. | 109 #error Automatic target architecture detection failed. |
104 #endif | 110 #endif |
105 #endif | 111 #endif |
106 #endif | 112 #endif |
107 #endif | 113 #endif |
| 114 #endif |
108 | 115 |
109 // Verify that host and target architectures match, we cannot | 116 // Verify that host and target architectures match, we cannot |
110 // have a 64 bit Dart VM generating 32 bit code or vice-versa. | 117 // have a 64 bit Dart VM generating 32 bit code or vice-versa. |
111 #if defined(TARGET_ARCH_X64) | 118 #if defined(TARGET_ARCH_X64) |
112 #if !defined(ARCH_IS_64_BIT) | 119 #if !defined(ARCH_IS_64_BIT) |
113 #error Mismatched Host/Target architectures. | 120 #error Mismatched Host/Target architectures. |
114 #endif | 121 #endif |
115 #elif defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_ARM) | 122 #elif defined(TARGET_ARCH_IA32) || \ |
| 123 defined(TARGET_ARCH_ARM) || \ |
| 124 defined(TARGET_ARCH_MIPS) |
116 #if !defined(ARCH_IS_32_BIT) | 125 #if !defined(ARCH_IS_32_BIT) |
117 #error Mismatched Host/Target architectures. | 126 #error Mismatched Host/Target architectures. |
118 #endif | 127 #endif |
119 #endif | 128 #endif |
120 | 129 |
121 | 130 |
122 // Short form printf format specifiers | 131 // Short form printf format specifiers |
123 #define Pd PRIdPTR | 132 #define Pd PRIdPTR |
124 #define Pu PRIuPTR | 133 #define Pu PRIuPTR |
125 #define Px PRIxPTR | 134 #define Px PRIxPTR |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 // have an implicit 'this' argument, the arguments of such methods | 382 // have an implicit 'this' argument, the arguments of such methods |
374 // should be counted from two, not one." | 383 // should be counted from two, not one." |
375 // | 384 // |
376 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ | 385 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ |
377 __attribute__((__format__(__printf__, string_index, first_to_check))) | 386 __attribute__((__format__(__printf__, string_index, first_to_check))) |
378 #else | 387 #else |
379 #define PRINTF_ATTRIBUTE(string_index, first_to_check) | 388 #define PRINTF_ATTRIBUTE(string_index, first_to_check) |
380 #endif | 389 #endif |
381 | 390 |
382 #endif // PLATFORM_GLOBALS_H_ | 391 #endif // PLATFORM_GLOBALS_H_ |
OLD | NEW |