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) |
Kevin Millikin (Google)
2012/08/02 14:57:27
PRIdPTR was not defined here before. PRIdPTR shou
| |
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 #undef DART_PRINTF_PTR_PREFIX | |
129 #endif // defined(TARGET_OS_WINDOWS) | |
119 | 130 |
120 | 131 |
121 // Suffixes for 64-bit integer literals. | 132 // Suffixes for 64-bit integer literals. |
122 #ifdef _MSC_VER | 133 #ifdef _MSC_VER |
123 #define DART_INT64_C(x) x##I64 | 134 #define DART_INT64_C(x) x##I64 |
124 #define DART_UINT64_C(x) x##UI64 | 135 #define DART_UINT64_C(x) x##UI64 |
125 #else | 136 #else |
126 #define DART_INT64_C(x) x##LL | 137 #define DART_INT64_C(x) x##LL |
127 #define DART_UINT64_C(x) x##ULL | 138 #define DART_UINT64_C(x) x##ULL |
128 #endif | 139 #endif |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
339 // separate lines with body in {}s). | 350 // separate lines with body in {}s). |
340 # define TEMP_FAILURE_RETRY(expression) \ | 351 # define TEMP_FAILURE_RETRY(expression) \ |
341 ({ int64_t __result; \ | 352 ({ int64_t __result; \ |
342 do { \ | 353 do { \ |
343 __result = (int64_t) (expression); \ | 354 __result = (int64_t) (expression); \ |
344 } while (__result == -1L && errno == EINTR); \ | 355 } while (__result == -1L && errno == EINTR); \ |
345 __result; }) | 356 __result; }) |
346 #endif | 357 #endif |
347 | 358 |
348 #endif // PLATFORM_GLOBALS_H_ | 359 #endif // PLATFORM_GLOBALS_H_ |
OLD | NEW |