From 64d73404393f25e2ba3a2b80106bdca2dcb95fe9 Mon Sep 17 00:00:00 2001 From: bmeurer Date: Tue, 5 May 2015 00:44:30 -0700 Subject: [PATCH] [c++11] Remove remnants of pre-C++11 delete, final and override. These macros are not needed anymore, so there's no point in supporting them. Review URL: https://codereview.chromium.org/1123723003 Cr-Commit-Position: refs/heads/master@{#28214} --- include/v8config.h | 32 -------------------------------- src/base/macros.h | 10 +++++----- 2 files changed, 5 insertions(+), 37 deletions(-) diff --git a/include/v8config.h b/include/v8config.h index 7723e42f8..991a43afd 100644 --- a/include/v8config.h +++ b/include/v8config.h @@ -162,7 +162,6 @@ // V8_HAS_CXX11_ALIGNAS - alignas specifier supported // V8_HAS_CXX11_ALIGNOF - alignof(type) operator supported // V8_HAS_CXX11_STATIC_ASSERT - static_assert() supported -// V8_HAS_CXX11_DELETE - deleted functions supported // // Compiler-specific feature detection // @@ -188,7 +187,6 @@ // V8_HAS_DECLSPEC_DEPRECATED - __declspec(deprecated) supported // V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported // V8_HAS_DECLSPEC_SELECTANY - __declspec(selectany) supported -// V8_HAS___FINAL - __final supported in non-C++11 mode // V8_HAS___FORCEINLINE - __forceinline supported // // Note that testing for compilers and/or features must be done using #if @@ -228,7 +226,6 @@ # define V8_HAS_CXX11_ALIGNAS (__has_feature(cxx_alignas)) # define V8_HAS_CXX11_STATIC_ASSERT (__has_feature(cxx_static_assert)) -# define V8_HAS_CXX11_DELETE (__has_feature(cxx_deleted_functions)) #elif defined(__GNUC__) @@ -270,12 +267,6 @@ # define V8_HAS_CXX11_ALIGNAS (V8_GNUC_PREREQ(4, 8, 0)) # define V8_HAS_CXX11_ALIGNOF (V8_GNUC_PREREQ(4, 8, 0)) # define V8_HAS_CXX11_STATIC_ASSERT (V8_GNUC_PREREQ(4, 3, 0)) -# define V8_HAS_CXX11_DELETE (V8_GNUC_PREREQ(4, 4, 0)) -# define V8_HAS_CXX11_OVERRIDE (V8_GNUC_PREREQ(4, 7, 0)) -# define V8_HAS_CXX11_FINAL (V8_GNUC_PREREQ(4, 7, 0)) -# else -// '__final' is a non-C++11 GCC synonym for 'final', per GCC r176655. -# define V8_HAS___FINAL (V8_GNUC_PREREQ(4, 7, 0)) # endif #elif defined(_MSC_VER) @@ -284,9 +275,6 @@ # define V8_HAS___ALIGNOF 1 -# define V8_HAS_CXX11_FINAL 1 -# define V8_HAS_CXX11_OVERRIDE 1 - # define V8_HAS_DECLSPEC_ALIGN 1 # define V8_HAS_DECLSPEC_DEPRECATED 1 # define V8_HAS_DECLSPEC_NOINLINE 1 @@ -353,26 +341,6 @@ declarator __attribute__((deprecated)) #endif -// A macro to specify that a method is deleted from the corresponding class. -// Any attempt to use the method will always produce an error at compile time -// when this macro can be implemented (i.e. if the compiler supports C++11). -// If the current compiler does not support C++11, use of the annotated method -// will still cause an error, but the error will most likely occur at link time -// rather than at compile time. As a backstop, method declarations using this -// macro should be private. -// Use like: -// class A { -// private: -// A(const A& other) V8_DELETE; -// A& operator=(const A& other) V8_DELETE; -// }; -#if V8_HAS_CXX11_DELETE -# define V8_DELETE = delete -#else -# define V8_DELETE /* NOT SUPPORTED */ -#endif - - // This macro allows to specify memory alignment for structs, classes, etc. // Use like: // class V8_ALIGNED(16) MyClass { ... }; diff --git a/src/base/macros.h b/src/base/macros.h index 49ca386aa..e98b4f569 100644 --- a/src/base/macros.h +++ b/src/base/macros.h @@ -234,9 +234,9 @@ V8_INLINE Dest bit_cast(Source const& source) { // A macro to disallow the evil copy constructor and operator= functions // This should be used in the private: declarations for a class -#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ - TypeName(const TypeName&) V8_DELETE; \ - void operator=(const TypeName&) V8_DELETE +#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ + TypeName(const TypeName&) = delete; \ + void operator=(const TypeName&) = delete // A macro to disallow all the implicit constructors, namely the @@ -245,8 +245,8 @@ V8_INLINE Dest bit_cast(Source const& source) { // This should be used in the private: declarations for a class // that wants to prevent anyone from instantiating it. This is // especially useful for classes containing only static methods. -#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ - TypeName() V8_DELETE; \ +#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ + TypeName() = delete; \ DISALLOW_COPY_AND_ASSIGN(TypeName) -- 2.34.1