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