| Index: src/globals.h
|
| diff --git a/src/globals.h b/src/globals.h
|
| index 26fd53114c62d582501e5d37c2c7791cb60cd99b..415b32b87a7b841efb09f4af6d7d6b8edfadc884 100644
|
| --- a/src/globals.h
|
| +++ b/src/globals.h
|
| @@ -330,6 +330,50 @@ F FUNCTION_CAST(Address addr) {
|
| }
|
|
|
|
|
| +// Compiler feature detection.
|
| +#if defined(__clang__)
|
| +
|
| +// Compatibility with older clang versions.
|
| +# ifndef __has_extension
|
| +# define __has_extension __has_feature
|
| +# endif
|
| +
|
| +# if __has_extension(cxx_override_control)
|
| +# define V8_HAVE_CXX11_FINAL
|
| +# define V8_HAVE_CXX11_OVERRIDE
|
| +# endif
|
| +
|
| +#elif defined(__GNUC__)
|
| +
|
| +// g++ requires -std=c++0x or -std=gnu++0x to support C++11 functionality
|
| +// without warnings (functionality used by the macros below). These modes
|
| +// are detectable by checking whether __GXX_EXPERIMENTAL_CXX0X__ is defined or,
|
| +// more standardly, by checking whether __cplusplus has a C++11 or greater
|
| +// value. Current versions of g++ do not correctly set __cplusplus, so we check
|
| +// both for forward compatibility.
|
| +# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
|
| +# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
|
| +# define V8_HAVE_CXX11_OVERRIDE
|
| +# define V8_HAVE_CXX11_FINAL
|
| +# endif
|
| +# else
|
| +// '__final' is a non-C++11 GCC synonym for 'final', per GCC r176655.
|
| +# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
|
| +# define V8_HAVE_GXX_FINAL
|
| +# endif
|
| +# endif
|
| +
|
| +#elif defined(_MSC_VER)
|
| +
|
| +# if _MSC_VER >= 1400
|
| +# define V8_HAVE_CXX11_OVERRIDE
|
| +// MSVC currently spells "final" as "sealed".
|
| +# define V8_HAVE_MSVC_SEALED
|
| +# endif
|
| +
|
| +#endif
|
| +
|
| +
|
| #if __cplusplus >= 201103L
|
| #define DISALLOW_BY_DELETE = delete
|
| #else
|
| @@ -375,6 +419,33 @@ F FUNCTION_CAST(Address addr) {
|
| #endif
|
|
|
|
|
| +// Annotate a virtual method indicating it must be overriding a virtual
|
| +// method in the parent class.
|
| +// Use like:
|
| +// virtual void bar() OVERRIDE;
|
| +#if defined(V8_HAVE_CXX11_OVERRIDE)
|
| +#define OVERRIDE override
|
| +#else
|
| +#define OVERRIDE
|
| +#endif
|
| +
|
| +
|
| +// Annotate a virtual method indicating that subclasses must not override it,
|
| +// or annotate a class to indicate that it cannot be subclassed.
|
| +// Use like:
|
| +// class B FINAL : public A {};
|
| +// virtual void bar() FINAL;
|
| +#if defined(V8_HAVE_CXX11_FINAL)
|
| +#define FINAL final
|
| +#elif defined(V8_HAVE_GXX_FINAL)
|
| +#define FINAL __final
|
| +#elif defined(V8_HAVE_MSVC_SEALED)
|
| +#define FINAL sealed
|
| +#else
|
| +#define FINAL
|
| +#endif
|
| +
|
| +
|
| #if defined(__GNUC__) && __GNUC__ >= 4
|
| #define MUST_USE_RESULT __attribute__ ((warn_unused_result))
|
| #else
|
|
|