| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // sizeof(type) prior to checking __alignof to workaround Visual C++ bug: | 126 // sizeof(type) prior to checking __alignof to workaround Visual C++ bug: |
| 127 // http://goo.gl/isH0C | 127 // http://goo.gl/isH0C |
| 128 // Use like: | 128 // Use like: |
| 129 // ALIGNOF(int32) // this would be 4 | 129 // ALIGNOF(int32) // this would be 4 |
| 130 #if defined(COMPILER_MSVC) | 130 #if defined(COMPILER_MSVC) |
| 131 #define ALIGNOF(type) (sizeof(type) - sizeof(type) + __alignof(type)) | 131 #define ALIGNOF(type) (sizeof(type) - sizeof(type) + __alignof(type)) |
| 132 #elif defined(COMPILER_GCC) | 132 #elif defined(COMPILER_GCC) |
| 133 #define ALIGNOF(type) __alignof__(type) | 133 #define ALIGNOF(type) __alignof__(type) |
| 134 #endif | 134 #endif |
| 135 | 135 |
| 136 // Annotate a virtual method indicating it must be overriding a virtual | |
| 137 // method in the parent class. | |
| 138 // Use like: | |
| 139 // virtual void foo() OVERRIDE; | |
| 140 #define OVERRIDE override | |
| 141 | |
| 142 // Annotate a function indicating the caller must examine the return value. | 136 // Annotate a function indicating the caller must examine the return value. |
| 143 // Use like: | 137 // Use like: |
| 144 // int foo() WARN_UNUSED_RESULT; | 138 // int foo() WARN_UNUSED_RESULT; |
| 145 // To explicitly ignore a result, see |ignore_result()| in <base/basictypes.h>. | 139 // To explicitly ignore a result, see |ignore_result()| in <base/basictypes.h>. |
| 146 #if defined(COMPILER_GCC) | 140 #if defined(COMPILER_GCC) |
| 147 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) | 141 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) |
| 148 #else | 142 #else |
| 149 #define WARN_UNUSED_RESULT | 143 #define WARN_UNUSED_RESULT |
| 150 #endif | 144 #endif |
| 151 | 145 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // Macro for hinting that an expression is likely to be false. | 186 // Macro for hinting that an expression is likely to be false. |
| 193 #if !defined(UNLIKELY) | 187 #if !defined(UNLIKELY) |
| 194 #if defined(COMPILER_GCC) | 188 #if defined(COMPILER_GCC) |
| 195 #define UNLIKELY(x) __builtin_expect(!!(x), 0) | 189 #define UNLIKELY(x) __builtin_expect(!!(x), 0) |
| 196 #else | 190 #else |
| 197 #define UNLIKELY(x) (x) | 191 #define UNLIKELY(x) (x) |
| 198 #endif // defined(COMPILER_GCC) | 192 #endif // defined(COMPILER_GCC) |
| 199 #endif // !defined(UNLIKELY) | 193 #endif // !defined(UNLIKELY) |
| 200 | 194 |
| 201 #endif // BASE_COMPILER_SPECIFIC_H_ | 195 #endif // BASE_COMPILER_SPECIFIC_H_ |
| OLD | NEW |