OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project 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 V8CONFIG_H_ | 5 #ifndef V8CONFIG_H_ |
6 #define V8CONFIG_H_ | 6 #define V8CONFIG_H_ |
7 | 7 |
8 // Platform headers for feature detection below. | 8 // Platform headers for feature detection below. |
9 #if defined(__ANDROID__) | 9 #if defined(__ANDROID__) |
10 # include <sys/cdefs.h> | 10 # include <sys/cdefs.h> |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // Note that testing for compilers and/or features must be done using #if | 192 // Note that testing for compilers and/or features must be done using #if |
193 // not #ifdef. For example, to test for Intel C++ Compiler, use: | 193 // not #ifdef. For example, to test for Intel C++ Compiler, use: |
194 // #if V8_CC_INTEL | 194 // #if V8_CC_INTEL |
195 // ... | 195 // ... |
196 // #endif | 196 // #endif |
197 | 197 |
198 #if defined(__clang__) | 198 #if defined(__clang__) |
199 | 199 |
200 #if defined(__GNUC__) // Clang in gcc mode. | 200 #if defined(__GNUC__) // Clang in gcc mode. |
201 # define V8_CC_GNU 1 | 201 # define V8_CC_GNU 1 |
202 #elif defined(_MSC_VER) // Clang in cl mode. | |
203 # define V8_CC_MSVC 1 | |
204 #endif | 202 #endif |
205 | 203 |
206 // Clang defines __alignof__ as alias for __alignof | 204 // Clang defines __alignof__ as alias for __alignof |
207 # define V8_HAS___ALIGNOF 1 | 205 # define V8_HAS___ALIGNOF 1 |
208 # define V8_HAS___ALIGNOF__ V8_HAS___ALIGNOF | 206 # define V8_HAS___ALIGNOF__ V8_HAS___ALIGNOF |
209 | 207 |
210 # define V8_HAS_ATTRIBUTE_ALIGNED (__has_attribute(aligned)) | 208 # define V8_HAS_ATTRIBUTE_ALIGNED (__has_attribute(aligned)) |
211 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline)) | 209 # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline)) |
212 # define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated)) | 210 # define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated)) |
213 # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline)) | 211 # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline)) |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 // without warnings (functionality used by the macros below). These modes | 259 // without warnings (functionality used by the macros below). These modes |
262 // are detectable by checking whether __GXX_EXPERIMENTAL_CXX0X__ is defined or, | 260 // are detectable by checking whether __GXX_EXPERIMENTAL_CXX0X__ is defined or, |
263 // more standardly, by checking whether __cplusplus has a C++11 or greater | 261 // more standardly, by checking whether __cplusplus has a C++11 or greater |
264 // value. Current versions of g++ do not correctly set __cplusplus, so we check | 262 // value. Current versions of g++ do not correctly set __cplusplus, so we check |
265 // both for forward compatibility. | 263 // both for forward compatibility. |
266 # if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L | 264 # if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L |
267 # define V8_HAS_CXX11_ALIGNAS (V8_GNUC_PREREQ(4, 8, 0)) | 265 # define V8_HAS_CXX11_ALIGNAS (V8_GNUC_PREREQ(4, 8, 0)) |
268 # define V8_HAS_CXX11_ALIGNOF (V8_GNUC_PREREQ(4, 8, 0)) | 266 # define V8_HAS_CXX11_ALIGNOF (V8_GNUC_PREREQ(4, 8, 0)) |
269 # define V8_HAS_CXX11_STATIC_ASSERT (V8_GNUC_PREREQ(4, 3, 0)) | 267 # define V8_HAS_CXX11_STATIC_ASSERT (V8_GNUC_PREREQ(4, 3, 0)) |
270 # endif | 268 # endif |
| 269 #endif |
271 | 270 |
272 #elif defined(_MSC_VER) | 271 #if defined(_MSC_VER) |
273 | |
274 # define V8_CC_MSVC 1 | 272 # define V8_CC_MSVC 1 |
275 | |
276 # define V8_HAS___ALIGNOF 1 | 273 # define V8_HAS___ALIGNOF 1 |
277 | 274 |
278 # define V8_HAS_DECLSPEC_ALIGN 1 | 275 # define V8_HAS_DECLSPEC_ALIGN 1 |
279 # define V8_HAS_DECLSPEC_DEPRECATED 1 | 276 # define V8_HAS_DECLSPEC_DEPRECATED 1 |
280 # define V8_HAS_DECLSPEC_NOINLINE 1 | 277 # define V8_HAS_DECLSPEC_NOINLINE 1 |
281 # define V8_HAS_DECLSPEC_SELECTANY 1 | 278 # define V8_HAS_DECLSPEC_SELECTANY 1 |
282 | 279 |
283 # define V8_HAS___FORCEINLINE 1 | 280 # define V8_HAS___FORCEINLINE 1 |
284 | 281 |
285 #endif | 282 #endif |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 // Annotate a function indicating the caller must examine the return value. | 393 // Annotate a function indicating the caller must examine the return value. |
397 // Use like: | 394 // Use like: |
398 // int foo() WARN_UNUSED_RESULT; | 395 // int foo() WARN_UNUSED_RESULT; |
399 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT | 396 #if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT |
400 #define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) | 397 #define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) |
401 #else | 398 #else |
402 #define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */ | 399 #define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */ |
403 #endif | 400 #endif |
404 | 401 |
405 #endif // V8CONFIG_H_ | 402 #endif // V8CONFIG_H_ |
OLD | NEW |