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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 #define OVERRIDE override | 147 #define OVERRIDE override |
148 #else | 148 #else |
149 #define OVERRIDE | 149 #define OVERRIDE |
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__) || defined(COMPILER_MSVC) |
158 #define FINAL final | 158 #define FINAL final |
159 #elif defined(COMPILER_MSVC) | |
160 // TODO(jered): Change this to "final" when chromium no longer uses MSVC 2010. | |
161 #define FINAL sealed | |
162 #elif defined(COMPILER_GCC) && __cplusplus >= 201103 && \ | 159 #elif defined(COMPILER_GCC) && __cplusplus >= 201103 && \ |
scottmg
2014/04/04 00:30:04
guess you could merge all this too, but maybe it's
| |
163 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700 | 160 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700 |
164 // GCC 4.7 supports explicit virtual overrides when C++11 support is enabled. | 161 // GCC 4.7 supports explicit virtual overrides when C++11 support is enabled. |
165 #define FINAL final | 162 #define FINAL final |
166 #else | 163 #else |
167 #define FINAL | 164 #define FINAL |
168 #endif | 165 #endif |
169 | 166 |
170 // Annotate a function indicating the caller must examine the return value. | 167 // Annotate a function indicating the caller must examine the return value. |
171 // Use like: | 168 // Use like: |
172 // int foo() WARN_UNUSED_RESULT; | 169 // int foo() WARN_UNUSED_RESULT; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 // Macro for hinting that an expression is likely to be false. | 217 // Macro for hinting that an expression is likely to be false. |
221 #if !defined(UNLIKELY) | 218 #if !defined(UNLIKELY) |
222 #if defined(COMPILER_GCC) | 219 #if defined(COMPILER_GCC) |
223 #define UNLIKELY(x) __builtin_expect(!!(x), 0) | 220 #define UNLIKELY(x) __builtin_expect(!!(x), 0) |
224 #else | 221 #else |
225 #define UNLIKELY(x) (x) | 222 #define UNLIKELY(x) (x) |
226 #endif // defined(COMPILER_GCC) | 223 #endif // defined(COMPILER_GCC) |
227 #endif // !defined(UNLIKELY) | 224 #endif // !defined(UNLIKELY) |
228 | 225 |
229 #endif // BASE_COMPILER_SPECIFIC_H_ | 226 #endif // BASE_COMPILER_SPECIFIC_H_ |
OLD | NEW |