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(COMPILER_MSVC) | 157 #if defined(__clang__) |
| 158 #define FINAL final |
| 159 #elif defined(COMPILER_MSVC) |
158 // TODO(jered): Change this to "final" when chromium no longer uses MSVC 2010. | 160 // TODO(jered): Change this to "final" when chromium no longer uses MSVC 2010. |
159 #define FINAL sealed | 161 #define FINAL sealed |
160 #elif defined(__clang__) | |
161 #define FINAL final | |
162 #elif defined(COMPILER_GCC) && __cplusplus >= 201103 && \ | 162 #elif defined(COMPILER_GCC) && __cplusplus >= 201103 && \ |
163 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700 | 163 (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) >= 40700 |
164 // GCC 4.7 supports explicit virtual overrides when C++11 support is enabled. | 164 // GCC 4.7 supports explicit virtual overrides when C++11 support is enabled. |
165 #define FINAL final | 165 #define FINAL final |
166 #else | 166 #else |
167 #define FINAL | 167 #define FINAL |
168 #endif | 168 #endif |
169 | 169 |
170 // Annotate a function indicating the caller must examine the return value. | 170 // Annotate a function indicating the caller must examine the return value. |
171 // Use like: | 171 // Use like: |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 // Macro useful for writing cross-platform function pointers. | 214 // Macro useful for writing cross-platform function pointers. |
215 #if !defined(CDECL) | 215 #if !defined(CDECL) |
216 #if defined(OS_WIN) | 216 #if defined(OS_WIN) |
217 #define CDECL __cdecl | 217 #define CDECL __cdecl |
218 #else // defined(OS_WIN) | 218 #else // defined(OS_WIN) |
219 #define CDECL | 219 #define CDECL |
220 #endif // defined(OS_WIN) | 220 #endif // defined(OS_WIN) |
221 #endif // !defined(CDECL) | 221 #endif // !defined(CDECL) |
222 | 222 |
223 #endif // BASE_COMPILER_SPECIFIC_H_ | 223 #endif // BASE_COMPILER_SPECIFIC_H_ |
OLD | NEW |