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 to enable platform independent printf. |
9 // enable platform independent printf format specifiers. | |
10 #ifndef __STDC_FORMAT_MACROS | 9 #ifndef __STDC_FORMAT_MACROS |
11 #define __STDC_FORMAT_MACROS | 10 #define __STDC_FORMAT_MACROS |
12 #endif | 11 #endif |
13 | 12 |
14 #if defined(_WIN32) | 13 #if defined(_WIN32) |
15 // Cut down on the amount of stuff that gets included via windows.h. | 14 // Cut down on the amount of stuff that gets included via windows.h. |
16 #define WIN32_LEAN_AND_MEAN | 15 #define WIN32_LEAN_AND_MEAN |
17 #define NOMINMAX | 16 #define NOMINMAX |
18 #define NOKERNEL | 17 #define NOKERNEL |
19 #define NOUSER | 18 #define NOUSER |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 #if !defined(ARCH_IS_64_BIT) | 101 #if !defined(ARCH_IS_64_BIT) |
103 #error Mismatched Host/Target architectures. | 102 #error Mismatched Host/Target architectures. |
104 #endif | 103 #endif |
105 #elif defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_ARM) | 104 #elif defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_ARM) |
106 #if !defined(ARCH_IS_32_BIT) | 105 #if !defined(ARCH_IS_32_BIT) |
107 #error Mismatched Host/Target architectures. | 106 #error Mismatched Host/Target architectures. |
108 #endif | 107 #endif |
109 #endif | 108 #endif |
110 | 109 |
111 | 110 |
112 // Printf format specifiers for intptr_t on Windows. | 111 // Printf format for intptr_t on Windows. |
113 #if defined(TARGET_OS_WINDOWS) | 112 #if !defined(PRIxPTR) && defined(TARGET_OS_WINDOWS) |
114 #if defined(ARCH_IS_32_BIT) | 113 #if defined(ARCH_IS_32_BIT) |
115 #define DART_PRINTF_PTR_PREFIX "" | 114 #define PRIxPTR "x" |
116 #else | 115 #else |
117 #define DART_PRINTF_PTR_PREFIX "ll" | 116 #define PRIxPTR "llx" |
118 #endif | 117 #endif // defined(ARCH_IS_32_BIT) |
119 | 118 #endif // !defined(PRIxPTR) && defined(TARGET_OS_WINDOWS) |
120 #if !defined(PRIdPTR) | |
121 #define PRIdPTR DART_PRINTF_PTR_PREFIX "d" | |
122 #endif | |
123 | |
124 #if !defined(PRIxPTR) | |
125 #define PRIxPTR DART_PRINTF_PTR_PREFIX "x" | |
126 #endif | |
127 | |
128 #undef DART_PRINTF_PTR_PREFIX | |
129 #endif // defined(TARGET_OS_WINDOWS) | |
130 | 119 |
131 | 120 |
132 // Suffixes for 64-bit integer literals. | 121 // Suffixes for 64-bit integer literals. |
133 #ifdef _MSC_VER | 122 #ifdef _MSC_VER |
134 #define DART_INT64_C(x) x##I64 | 123 #define DART_INT64_C(x) x##I64 |
135 #define DART_UINT64_C(x) x##UI64 | 124 #define DART_UINT64_C(x) x##UI64 |
136 #else | 125 #else |
137 #define DART_INT64_C(x) x##LL | 126 #define DART_INT64_C(x) x##LL |
138 #define DART_UINT64_C(x) x##ULL | 127 #define DART_UINT64_C(x) x##ULL |
139 #endif | 128 #endif |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 // separate lines with body in {}s). | 339 // separate lines with body in {}s). |
351 # define TEMP_FAILURE_RETRY(expression) \ | 340 # define TEMP_FAILURE_RETRY(expression) \ |
352 ({ int64_t __result; \ | 341 ({ int64_t __result; \ |
353 do { \ | 342 do { \ |
354 __result = (int64_t) (expression); \ | 343 __result = (int64_t) (expression); \ |
355 } while (__result == -1L && errno == EINTR); \ | 344 } while (__result == -1L && errno == EINTR); \ |
356 __result; }) | 345 __result; }) |
357 #endif | 346 #endif |
358 | 347 |
359 #endif // PLATFORM_GLOBALS_H_ | 348 #endif // PLATFORM_GLOBALS_H_ |
OLD | NEW |