| 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 RUNTIME_PLATFORM_GLOBALS_H_ | 5 #ifndef RUNTIME_PLATFORM_GLOBALS_H_ |
| 6 #define RUNTIME_PLATFORM_GLOBALS_H_ | 6 #define RUNTIME_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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 #endif | 281 #endif |
| 282 | 282 |
| 283 // DART_UNUSED inidicates to the compiler that a variable/typedef is expected | 283 // DART_UNUSED inidicates to the compiler that a variable/typedef is expected |
| 284 // to be unused and disables the related warning. | 284 // to be unused and disables the related warning. |
| 285 #ifdef __GNUC__ | 285 #ifdef __GNUC__ |
| 286 #define DART_UNUSED __attribute__((unused)) | 286 #define DART_UNUSED __attribute__((unused)) |
| 287 #else | 287 #else |
| 288 #define DART_UNUSED | 288 #define DART_UNUSED |
| 289 #endif | 289 #endif |
| 290 | 290 |
| 291 // DART_NORETURN indicates to the compiler that a function doees not return. | 291 // DART_NORETURN indicates to the compiler that a function does not return. |
| 292 // It should be used on functions that unconditionally call functions like | 292 // It should be used on functions that unconditionally call functions like |
| 293 // exit(), which end the program. We use it to avoid compiler warnings in | 293 // exit(), which end the program. We use it to avoid compiler warnings in |
| 294 // callers of DART_NORETURN functions. | 294 // callers of DART_NORETURN functions. |
| 295 #ifdef _MSC_VER | 295 #ifdef _MSC_VER |
| 296 #define DART_NORETURN __declspec(noreturn) | 296 #define DART_NORETURN __declspec(noreturn) |
| 297 #elif __GNUC__ | 297 #elif __GNUC__ |
| 298 #define DART_NORETURN __attribute__((noreturn)) | 298 #define DART_NORETURN __attribute__((noreturn)) |
| 299 #else | 299 #else |
| 300 #error Automatic compiler detection failed. | 300 #error Automatic compiler detection failed. |
| 301 #endif | 301 #endif |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 static inline void USE(T) {} | 572 static inline void USE(T) {} |
| 573 | 573 |
| 574 | 574 |
| 575 // Use implicit_cast as a safe version of static_cast or const_cast | 575 // Use implicit_cast as a safe version of static_cast or const_cast |
| 576 // for upcasting in the type hierarchy (i.e. casting a pointer to Foo | 576 // for upcasting in the type hierarchy (i.e. casting a pointer to Foo |
| 577 // to a pointer to SuperclassOfFoo or casting a pointer to Foo to | 577 // to a pointer to SuperclassOfFoo or casting a pointer to Foo to |
| 578 // a const pointer to Foo). | 578 // a const pointer to Foo). |
| 579 // When you use implicit_cast, the compiler checks that the cast is safe. | 579 // When you use implicit_cast, the compiler checks that the cast is safe. |
| 580 // Such explicit implicit_casts are necessary in surprisingly many | 580 // Such explicit implicit_casts are necessary in surprisingly many |
| 581 // situations where C++ demands an exact type match instead of an | 581 // situations where C++ demands an exact type match instead of an |
| 582 // argument type convertable to a target type. | 582 // argument type convertible to a target type. |
| 583 // | 583 // |
| 584 // The From type can be inferred, so the preferred syntax for using | 584 // The From type can be inferred, so the preferred syntax for using |
| 585 // implicit_cast is the same as for static_cast etc.: | 585 // implicit_cast is the same as for static_cast etc.: |
| 586 // | 586 // |
| 587 // implicit_cast<ToType>(expr) | 587 // implicit_cast<ToType>(expr) |
| 588 // | 588 // |
| 589 // implicit_cast would have been part of the C++ standard library, | 589 // implicit_cast would have been part of the C++ standard library, |
| 590 // but the proposal was submitted too late. It will probably make | 590 // but the proposal was submitted too late. It will probably make |
| 591 // its way into the language in the future. | 591 // its way into the language in the future. |
| 592 template <typename To, typename From> | 592 template <typename To, typename From> |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 // tag in the ICData and check it when recreating the flow graph in | 710 // tag in the ICData and check it when recreating the flow graph in |
| 711 // optimizing compiler. Enable it for other modes (product, release) if needed | 711 // optimizing compiler. Enable it for other modes (product, release) if needed |
| 712 // for debugging. | 712 // for debugging. |
| 713 #if defined(DEBUG) | 713 #if defined(DEBUG) |
| 714 #define TAG_IC_DATA | 714 #define TAG_IC_DATA |
| 715 #endif | 715 #endif |
| 716 | 716 |
| 717 } // namespace dart | 717 } // namespace dart |
| 718 | 718 |
| 719 #endif // RUNTIME_PLATFORM_GLOBALS_H_ | 719 #endif // RUNTIME_PLATFORM_GLOBALS_H_ |
| OLD | NEW |