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 to enable platform independent printf. |
9 #ifndef __STDC_FORMAT_MACROS | 9 #ifndef __STDC_FORMAT_MACROS |
10 #define __STDC_FORMAT_MACROS | 10 #define __STDC_FORMAT_MACROS |
11 #endif | 11 #endif |
12 | 12 |
13 #if defined(_WIN32) | 13 #if defined(_WIN32) |
14 // 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. |
15 #define WIN32_LEAN_AND_MEAN | 15 #define WIN32_LEAN_AND_MEAN |
16 #define NOMINMAX | 16 #define NOMINMAX |
17 #define NOKERNEL | 17 #define NOKERNEL |
18 #define NOUSER | 18 #define NOUSER |
19 #define NOSERVICE | 19 #define NOSERVICE |
20 #define NOSOUND | 20 #define NOSOUND |
21 #define NOMCX | 21 #define NOMCX |
22 | 22 |
23 #include <windows.h> | 23 #include <windows.h> |
| 24 #include <winsock2.h> |
24 #include <Rpc.h> | 25 #include <Rpc.h> |
25 #endif | 26 #endif |
26 | 27 |
27 #if !defined(_WIN32) | 28 #if !defined(_WIN32) |
| 29 #include <arpa/inet.h> |
28 #include <inttypes.h> | 30 #include <inttypes.h> |
29 #include <stdint.h> | 31 #include <stdint.h> |
30 #include <unistd.h> | 32 #include <unistd.h> |
31 #endif | 33 #endif |
32 | 34 |
33 #include <float.h> | 35 #include <float.h> |
34 #include <limits.h> | 36 #include <limits.h> |
35 #include <math.h> | 37 #include <math.h> |
36 #include <stdarg.h> | 38 #include <stdarg.h> |
37 #include <stddef.h> | 39 #include <stddef.h> |
38 #include <stdio.h> | 40 #include <stdio.h> |
39 #include <stdlib.h> | 41 #include <stdlib.h> |
40 #include <string.h> | 42 #include <string.h> |
41 #include <sys/types.h> | 43 #include <sys/types.h> |
42 #include <cstdlib> | |
43 #include <sstream> | |
44 | 44 |
45 #if defined(_WIN32) | 45 #if defined(_WIN32) |
46 #include "platform/c99_support_win.h" | 46 #include "platform/c99_support_win.h" |
47 #include "platform/inttypes_support_win.h" | 47 #include "platform/inttypes_support_win.h" |
48 #endif | 48 #endif |
49 | 49 |
50 // Target OS detection. | 50 // Target OS detection. |
51 // for more information on predefined macros: | 51 // for more information on predefined macros: |
52 // - http://msdn.microsoft.com/en-us/library/b0084kay.aspx | 52 // - http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
53 // - with gcc, run: "echo | gcc -E -dM -" | 53 // - with gcc, run: "echo | gcc -E -dM -" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 199 |
200 | 200 |
201 // Macro to disallow allocation in the C++ heap. This should be used | 201 // Macro to disallow allocation in the C++ heap. This should be used |
202 // in the private section for a class. Don't use UNREACHABLE here to | 202 // in the private section for a class. Don't use UNREACHABLE here to |
203 // avoid circular dependencies between platform/globals.h and | 203 // avoid circular dependencies between platform/globals.h and |
204 // platform/assert.h. | 204 // platform/assert.h. |
205 #define DISALLOW_ALLOCATION() \ | 205 #define DISALLOW_ALLOCATION() \ |
206 public: \ | 206 public: \ |
207 void operator delete(void* pointer) { \ | 207 void operator delete(void* pointer) { \ |
208 fprintf(stderr, "unreachable code\n"); \ | 208 fprintf(stderr, "unreachable code\n"); \ |
209 std::abort(); \ | 209 abort(); \ |
210 } \ | 210 } \ |
211 private: \ | 211 private: \ |
212 void* operator new(size_t size); | 212 void* operator new(size_t size); |
213 | 213 |
214 | 214 |
215 // The USE(x) template is used to silence C++ compiler warnings issued | 215 // The USE(x) template is used to silence C++ compiler warnings issued |
216 // for unused variables. | 216 // for unused variables. |
217 template <typename T> | 217 template <typename T> |
218 static inline void USE(T) { } | 218 static inline void USE(T) { } |
219 | 219 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 // separate lines with body in {}s). | 337 // separate lines with body in {}s). |
338 # define TEMP_FAILURE_RETRY(expression) \ | 338 # define TEMP_FAILURE_RETRY(expression) \ |
339 ({ int64_t __result; \ | 339 ({ int64_t __result; \ |
340 do { \ | 340 do { \ |
341 __result = (int64_t) (expression); \ | 341 __result = (int64_t) (expression); \ |
342 } while (__result == -1L && errno == EINTR); \ | 342 } while (__result == -1L && errno == EINTR); \ |
343 __result; }) | 343 __result; }) |
344 #endif | 344 #endif |
345 | 345 |
346 #endif // PLATFORM_GLOBALS_H_ | 346 #endif // PLATFORM_GLOBALS_H_ |
OLD | NEW |