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_FLAGS_H_ | 5 #ifndef V8_BASE_FLAGS_H_ |
6 #define V8_BASE_FLAGS_H_ | 6 #define V8_BASE_FLAGS_H_ |
7 | 7 |
8 #include "src/base/compiler-specific.h" | 8 #include "src/base/compiler-specific.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 operator mask_type() const { return mask_; } | 59 operator mask_type() const { return mask_; } |
60 bool operator!() const { return !mask_; } | 60 bool operator!() const { return !mask_; } |
61 | 61 |
62 private: | 62 private: |
63 mask_type mask_; | 63 mask_type mask_; |
64 }; | 64 }; |
65 | 65 |
66 | 66 |
67 #define DEFINE_OPERATORS_FOR_FLAGS(Type) \ | 67 #define DEFINE_OPERATORS_FOR_FLAGS(Type) \ |
68 inline Type operator&(Type::flag_type lhs, \ | 68 inline Type operator&(Type::flag_type lhs, Type::flag_type rhs) \ |
69 Type::flag_type rhs)ALLOW_UNUSED WARN_UNUSED_RESULT; \ | 69 ALLOW_UNUSED_TYPE WARN_UNUSED_RESULT; \ |
70 inline Type operator&(Type::flag_type lhs, Type::flag_type rhs) { \ | 70 inline Type operator&(Type::flag_type lhs, Type::flag_type rhs) { \ |
71 return Type(lhs) & rhs; \ | 71 return Type(lhs) & rhs; \ |
72 } \ | 72 } \ |
73 inline Type operator&(Type::flag_type lhs, \ | 73 inline Type operator&(Type::flag_type lhs, \ |
74 const Type& rhs)ALLOW_UNUSED WARN_UNUSED_RESULT; \ | 74 const Type& rhs) ALLOW_UNUSED_TYPE WARN_UNUSED_RESULT; \ |
75 inline Type operator&(Type::flag_type lhs, const Type& rhs) { \ | 75 inline Type operator&(Type::flag_type lhs, const Type& rhs) { \ |
76 return rhs & lhs; \ | 76 return rhs & lhs; \ |
77 } \ | 77 } \ |
78 inline void operator&(Type::flag_type lhs, Type::mask_type rhs)ALLOW_UNUSED; \ | 78 inline void operator&(Type::flag_type lhs, \ |
| 79 Type::mask_type rhs) ALLOW_UNUSED_TYPE; \ |
79 inline void operator&(Type::flag_type lhs, Type::mask_type rhs) {} \ | 80 inline void operator&(Type::flag_type lhs, Type::mask_type rhs) {} \ |
80 inline Type operator|(Type::flag_type lhs, Type::flag_type rhs) \ | 81 inline Type operator|(Type::flag_type lhs, Type::flag_type rhs) \ |
81 ALLOW_UNUSED WARN_UNUSED_RESULT; \ | 82 ALLOW_UNUSED_TYPE WARN_UNUSED_RESULT; \ |
82 inline Type operator|(Type::flag_type lhs, Type::flag_type rhs) { \ | 83 inline Type operator|(Type::flag_type lhs, Type::flag_type rhs) { \ |
83 return Type(lhs) | rhs; \ | 84 return Type(lhs) | rhs; \ |
84 } \ | 85 } \ |
85 inline Type operator|(Type::flag_type lhs, const Type& rhs) \ | 86 inline Type operator|(Type::flag_type lhs, const Type& rhs) \ |
86 ALLOW_UNUSED WARN_UNUSED_RESULT; \ | 87 ALLOW_UNUSED_TYPE WARN_UNUSED_RESULT; \ |
87 inline Type operator|(Type::flag_type lhs, const Type& rhs) { \ | 88 inline Type operator|(Type::flag_type lhs, const Type& rhs) { \ |
88 return rhs | lhs; \ | 89 return rhs | lhs; \ |
89 } \ | 90 } \ |
90 inline void operator|(Type::flag_type lhs, Type::mask_type rhs) \ | 91 inline void operator|(Type::flag_type lhs, \ |
91 ALLOW_UNUSED; \ | 92 Type::mask_type rhs) ALLOW_UNUSED_TYPE; \ |
92 inline void operator|(Type::flag_type lhs, Type::mask_type rhs) {} \ | 93 inline void operator|(Type::flag_type lhs, Type::mask_type rhs) {} \ |
93 inline Type operator^(Type::flag_type lhs, Type::flag_type rhs) \ | 94 inline Type operator^(Type::flag_type lhs, Type::flag_type rhs) \ |
94 ALLOW_UNUSED WARN_UNUSED_RESULT; \ | 95 ALLOW_UNUSED_TYPE WARN_UNUSED_RESULT; \ |
95 inline Type operator^(Type::flag_type lhs, Type::flag_type rhs) { \ | 96 inline Type operator^(Type::flag_type lhs, Type::flag_type rhs) { \ |
96 return Type(lhs) ^ rhs; \ | 97 return Type(lhs) ^ rhs; \ |
97 } inline Type operator^(Type::flag_type lhs, const Type& rhs) \ | 98 } inline Type operator^(Type::flag_type lhs, const Type& rhs) \ |
98 ALLOW_UNUSED WARN_UNUSED_RESULT; \ | 99 ALLOW_UNUSED_TYPE WARN_UNUSED_RESULT; \ |
99 inline Type operator^(Type::flag_type lhs, const Type& rhs) { \ | 100 inline Type operator^(Type::flag_type lhs, const Type& rhs) { \ |
100 return rhs ^ lhs; \ | 101 return rhs ^ lhs; \ |
101 } inline void operator^(Type::flag_type lhs, Type::mask_type rhs) \ | 102 } inline void operator^(Type::flag_type lhs, \ |
102 ALLOW_UNUSED; \ | 103 Type::mask_type rhs) ALLOW_UNUSED_TYPE; \ |
103 inline void operator^(Type::flag_type lhs, Type::mask_type rhs) {} | 104 inline void operator^(Type::flag_type lhs, Type::mask_type rhs) {} |
104 | 105 |
105 } // namespace base | 106 } // namespace base |
106 } // namespace v8 | 107 } // namespace v8 |
107 | 108 |
108 #endif // V8_BASE_FLAGS_H_ | 109 #endif // V8_BASE_FLAGS_H_ |
OLD | NEW |