Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: runtime/platform/globals.h

Issue 165723007: Move signal_blocker to platform and use it by default in TEMP_FAILURE_RETRY. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 465
466 466
467 // On Windows the reentrent version of strtok is called 467 // On Windows the reentrent version of strtok is called
468 // strtok_s. Unify on the posix name strtok_r. 468 // strtok_s. Unify on the posix name strtok_r.
469 #if defined(TARGET_OS_WINDOWS) 469 #if defined(TARGET_OS_WINDOWS)
470 #define snprintf _snprintf 470 #define snprintf _snprintf
471 #define strtok_r strtok_s 471 #define strtok_r strtok_s
472 #endif 472 #endif
473 473
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. We should
477 // definition below is copied from Linux and adapted to avoid lint 477 // not use that version, but instead the one in signal_blocker.h, to ensure
478 // errors (type long int changed to intptr_t and do/while split on 478 // we disable signal interrupts.
479 // separate lines with body in {}s). 479 #undef TEMP_FAILURE_RETRY
480 #define TEMP_FAILURE_RETRY(expression) \ 480 #endif // defined(TEMP_FAILURE_RETRY)
481 ({ intptr_t __result; \
482 do { \
483 __result = (expression); \
484 } while ((__result == -1L) && (errno == EINTR)); \
485 __result; })
486 #endif // !defined(TEMP_FAILURE_RETRY)
487
488 // This is a version of TEMP_FAILURE_RETRY which does not use the value
489 // returned from the expression.
490 #define VOID_TEMP_FAILURE_RETRY(expression) \
491 (static_cast<void>(TEMP_FAILURE_RETRY(expression)))
492
493 #endif // !defined(TARGET_OS_WINDOWS) 481 #endif // !defined(TARGET_OS_WINDOWS)
494 482
495 #if defined(TARGET_OS_LINUX) || defined(TARGET_OS_MACOS) 483 #if defined(TARGET_OS_LINUX) || defined(TARGET_OS_MACOS)
496 // Tell the compiler to do printf format string checking if the 484 // Tell the compiler to do printf format string checking if the
497 // compiler supports it; see the 'format' attribute in 485 // compiler supports it; see the 'format' attribute in
498 // <http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Function-Attributes.html>. 486 // <http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Function-Attributes.html>.
499 // 487 //
500 // N.B.: As the GCC manual states, "[s]ince non-static C++ methods 488 // N.B.: As the GCC manual states, "[s]ince non-static C++ methods
501 // have an implicit 'this' argument, the arguments of such methods 489 // have an implicit 'this' argument, the arguments of such methods
502 // should be counted from two, not one." 490 // should be counted from two, not one."
503 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \ 491 #define PRINTF_ATTRIBUTE(string_index, first_to_check) \
504 __attribute__((__format__(__printf__, string_index, first_to_check))) 492 __attribute__((__format__(__printf__, string_index, first_to_check)))
505 #else 493 #else
506 #define PRINTF_ATTRIBUTE(string_index, first_to_check) 494 #define PRINTF_ATTRIBUTE(string_index, first_to_check)
507 #endif 495 #endif
508 496
509 #endif // PLATFORM_GLOBALS_H_ 497 #endif // PLATFORM_GLOBALS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698