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 typedef or function indicating it's ok if it's not used. | 10 // Annotate a typedef or function indicating it's ok if it's not used. |
11 // Use like: | 11 // Use like: |
12 // typedef Foo Bar ALLOW_UNUSED_TYPE; | 12 // typedef Foo Bar ALLOW_UNUSED_TYPE; |
13 #if V8_HAS_ATTRIBUTE_UNUSED | 13 #if V8_HAS_ATTRIBUTE_UNUSED |
14 #define ALLOW_UNUSED_TYPE __attribute__((unused)) | 14 #define ALLOW_UNUSED_TYPE __attribute__((unused)) |
15 #else | 15 #else |
16 #define ALLOW_UNUSED_TYPE | 16 #define ALLOW_UNUSED_TYPE |
17 #endif | 17 #endif |
18 | 18 |
19 | 19 |
20 // Annotate a virtual method indicating it must be overriding a virtual | |
21 // method in the parent class. | |
22 // Use like: | |
23 // virtual void bar() OVERRIDE; | |
24 #if V8_HAS_CXX11_OVERRIDE | |
25 #define OVERRIDE override | |
26 #else | |
27 #define OVERRIDE /* NOT SUPPORTED */ | |
28 #endif | |
29 | |
30 | |
31 // Annotate a virtual method indicating that subclasses must not override it, | |
32 // or annotate a class to indicate that it cannot be subclassed. | |
33 // Use like: | |
34 // class B FINAL : public A {}; | |
35 // virtual void bar() FINAL; | |
36 #if V8_HAS_CXX11_FINAL | |
37 #define FINAL final | |
38 #elif V8_HAS___FINAL | |
39 #define FINAL __final | |
40 #else | |
41 #define FINAL /* NOT SUPPORTED */ | |
42 #endif | |
43 | |
44 | |
45 // Annotate a function indicating the caller must examine the return value. | 20 // Annotate a function indicating the caller must examine the return value. |
46 // Use like: | 21 // Use like: |
47 // int foo() WARN_UNUSED_RESULT; | 22 // int foo() WARN_UNUSED_RESULT; |
48 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT | 23 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT |
49 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) | 24 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) |
50 #else | 25 #else |
51 #define WARN_UNUSED_RESULT /* NOT SUPPORTED */ | 26 #define WARN_UNUSED_RESULT /* NOT SUPPORTED */ |
52 #endif | 27 #endif |
53 | 28 |
54 | 29 |
(...skipping 13 matching lines...) Expand all Loading... |
68 // | 43 // |
69 // In .cc file: | 44 // In .cc file: |
70 // STATIC_CONST_MEMBER_DEFINITION const int Foo::kBar; | 45 // STATIC_CONST_MEMBER_DEFINITION const int Foo::kBar; |
71 #if V8_HAS_DECLSPEC_SELECTANY | 46 #if V8_HAS_DECLSPEC_SELECTANY |
72 #define STATIC_CONST_MEMBER_DEFINITION __declspec(selectany) | 47 #define STATIC_CONST_MEMBER_DEFINITION __declspec(selectany) |
73 #else | 48 #else |
74 #define STATIC_CONST_MEMBER_DEFINITION | 49 #define STATIC_CONST_MEMBER_DEFINITION |
75 #endif | 50 #endif |
76 | 51 |
77 #endif // V8_BASE_COMPILER_SPECIFIC_H_ | 52 #endif // V8_BASE_COMPILER_SPECIFIC_H_ |
OLD | NEW |