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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 // ALIGNOF(int32) // this would be 4 | 133 // ALIGNOF(int32) // this would be 4 |
134 #if defined(COMPILER_MSVC) | 134 #if defined(COMPILER_MSVC) |
135 #define ALIGNOF(type) __alignof(type) | 135 #define ALIGNOF(type) __alignof(type) |
136 #elif defined(COMPILER_GCC) | 136 #elif defined(COMPILER_GCC) |
137 #define ALIGNOF(type) __alignof__(type) | 137 #define ALIGNOF(type) __alignof__(type) |
138 #endif | 138 #endif |
139 | 139 |
140 // Annotate a function indicating the caller must examine the return value. | 140 // Annotate a function indicating the caller must examine the return value. |
141 // Use like: | 141 // Use like: |
142 // int foo() WARN_UNUSED_RESULT; | 142 // int foo() WARN_UNUSED_RESULT; |
143 // To explicitly ignore a result, see |ignore_result()| in <base/basictypes.h>. | 143 // To explicitly ignore a result, see |ignore_result()| in base/macros.h. |
144 #if defined(COMPILER_GCC) | 144 #if defined(COMPILER_GCC) |
145 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) | 145 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result)) |
146 #else | 146 #else |
147 #define WARN_UNUSED_RESULT | 147 #define WARN_UNUSED_RESULT |
148 #endif | 148 #endif |
149 | 149 |
150 // Tell the compiler a function is using a printf-style format string. | 150 // Tell the compiler a function is using a printf-style format string. |
151 // |format_param| is the one-based index of the format string parameter; | 151 // |format_param| is the one-based index of the format string parameter; |
152 // |dots_param| is the one-based index of the "..." parameter. | 152 // |dots_param| is the one-based index of the "..." parameter. |
153 // For v*printf functions (which take a va_list), pass 0 for dots_param. | 153 // For v*printf functions (which take a va_list), pass 0 for dots_param. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // Macro for hinting that an expression is likely to be false. | 198 // Macro for hinting that an expression is likely to be false. |
199 #if !defined(UNLIKELY) | 199 #if !defined(UNLIKELY) |
200 #if defined(COMPILER_GCC) | 200 #if defined(COMPILER_GCC) |
201 #define UNLIKELY(x) __builtin_expect(!!(x), 0) | 201 #define UNLIKELY(x) __builtin_expect(!!(x), 0) |
202 #else | 202 #else |
203 #define UNLIKELY(x) (x) | 203 #define UNLIKELY(x) (x) |
204 #endif // defined(COMPILER_GCC) | 204 #endif // defined(COMPILER_GCC) |
205 #endif // !defined(UNLIKELY) | 205 #endif // !defined(UNLIKELY) |
206 | 206 |
207 #endif // BASE_COMPILER_SPECIFIC_H_ | 207 #endif // BASE_COMPILER_SPECIFIC_H_ |
OLD | NEW |