提交 969ccf42 编写于 作者: A Adam Barth

Remove compiler feature detection for = delete

All supported compilers have this feature. Also remove unused macros for
OVERRIDE now that override are broadly supported.

R=esprehn@chromium.org, eseidel@chromium.org

Review URL: https://codereview.chromium.org/673403002
上级 17285722
...@@ -52,7 +52,7 @@ public: ...@@ -52,7 +52,7 @@ public:
private: private:
Attr(Element&, const QualifiedName&); Attr(Element&, const QualifiedName&);
bool isElementNode() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check. bool isElementNode() const = delete; // This will catch anyone doing an unnecessary check.
virtual String nodeName() const override { return name(); } virtual String nodeName() const override { return name(); }
virtual NodeType nodeType() const override { return ATTRIBUTE_NODE; } virtual NodeType nodeType() const override { return ATTRIBUTE_NODE; }
......
...@@ -77,8 +77,8 @@ private: ...@@ -77,8 +77,8 @@ private:
virtual bool offsetInCharacters() const override final; virtual bool offsetInCharacters() const override final;
void setDataAndUpdate(const String&, unsigned offsetOfReplacedData, unsigned oldLength, unsigned newLength, RecalcStyleBehavior = DoNotRecalcStyle); void setDataAndUpdate(const String&, unsigned offsetOfReplacedData, unsigned oldLength, unsigned newLength, RecalcStyleBehavior = DoNotRecalcStyle);
bool isContainerNode() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check. bool isContainerNode() const = delete; // This will catch anyone doing an unnecessary check.
bool isElementNode() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check. bool isElementNode() const = delete; // This will catch anyone doing an unnecessary check.
}; };
DEFINE_NODE_TYPE_CASTS(CharacterData, isCharacterDataNode()); DEFINE_NODE_TYPE_CASTS(CharacterData, isCharacterDataNode());
......
...@@ -142,8 +142,8 @@ protected: ...@@ -142,8 +142,8 @@ protected:
void setLastChild(Node* child) { m_lastChild = child; } void setLastChild(Node* child) { m_lastChild = child; }
private: private:
bool isContainerNode() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check. bool isContainerNode() const = delete; // This will catch anyone doing an unnecessary check.
bool isTextNode() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check. bool isTextNode() const = delete; // This will catch anyone doing an unnecessary check.
void removeBetween(Node* previousChild, Node* nextChild, Node& oldChild); void removeBetween(Node* previousChild, Node* nextChild, Node& oldChild);
void insertBeforeCommon(Node& nextChild, Node& oldChild); void insertBeforeCommon(Node& nextChild, Node& oldChild);
......
...@@ -322,7 +322,7 @@ public: ...@@ -322,7 +322,7 @@ public:
void prepareForDestruction(); void prepareForDestruction();
// If you have a Document, use renderView() instead which is faster. // If you have a Document, use renderView() instead which is faster.
void renderer() const WTF_DELETED_FUNCTION; void renderer() const = delete;
RenderView* renderView() const { return m_renderView; } RenderView* renderView() const { return m_renderView; }
...@@ -680,9 +680,9 @@ protected: ...@@ -680,9 +680,9 @@ protected:
private: private:
friend class Node; friend class Node;
bool isDocumentFragment() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check. bool isDocumentFragment() const = delete; // This will catch anyone doing an unnecessary check.
bool isDocumentNode() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check. bool isDocumentNode() const = delete; // This will catch anyone doing an unnecessary check.
bool isElementNode() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check. bool isElementNode() const = delete; // This will catch anyone doing an unnecessary check.
ScriptedAnimationController& ensureScriptedAnimationController(); ScriptedAnimationController& ensureScriptedAnimationController();
virtual EventQueue* eventQueue() const override final; virtual EventQueue* eventQueue() const override final;
......
...@@ -45,7 +45,7 @@ private: ...@@ -45,7 +45,7 @@ private:
virtual PassRefPtrWillBeRawPtr<Node> cloneNode(bool deep = true) override; virtual PassRefPtrWillBeRawPtr<Node> cloneNode(bool deep = true) override;
virtual bool childTypeAllowed(NodeType) const override; virtual bool childTypeAllowed(NodeType) const override;
bool isDocumentFragment() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check. bool isDocumentFragment() const = delete; // This will catch anyone doing an unnecessary check.
}; };
DEFINE_NODE_TYPE_CASTS(DocumentFragment, isDocumentFragment()); DEFINE_NODE_TYPE_CASTS(DocumentFragment, isDocumentFragment());
......
...@@ -425,9 +425,9 @@ private: ...@@ -425,9 +425,9 @@ private:
void clearElementFlag(ElementFlags); void clearElementFlag(ElementFlags);
bool hasElementFlagInternal(ElementFlags) const; bool hasElementFlagInternal(ElementFlags) const;
bool isElementNode() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check. bool isElementNode() const = delete; // This will catch anyone doing an unnecessary check.
bool isDocumentFragment() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check. bool isDocumentFragment() const = delete; // This will catch anyone doing an unnecessary check.
bool isDocumentNode() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check. bool isDocumentNode() const = delete; // This will catch anyone doing an unnecessary check.
void styleAttributeChanged(const AtomicString& newStyleString); void styleAttributeChanged(const AtomicString& newStyleString);
......
...@@ -71,7 +71,7 @@ private: ...@@ -71,7 +71,7 @@ private:
virtual String nodeName() const override; virtual String nodeName() const override;
virtual PassRefPtrWillBeRawPtr<Node> cloneNode(bool deep = true) override final; virtual PassRefPtrWillBeRawPtr<Node> cloneNode(bool deep = true) override final;
bool isTextNode() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check. bool isTextNode() const = delete; // This will catch anyone doing an unnecessary check.
bool needsWhitespaceRenderer(); bool needsWhitespaceRenderer();
......
...@@ -78,7 +78,7 @@ protected: ...@@ -78,7 +78,7 @@ protected:
virtual void willRecalcStyle(StyleRecalcChange) override; virtual void willRecalcStyle(StyleRecalcChange) override;
private: private:
bool isInsertionPoint() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check. bool isInsertionPoint() const = delete; // This will catch anyone doing an unnecessary check.
ContentDistribution m_distribution; ContentDistribution m_distribution;
bool m_registeredWithShadowRoot; bool m_registeredWithShadowRoot;
......
...@@ -54,7 +54,7 @@ public: ...@@ -54,7 +54,7 @@ public:
static PlainTextRange create(const ContainerNode& scope, const Range&); static PlainTextRange create(const ContainerNode& scope, const Range&);
private: private:
PlainTextRange& operator=(const PlainTextRange&) WTF_DELETED_FUNCTION; PlainTextRange& operator=(const PlainTextRange&) = delete;
enum GetRangeFor { ForGeneric, ForSelection }; enum GetRangeFor { ForGeneric, ForSelection };
PassRefPtrWillBeRawPtr<Range> createRangeFor(const ContainerNode& scope, GetRangeFor) const; PassRefPtrWillBeRawPtr<Range> createRangeFor(const ContainerNode& scope, GetRangeFor) const;
......
...@@ -67,8 +67,8 @@ protected: ...@@ -67,8 +67,8 @@ protected:
HTMLElement(const QualifiedName& tagName, Document&, ConstructionType); HTMLElement(const QualifiedName& tagName, Document&, ConstructionType);
private: private:
bool isHTMLElement() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check. bool isHTMLElement() const = delete; // This will catch anyone doing an unnecessary check.
bool isStyledElement() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check. bool isStyledElement() const = delete; // This will catch anyone doing an unnecessary check.
}; };
DEFINE_ELEMENT_TYPE_CASTS(HTMLElement, isHTMLElement()); DEFINE_ELEMENT_TYPE_CASTS(HTMLElement, isHTMLElement());
......
...@@ -66,8 +66,8 @@ public: ...@@ -66,8 +66,8 @@ public:
RenderObject* lastChild() const { ASSERT(children() == virtualChildren()); return children()->lastChild(); } RenderObject* lastChild() const { ASSERT(children() == virtualChildren()); return children()->lastChild(); }
// If you have a RenderBlock, use firstChild or lastChild instead. // If you have a RenderBlock, use firstChild or lastChild instead.
void slowFirstChild() const WTF_DELETED_FUNCTION; void slowFirstChild() const = delete;
void slowLastChild() const WTF_DELETED_FUNCTION; void slowLastChild() const = delete;
const RenderObjectChildList* children() const { return &m_children; } const RenderObjectChildList* children() const { return &m_children; }
RenderObjectChildList* children() { return &m_children; } RenderObjectChildList* children() { return &m_children; }
......
...@@ -718,7 +718,7 @@ private: ...@@ -718,7 +718,7 @@ private:
virtual InvalidationReason invalidatePaintIfNeeded(const PaintInvalidationState&, const RenderLayerModelObject& newPaintInvalidationContainer) override final; virtual InvalidationReason invalidatePaintIfNeeded(const PaintInvalidationState&, const RenderLayerModelObject& newPaintInvalidationContainer) override final;
bool isBox() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check. bool isBox() const = delete; // This will catch anyone doing an unnecessary check.
// The width/height of the contents + borders + padding. The x/y location is relative to our container (which is not always our parent). // The width/height of the contents + borders + padding. The x/y location is relative to our container (which is not always our parent).
LayoutRect m_frameRect; LayoutRect m_frameRect;
......
...@@ -41,8 +41,8 @@ public: ...@@ -41,8 +41,8 @@ public:
RenderObject* lastChild() const { ASSERT(children() == virtualChildren()); return children()->lastChild(); } RenderObject* lastChild() const { ASSERT(children() == virtualChildren()); return children()->lastChild(); }
// If you have a RenderInline, use firstChild or lastChild instead. // If you have a RenderInline, use firstChild or lastChild instead.
void slowFirstChild() const WTF_DELETED_FUNCTION; void slowFirstChild() const = delete;
void slowLastChild() const WTF_DELETED_FUNCTION; void slowLastChild() const = delete;
virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) override; virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) override;
......
...@@ -42,8 +42,8 @@ public: ...@@ -42,8 +42,8 @@ public:
RenderObject* lastChild() const { ASSERT(children() == virtualChildren()); return children()->lastChild(); } RenderObject* lastChild() const { ASSERT(children() == virtualChildren()); return children()->lastChild(); }
// If you have a RenderMedia, use firstChild or lastChild instead. // If you have a RenderMedia, use firstChild or lastChild instead.
void slowFirstChild() const WTF_DELETED_FUNCTION; void slowFirstChild() const = delete;
void slowLastChild() const WTF_DELETED_FUNCTION; void slowLastChild() const = delete;
const RenderObjectChildList* children() const { return &m_children; } const RenderObjectChildList* children() const { return &m_children; }
RenderObjectChildList* children() { return &m_children; } RenderObjectChildList* children() { return &m_children; }
......
...@@ -169,7 +169,7 @@ private: ...@@ -169,7 +169,7 @@ private:
float widthFromCache(const Font&, int start, int len, float xPos, TextDirection, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow*) const; float widthFromCache(const Font&, int start, int len, float xPos, TextDirection, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow*) const;
bool isAllASCII() const { return m_isAllASCII; } bool isAllASCII() const { return m_isAllASCII; }
bool isText() const WTF_DELETED_FUNCTION; // This will catch anyone doing an unnecessary check. bool isText() const = delete; // This will catch anyone doing an unnecessary check.
// We put the bitfield first to minimize padding on 64-bit. // We put the bitfield first to minimize padding on 64-bit.
bool m_hasBreakableChar : 1; // Whether or not we can be broken into multiple lines. bool m_hasBreakableChar : 1; // Whether or not we can be broken into multiple lines.
......
...@@ -1401,7 +1401,6 @@ T* adoptRefCountedGarbageCollected(T* ptr) ...@@ -1401,7 +1401,6 @@ T* adoptRefCountedGarbageCollected(T* ptr)
// need to have a trace method. That trace method will be called // need to have a trace method. That trace method will be called
// automatically by the Heap collections. // automatically by the Heap collections.
// //
#if COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS)
#define DISALLOW_ALLOCATION() \ #define DISALLOW_ALLOCATION() \
private: \ private: \
void* operator new(size_t) = delete; \ void* operator new(size_t) = delete; \
...@@ -1419,28 +1418,6 @@ T* adoptRefCountedGarbageCollected(T* ptr) ...@@ -1419,28 +1418,6 @@ T* adoptRefCountedGarbageCollected(T* ptr)
private: \ private: \
Type() = delete; Type() = delete;
#else
#define DISALLOW_ALLOCATION() \
private: \
void* operator new(size_t); \
void* operator new(size_t, NotNullTag, void*); \
void* operator new(size_t, void*)
#define ALLOW_ONLY_INLINE_ALLOCATION() \
public: \
void* operator new(size_t, NotNullTag, void* location) { return location; } \
void* operator new(size_t, void* location) { return location; } \
private: \
void* operator new(size_t);
#define STATIC_ONLY(Type) \
private: \
Type();
#endif
// These macros insert annotations that the Blink GC plugin for clang uses for // These macros insert annotations that the Blink GC plugin for clang uses for
// verification. STACK_ALLOCATED is used to declare that objects of this type // verification. STACK_ALLOCATED is used to declare that objects of this type
// are always stack allocated. GC_PLUGIN_IGNORE is used to make the plugin // are always stack allocated. GC_PLUGIN_IGNORE is used to make the plugin
......
...@@ -51,13 +51,11 @@ ...@@ -51,13 +51,11 @@
check for both cxx_rvalue_references as well as the unrelated cxx_nonstatic_member_init feature which we know was added in 4.3 */ check for both cxx_rvalue_references as well as the unrelated cxx_nonstatic_member_init feature which we know was added in 4.3 */
#define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES __has_extension(cxx_rvalue_references) && __has_extension(cxx_nonstatic_member_init) #define WTF_COMPILER_SUPPORTS_CXX_RVALUE_REFERENCES __has_extension(cxx_rvalue_references) && __has_extension(cxx_nonstatic_member_init)
#define WTF_COMPILER_SUPPORTS_CXX_DELETED_FUNCTIONS __has_extension(cxx_deleted_functions)
#define WTF_COMPILER_SUPPORTS_CXX_NULLPTR __has_feature(cxx_nullptr) #define WTF_COMPILER_SUPPORTS_CXX_NULLPTR __has_feature(cxx_nullptr)
#define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS __has_feature(cxx_explicit_conversions) #define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS __has_feature(cxx_explicit_conversions)
#define WTF_COMPILER_SUPPORTS_BLOCKS __has_feature(blocks) #define WTF_COMPILER_SUPPORTS_BLOCKS __has_feature(blocks)
#define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT __has_extension(c_static_assert) #define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT __has_extension(c_static_assert)
#define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT __has_extension(cxx_static_assert) #define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT __has_extension(cxx_static_assert)
#define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL __has_extension(cxx_override_control)
#define WTF_COMPILER_SUPPORTS_HAS_TRIVIAL_DESTRUCTOR __has_extension(has_trivial_destructor) #define WTF_COMPILER_SUPPORTS_HAS_TRIVIAL_DESTRUCTOR __has_extension(has_trivial_destructor)
#define WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS __has_extension(cxx_strong_enums) #define WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS __has_extension(cxx_strong_enums)
...@@ -79,8 +77,6 @@ ...@@ -79,8 +77,6 @@
#if COMPILER(CLANG) #if COMPILER(CLANG)
/* Keep strong enums turned off when building with clang-cl: We cannot yet build all of Blink without fallback to cl.exe, and strong enums are exposed at ABI boundaries. */ /* Keep strong enums turned off when building with clang-cl: We cannot yet build all of Blink without fallback to cl.exe, and strong enums are exposed at ABI boundaries. */
#undef WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS #undef WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS
#else
#define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL 1
#endif #endif
#endif #endif
...@@ -108,9 +104,6 @@ ...@@ -108,9 +104,6 @@
#define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT 1 #define WTF_COMPILER_SUPPORTS_CXX_STATIC_ASSERT 1
#define WTF_COMPILER_SUPPORTS_CXX_VARIADIC_TEMPLATES 1 #define WTF_COMPILER_SUPPORTS_CXX_VARIADIC_TEMPLATES 1
#endif #endif
#if GCC_VERSION_AT_LEAST(4, 4, 0)
#define WTF_COMPILER_SUPPORTS_CXX_DELETED_FUNCTIONS 1
#endif
#if GCC_VERSION_AT_LEAST(4, 5, 0) #if GCC_VERSION_AT_LEAST(4, 5, 0)
#define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS 1 #define WTF_COMPILER_SUPPORTS_CXX_EXPLICIT_CONVERSIONS 1
#endif #endif
...@@ -119,9 +112,6 @@ ...@@ -119,9 +112,6 @@
/* Strong enums should work from gcc 4.4, but doesn't seem to support some operators */ /* Strong enums should work from gcc 4.4, but doesn't seem to support some operators */
#define WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS 1 #define WTF_COMPILER_SUPPORTS_CXX_STRONG_ENUMS 1
#endif #endif
#if GCC_VERSION_AT_LEAST(4, 7, 0)
#define WTF_COMPILER_SUPPORTS_CXX_OVERRIDE_CONTROL 1
#endif
#endif /* defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && __cplusplus >= 201103L) */ #endif /* defined(__GXX_EXPERIMENTAL_CXX0X__) || (defined(__cplusplus) && __cplusplus >= 201103L) */
#endif /* COMPILER(GCC) */ #endif /* COMPILER(GCC) */
...@@ -206,23 +196,8 @@ ...@@ -206,23 +196,8 @@
#define ALLOW_UNUSED #define ALLOW_UNUSED
#endif #endif
/* override and FINAL */ /* FIXME: Convert all instance of FINAL to final */
#if COMPILER_SUPPORTS(CXX_OVERRIDE_CONTROL)
#define override override
#define FINAL final #define FINAL final
#else
#define override
#define FINAL
#endif
/* WTF_DELETED_FUNCTION */
#if COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS)
#define WTF_DELETED_FUNCTION = delete
#else
#define WTF_DELETED_FUNCTION
#endif
/* REFERENCED_FROM_ASM */ /* REFERENCED_FROM_ASM */
......
...@@ -23,16 +23,9 @@ ...@@ -23,16 +23,9 @@
#include "wtf/Compiler.h" #include "wtf/Compiler.h"
#if COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS) #define WTF_MAKE_NONCOPYABLE(ClassName) \
#define WTF_MAKE_NONCOPYABLE(ClassName) \ private: \
private: \ ClassName(const ClassName&) = delete; \
ClassName(const ClassName&) = delete; \ ClassName& operator=(const ClassName&) = delete;
ClassName& operator=(const ClassName&) = delete;
#else
#define WTF_MAKE_NONCOPYABLE(ClassName) \
private: \
ClassName(const ClassName&); \
ClassName& operator=(const ClassName&)
#endif
#endif // WTF_Noncopyable_h #endif // WTF_Noncopyable_h
...@@ -66,20 +66,11 @@ WTF_EXPORT extern const std::nullptr_t nullptr; ...@@ -66,20 +66,11 @@ WTF_EXPORT extern const std::nullptr_t nullptr;
#endif #endif
#if COMPILER_SUPPORTS(CXX_DELETED_FUNCTIONS)
#define WTF_DISALLOW_CONSTRUCTION_FROM_ZERO(ClassName) \ #define WTF_DISALLOW_CONSTRUCTION_FROM_ZERO(ClassName) \
private: \ private: \
ClassName(int) = delete ClassName(int) = delete
#define WTF_DISALLOW_ZERO_ASSIGNMENT(ClassName) \ #define WTF_DISALLOW_ZERO_ASSIGNMENT(ClassName) \
private: \ private: \
ClassName& operator=(int) = delete ClassName& operator=(int) = delete
#else
#define WTF_DISALLOW_CONSTRUCTION_FROM_ZERO(ClassName) \
private: \
ClassName(int)
#define WTF_DISALLOW_ZERO_ASSIGNMENT(ClassName) \
private: \
ClassName& operator=(int)
#endif
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册