| 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 before including <inttypes.h> to |
| 9 // enable platform independent printf format specifiers. | 9 // enable platform independent printf format specifiers. |
| 10 #ifndef __STDC_FORMAT_MACROS | 10 #ifndef __STDC_FORMAT_MACROS |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 #if !defined(TARGET_OS_WINDOWS) | 474 #if !defined(TARGET_OS_WINDOWS) |
| 475 #if !defined(TEMP_FAILURE_RETRY) | 475 #if !defined(TEMP_FAILURE_RETRY) |
| 476 // TEMP_FAILURE_RETRY is defined in unistd.h on some platforms. The | 476 // TEMP_FAILURE_RETRY is defined in unistd.h on some platforms. The |
| 477 // definition below is copied from Linux and adapted to avoid lint | 477 // definition below is copied from Linux and adapted to avoid lint |
| 478 // errors (type long int changed to intptr_t and do/while split on | 478 // errors (type long int changed to intptr_t and do/while split on |
| 479 // separate lines with body in {}s). | 479 // separate lines with body in {}s). |
| 480 #define TEMP_FAILURE_RETRY(expression) \ | 480 #define TEMP_FAILURE_RETRY(expression) \ |
| 481 ({ intptr_t __result; \ | 481 ({ intptr_t __result; \ |
| 482 do { \ | 482 do { \ |
| 483 __result = (expression); \ | 483 __result = (expression); \ |
| 484 } while (__result == -1L && errno == EINTR); \ | 484 } while ((__result == -1L) && (errno == EINTR)); \ |
| 485 __result; }) | 485 __result; }) |
| 486 #endif // !defined(TEMP_FAILURE_RETRY) | 486 #endif // !defined(TEMP_FAILURE_RETRY) |
| 487 | 487 |
| 488 // This is a version of TEMP_FAILURE_RETRY which does not use the value | 488 // This is a version of TEMP_FAILURE_RETRY which does not use the value |
| 489 // returned from the expression. | 489 // returned from the expression. |
| 490 #define VOID_TEMP_FAILURE_RETRY(expression) \ | 490 #define VOID_TEMP_FAILURE_RETRY(expression) \ |
| 491 (static_cast<void>(TEMP_FAILURE_RETRY(expression))) | 491 (static_cast<void>(TEMP_FAILURE_RETRY(expression))) |
| 492 | 492 |
| 493 #endif // !defined(TARGET_OS_WINDOWS) | 493 #endif // !defined(TARGET_OS_WINDOWS) |
| 494 | 494 |
| 495 #if defined(TARGET_OS_LINUX) || defined(TARGET_OS_MACOS) | 495 #if defined(TARGET_OS_LINUX) || defined(TARGET_OS_MACOS) |
| 496 // Tell the compiler to do printf format string checking if the | 496 // Tell the compiler to do printf format string checking if the |
| 497 // compiler supports it; see the 'format' attribute in | 497 // compiler supports it; see the 'format' attribute in |
| 498 // <http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Function-Attributes.html>. | 498 // <http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Function-Attributes.html>. |
| 499 // | 499 // |
| 500 // N.B.: As the GCC manual states, "[s]ince non-static C++ methods | 500 // N.B.: As the GCC manual states, "[s]ince non-static C++ methods |
| 501 // have an implicit 'this' argument, the arguments of such methods | 501 // have an implicit 'this' argument, the arguments of such methods |
| 502 // should be counted from two, not one." | 502 // should be counted from two, not one." |
| 503 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ | 503 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ |
| 504 __attribute__((__format__(__printf__, string_index, first_to_check))) | 504 __attribute__((__format__(__printf__, string_index, first_to_check))) |
| 505 #else | 505 #else |
| 506 #define PRINTF_ATTRIBUTE(string_index, first_to_check) | 506 #define PRINTF_ATTRIBUTE(string_index, first_to_check) |
| 507 #endif | 507 #endif |
| 508 | 508 |
| 509 #endif // PLATFORM_GLOBALS_H_ | 509 #endif // PLATFORM_GLOBALS_H_ |
| OLD | NEW |