| Index: include/v8config.h
|
| diff --git a/include/v8config.h b/include/v8config.h
|
| index 25eb480eb164995d05fded158b126258ceb8fcd0..3502dd6553d715261e7e8cab7fa515f6fc7e505b 100644
|
| --- a/include/v8config.h
|
| +++ b/include/v8config.h
|
| @@ -91,6 +91,7 @@
|
| //
|
| // V8_CC_CLANG - Clang
|
| // V8_CC_GNU - GNU C++
|
| +// V8_CC_INTEL - Intel C++
|
| // V8_CC_MINGW - Minimalist GNU for Windows
|
| // V8_CC_MSVC - Microsoft Visual C/C++
|
| //
|
| @@ -105,18 +106,27 @@
|
| //
|
| // Compiler-specific feature detection
|
| //
|
| -// V8_HAS___ALIGNOF - __alignof(type) operator supported
|
| -// V8_HAS___ALIGNOF__ - __alignof__(type) operator supported
|
| -// V8_HAS_ATTRIBUTE_ALIGNED - __attribute__((aligned(n))) supported
|
| -// V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline)) supported
|
| -// V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported
|
| -// V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported
|
| -// V8_HAS_BUILTIN_EXPECT - __builtin_expect() supported
|
| -// V8_HAS_DECLSPEC_ALIGN - __declspec(align(n)) supported
|
| -// V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported
|
| -// V8_HAS___FINAL - __final supported in non-C++11 mode
|
| -// V8_HAS___FORCEINLINE - __forceinline supported
|
| -// V8_HAS_SEALED - MSVC style sealed marker supported
|
| +// V8_HAS___ALIGNOF - __alignof(type) operator supported
|
| +// V8_HAS___ALIGNOF__ - __alignof__(type) operator supported
|
| +// V8_HAS_ATTRIBUTE_ALIGNED - __attribute__((aligned(n))) supported
|
| +// V8_HAS_ATTRIBUTE_ALWAYS_INLINE - __attribute__((always_inline))
|
| +// supported
|
| +// V8_HAS_ATTRIBUTE_DEPRECATED - __attribute__((deprecated)) supported
|
| +// V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported
|
| +// V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT - __attribute__((warn_unused_result))
|
| +// supported
|
| +// V8_HAS_BUILTIN_EXPECT - __builtin_expect() supported
|
| +// V8_HAS_DECLSPEC_ALIGN - __declspec(align(n)) supported
|
| +// V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported
|
| +// V8_HAS___FINAL - __final supported in non-C++11 mode
|
| +// V8_HAS___FORCEINLINE - __forceinline supported
|
| +// V8_HAS_SEALED - MSVC style sealed marker supported
|
| +//
|
| +// Note that testing for compilers and/or features must be done using #if
|
| +// not #ifdef. For example, to test for Intel C++ Compiler, use:
|
| +// #if V8_CC_INTEL
|
| +// ...
|
| +// #endif
|
|
|
| #if defined(__clang__)
|
|
|
| @@ -133,6 +143,8 @@
|
| # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline))
|
| # define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated))
|
| # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
|
| +# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
|
| + (__has_attribute(warn_unused_result))
|
|
|
| # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect))
|
|
|
| @@ -149,9 +161,9 @@
|
| ((major) * 10000 + (minor) * 100 + (patchlevel)))
|
|
|
| # define V8_CC_GNU 1
|
| -# if defined(__MINGW32__)
|
| -# define V8_CC_MINGW 1
|
| -# endif
|
| +// Intel C++ also masquerades as GCC 3.2.0
|
| +# define V8_CC_INTEL (defined(__INTEL_COMPILER))
|
| +# define V8_CC_MINGW (defined(__MINGW32__))
|
|
|
| # define V8_HAS___ALIGNOF__ (V8_GNUC_PREREQ(4, 3, 0))
|
|
|
| @@ -162,6 +174,8 @@
|
| # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (V8_GNUC_PREREQ(4, 4, 0))
|
| # define V8_HAS_ATTRIBUTE_DEPRECATED (V8_GNUC_PREREQ(3, 4, 0))
|
| # define V8_HAS_ATTRIBUTE_VISIBILITY (V8_GNUC_PREREQ(4, 3, 0))
|
| +# define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
|
| + (!V8_CC_INTEL && V8_GNUC_PREREQ(4, 1, 0))
|
|
|
| # define V8_HAS_BUILTIN_EXPECT (V8_GNUC_PREREQ(2, 96, 0))
|
|
|
| @@ -228,6 +242,16 @@
|
| #endif
|
|
|
|
|
| +// Annotate a function indicating the caller must examine the return value.
|
| +// Use like:
|
| +// int foo() V8_WARN_UNUSED_RESULT;
|
| +#if V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT
|
| +# define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
|
| +#else
|
| +# define V8_WARN_UNUSED_RESULT /* NOT SUPPORTED */
|
| +#endif
|
| +
|
| +
|
| // A macro to provide the compiler with branch prediction information.
|
| #if V8_HAS_BUILTIN_EXPECT
|
| # define V8_UNLIKELY(condition) (__builtin_expect(!!(condition), 0))
|
|
|