OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium 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 BASE_COMPILER_SPECIFIC_H_ | 5 #ifndef BASE_COMPILER_SPECIFIC_H_ |
6 #define BASE_COMPILER_SPECIFIC_H_ | 6 #define BASE_COMPILER_SPECIFIC_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #if defined(COMPILER_MSVC) | 10 #if defined(COMPILER_MSVC) |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 #endif | 150 #endif |
151 | 151 |
152 // Annotate a virtual method indicating that subclasses must not override it, | 152 // Annotate a virtual method indicating that subclasses must not override it, |
153 // or annotate a class to indicate that it cannot be subclassed. | 153 // or annotate a class to indicate that it cannot be subclassed. |
154 // Use like: | 154 // Use like: |
155 // virtual void foo() FINAL; | 155 // virtual void foo() FINAL; |
156 // class B FINAL : public A {}; | 156 // class B FINAL : public A {}; |
157 #if defined(__clang__) | 157 #if defined(__clang__) |
158 #define FINAL final | 158 #define FINAL final |
159 #elif defined(COMPILER_MSVC) | 159 #elif defined(COMPILER_MSVC) |
160 // TODO(jered): Change this to "final" when chromium no longer uses MSVC 2010. | 160 // TODO(thakis): Remove if !defined() once Blink is updated too. |
161 #define FINAL sealed | 161 #if !defined(FINAL) |
| 162 #define FINAL final |
| 163 #endif |
162 #elif defined(COMPILER_GCC) && __cplusplus >= 201103 && \ | 164 #elif defined(COMPILER_GCC) && __cplusplus >= 201103 && \ |
163 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700 | 165 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700 |
164 // GCC 4.7 supports explicit virtual overrides when C++11 support is enabled. | 166 // GCC 4.7 supports explicit virtual overrides when C++11 support is enabled. |
165 #define FINAL final | 167 #define FINAL final |
166 #else | 168 #else |
167 #define FINAL | 169 #define FINAL |
168 #endif | 170 #endif |
169 | 171 |
170 // Annotate a function indicating the caller must examine the return value. | 172 // Annotate a function indicating the caller must examine the return value. |
171 // Use like: | 173 // Use like: |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 // Macro for hinting that an expression is likely to be false. | 222 // Macro for hinting that an expression is likely to be false. |
221 #if !defined(UNLIKELY) | 223 #if !defined(UNLIKELY) |
222 #if defined(COMPILER_GCC) | 224 #if defined(COMPILER_GCC) |
223 #define UNLIKELY(x) __builtin_expect(!!(x), 0) | 225 #define UNLIKELY(x) __builtin_expect(!!(x), 0) |
224 #else | 226 #else |
225 #define UNLIKELY(x) (x) | 227 #define UNLIKELY(x) (x) |
226 #endif // defined(COMPILER_GCC) | 228 #endif // defined(COMPILER_GCC) |
227 #endif // !defined(UNLIKELY) | 229 #endif // !defined(UNLIKELY) |
228 | 230 |
229 #endif // BASE_COMPILER_SPECIFIC_H_ | 231 #endif // BASE_COMPILER_SPECIFIC_H_ |
OLD | NEW |