| 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 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include <float.h> | 32 #include <float.h> |
| 33 #include <limits.h> | 33 #include <limits.h> |
| 34 #include <math.h> | 34 #include <math.h> |
| 35 #include <openssl/bn.h> | 35 #include <openssl/bn.h> |
| 36 #include <stdarg.h> | 36 #include <stdarg.h> |
| 37 #include <stddef.h> | 37 #include <stddef.h> |
| 38 #include <stdio.h> | 38 #include <stdio.h> |
| 39 #include <stdlib.h> | 39 #include <stdlib.h> |
| 40 #include <string.h> | 40 #include <string.h> |
| 41 #include <sys/types.h> | 41 #include <sys/types.h> |
| 42 #include <unistd.h> |
| 42 | 43 |
| 43 #if defined(_WIN32) | 44 #if defined(_WIN32) |
| 44 #include "platform/c99_support_win.h" | 45 #include "platform/c99_support_win.h" |
| 45 #include "platform/inttypes_support_win.h" | 46 #include "platform/inttypes_support_win.h" |
| 46 #endif | 47 #endif |
| 47 | 48 |
| 48 | 49 |
| 49 // Target OS detection. | 50 // Target OS detection. |
| 50 // for more information on predefined macros: | 51 // for more information on predefined macros: |
| 51 // - http://msdn.microsoft.com/en-us/library/b0084kay.aspx | 52 // - http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 static inline void USE(T) { } | 96 static inline void USE(T) { } |
| 96 | 97 |
| 97 | 98 |
| 98 // On Windows the reentrent version of strtok is called | 99 // On Windows the reentrent version of strtok is called |
| 99 // strtok_s. Unify on the posix name strtok_r. | 100 // strtok_s. Unify on the posix name strtok_r. |
| 100 #if defined(TARGET_OS_WINDOWS) | 101 #if defined(TARGET_OS_WINDOWS) |
| 101 #define snprintf _snprintf | 102 #define snprintf _snprintf |
| 102 #define strtok_r strtok_s | 103 #define strtok_r strtok_s |
| 103 #endif | 104 #endif |
| 104 | 105 |
| 106 #if !defined(TARGET_OS_WINDOWS) && !defined(TEMP_FAILURE_RETRY) |
| 107 // TEMP_FAILURE_RETRY is defined in unistd.h on some platforms. The |
| 108 // definition below is copied from Linux and adapted to avoid lint |
| 109 // errors (type long int changed to int64_t and do/while split on |
| 110 // separate lines with body in {}s). |
| 111 # define TEMP_FAILURE_RETRY(expression) \ |
| 112 ({ int64_t __result; \ |
| 113 do { \ |
| 114 __result = (int64_t) (expression); \ |
| 115 } while (__result == -1L && errno == EINTR); \ |
| 116 __result; }) |
| 117 #endif |
| 118 |
| 105 #endif // PLATFORM_GLOBALS_H_ | 119 #endif // PLATFORM_GLOBALS_H_ |
| OLD | NEW |