OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_BASE_COMPILER_SPECIFIC_H_ | 5 #ifndef V8_BASE_COMPILER_SPECIFIC_H_ |
6 #define V8_BASE_COMPILER_SPECIFIC_H_ | 6 #define V8_BASE_COMPILER_SPECIFIC_H_ |
7 | 7 |
8 #include "include/v8config.h" | 8 #include "include/v8config.h" |
9 | 9 |
10 // Annotate a variable indicating it's ok if the variable is not used. | 10 // Annotate a typedef or function indicating it's ok if it's not used. |
11 // (Typically used to silence a compiler warning when the assignment | |
12 // is important for some other reason.) | |
13 // Use like: | 11 // Use like: |
14 // int x ALLOW_UNUSED = ...; | 12 // typedef Foo Bar ALLOW_UNUSED_TYPE; |
15 #if V8_HAS_ATTRIBUTE_UNUSED | 13 #if V8_HAS_ATTRIBUTE_UNUSED |
16 #define ALLOW_UNUSED __attribute__((unused)) | 14 #define ALLOW_UNUSED_TYPE __attribute__((unused)) |
17 #else | 15 #else |
18 #define ALLOW_UNUSED | 16 #define ALLOW_UNUSED_TYPE |
19 #endif | 17 #endif |
20 | 18 |
21 | 19 |
22 // Annotate a virtual method indicating it must be overriding a virtual | 20 // Annotate a virtual method indicating it must be overriding a virtual |
23 // method in the parent class. | 21 // method in the parent class. |
24 // Use like: | 22 // Use like: |
25 // virtual void bar() OVERRIDE; | 23 // virtual void bar() OVERRIDE; |
26 #if V8_HAS_CXX11_OVERRIDE | 24 #if V8_HAS_CXX11_OVERRIDE |
27 #define OVERRIDE override | 25 #define OVERRIDE override |
28 #else | 26 #else |
(...skipping 20 matching lines...) Expand all Loading... |
49 // Annotate a function indicating the caller must examine the return value. | 47 // Annotate a function indicating the caller must examine the return value. |
50 // Use like: | 48 // Use like: |
51 // int foo() WARN_UNUSED_RESULT; | 49 // int foo() WARN_UNUSED_RESULT; |
52 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT | 50 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT |
53 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) | 51 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) |
54 #else | 52 #else |
55 #define WARN_UNUSED_RESULT /* NOT SUPPORTED */ | 53 #define WARN_UNUSED_RESULT /* NOT SUPPORTED */ |
56 #endif | 54 #endif |
57 | 55 |
58 #endif // V8_BASE_COMPILER_SPECIFIC_H_ | 56 #endif // V8_BASE_COMPILER_SPECIFIC_H_ |
OLD | NEW |