From df2b7cbc5ce989fcf0c62afa36d6fe50d129049c Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Sun, 20 Nov 2011 22:21:16 -0800 Subject: [PATCH] Bug 704127 - Implement MOZ_FINAL as a modifier for classes and virtual member functions. r=cjones --HG-- extra : rebase_source : d95a3b3e726f810f299314358ba8c5e23557698e --- content/base/src/nsTextFragment.h | 4 +- ipc/glue/Shmem.h | 4 +- ipc/ipdl/ipdl/builtin.py | 1 + ipc/ipdl/ipdl/cxx/cgen.py | 4 +- js/src/shell/jsworkers.cpp | 8 +- layout/generic/nsFrameSelection.h | 4 +- layout/generic/nsLineBox.h | 4 +- layout/generic/nsSelection.cpp | 4 +- layout/style/ImportRule.h | 6 +- layout/style/NameSpaceRule.h | 4 +- layout/style/StyleRule.h | 2 +- layout/style/nsCSSRules.cpp | 2 +- layout/style/nsCSSRules.h | 29 +++---- layout/style/nsCSSStyleSheet.h | 13 +-- .../xul/base/src/tree/src/nsTreeBodyFrame.h | 4 +- mfbt/Attributes.h | 82 +++++++++++++++++++ xpcom/base/nsConsoleMessage.h | 4 +- xpcom/base/nsErrorService.h | 4 +- xpcom/glue/GenericFactory.h | 4 +- xpcom/glue/nsArrayEnumerator.cpp | 6 +- xpcom/glue/nsCOMPtr.h | 8 +- xpcom/glue/nsEnumeratorUtils.cpp | 4 +- xpcom/glue/nsWeakReference.cpp | 4 +- 23 files changed, 159 insertions(+), 50 deletions(-) diff --git a/content/base/src/nsTextFragment.h b/content/base/src/nsTextFragment.h index c714af94fbbf..fe89a1f1e936 100644 --- a/content/base/src/nsTextFragment.h +++ b/content/base/src/nsTextFragment.h @@ -43,6 +43,8 @@ #ifndef nsTextFragment_h___ #define nsTextFragment_h___ +#include "mozilla/Attributes.h" + #include "nsString.h" #include "nsReadableUtils.h" #include "nsTraceRefcnt.h" @@ -80,7 +82,7 @@ class nsCString; * This class does not have a virtual destructor therefore it is not * meant to be subclassed. */ -class NS_FINAL_CLASS nsTextFragment { +class nsTextFragment MOZ_FINAL { public: static nsresult Init(); static void Shutdown(); diff --git a/ipc/glue/Shmem.h b/ipc/glue/Shmem.h index ae951db84948..089508ca3e26 100644 --- a/ipc/glue/Shmem.h +++ b/ipc/glue/Shmem.h @@ -41,6 +41,8 @@ #ifndef mozilla_ipc_Shmem_h #define mozilla_ipc_Shmem_h +#include "mozilla/Attributes.h" + #include "base/basictypes.h" #include "base/process.h" @@ -87,7 +89,7 @@ namespace mozilla { namespace ipc { -class NS_FINAL_CLASS Shmem +class Shmem MOZ_FINAL { friend struct IPC::ParamTraits; diff --git a/ipc/ipdl/ipdl/builtin.py b/ipc/ipdl/ipdl/builtin.py index 6092425684b0..d27aaea96450 100644 --- a/ipc/ipdl/ipdl/builtin.py +++ b/ipc/ipdl/ipdl/builtin.py @@ -92,6 +92,7 @@ Types = ( Includes = ( + 'mozilla/Attributes.h', 'base/basictypes.h', 'prtime.h', 'nscore.h', diff --git a/ipc/ipdl/ipdl/cxx/cgen.py b/ipc/ipdl/ipdl/cxx/cgen.py index 791da5b54d54..322cdaf6faf3 100644 --- a/ipc/ipdl/ipdl/cxx/cgen.py +++ b/ipc/ipdl/ipdl/cxx/cgen.py @@ -161,9 +161,9 @@ class CxxCodeGen(CodePrinter, Visitor): if c.abstract: # FIXME/cjones: turn this "on" when we get the analysis self.write(' /*NS_ABSTRACT_CLASS*/') - if c.final: - self.write(' NS_FINAL_CLASS') self.write(' '+ c.name) + if c.final: + self.write(' MOZ_FINAL') if c.specializes is not None: self.write(' <') diff --git a/js/src/shell/jsworkers.cpp b/js/src/shell/jsworkers.cpp index 20a708003666..49d552f1bf4b 100644 --- a/js/src/shell/jsworkers.cpp +++ b/js/src/shell/jsworkers.cpp @@ -40,6 +40,8 @@ #ifdef JS_THREADSAFE +#include "mozilla/Attributes.h" + #include #include "prthread.h" #include "prlock.h" @@ -351,7 +353,7 @@ class Event typedef ThreadSafeQueue EventQueue; -class MainQueue : public EventQueue, public WorkerParent +class MainQueue MOZ_FINAL : public EventQueue, public WorkerParent { private: ThreadPool *threadPool; @@ -430,7 +432,7 @@ class MainQueue : public EventQueue, public WorkerParent * We keep a queue of workers with pending events, rather than a queue of * events, so that two threads won't try to run a Worker at the same time. */ -class WorkerQueue : public ThreadSafeQueue +class WorkerQueue MOZ_FINAL : public ThreadSafeQueue { private: MainQueue *main; @@ -588,7 +590,7 @@ class ThreadPool * Separately, there is a terminateFlag that other threads can set * asynchronously to tell the Worker to terminate. */ -class Worker : public WorkerParent +class Worker MOZ_FINAL : public WorkerParent { private: ThreadPool *threadPool; diff --git a/layout/generic/nsFrameSelection.h b/layout/generic/nsFrameSelection.h index a10784a52203..9acbffa83d36 100644 --- a/layout/generic/nsFrameSelection.h +++ b/layout/generic/nsFrameSelection.h @@ -37,7 +37,7 @@ #ifndef nsFrameSelection_h___ #define nsFrameSelection_h___ - + #include "nsIFrame.h" #include "nsIContent.h" #include "nsISelectionController.h" @@ -210,7 +210,7 @@ class nsIScrollableFrame; * or they may cause other objects to be deleted. */ -class NS_FINAL_CLASS nsFrameSelection : public nsISupports { +class nsFrameSelection : public nsISupports { public: enum HINT { HINTLEFT = 0, HINTRIGHT = 1}; //end of this line or beginning of next /*interfaces for addref and release and queryinterface*/ diff --git a/layout/generic/nsLineBox.h b/layout/generic/nsLineBox.h index 82c63ff5caf2..ef88e822bd8f 100644 --- a/layout/generic/nsLineBox.h +++ b/layout/generic/nsLineBox.h @@ -43,6 +43,8 @@ #ifndef nsLineBox_h___ #define nsLineBox_h___ +#include "mozilla/Attributes.h" + #include "nsILineIterator.h" #include "nsIFrame.h" @@ -1566,7 +1568,7 @@ nsLineList_const_reverse_iterator::operator=(const nsLineList_const_reverse_iter //---------------------------------------------------------------------- -class NS_FINAL_CLASS nsLineIterator : public nsILineIterator +class nsLineIterator MOZ_FINAL : public nsILineIterator { public: nsLineIterator(); diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index 812058f9dcc9..326560ecb85a 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -41,6 +41,8 @@ * Implementation of selection: nsISelection,nsISelectionPrivate and nsFrameSelection */ +#include "mozilla/Attributes.h" + #include "nsCOMPtr.h" #include "nsWeakReference.h" #include "nsIFactory.h" @@ -357,7 +359,7 @@ private: }; // Stack-class to turn on/off selection batching for table selection -class NS_STACK_CLASS NS_FINAL_CLASS nsSelectionBatcher +class NS_STACK_CLASS nsSelectionBatcher MOZ_FINAL { private: nsCOMPtr mSelection; diff --git a/layout/style/ImportRule.h b/layout/style/ImportRule.h index b1903fd8bb10..4a24684ee3de 100644 --- a/layout/style/ImportRule.h +++ b/layout/style/ImportRule.h @@ -40,6 +40,8 @@ #ifndef mozilla_css_ImportRule_h__ #define mozilla_css_ImportRule_h__ +#include "mozilla/Attributes.h" + #include "mozilla/css/Rule.h" #include "nsIDOMCSSImportRule.h" #include "nsCSSRules.h" @@ -50,8 +52,8 @@ class nsString; namespace mozilla { namespace css { -class NS_FINAL_CLASS ImportRule : public Rule, - public nsIDOMCSSImportRule +class ImportRule MOZ_FINAL : public Rule, + public nsIDOMCSSImportRule { public: ImportRule(nsMediaList* aMedia, const nsString& aURLSpec); diff --git a/layout/style/NameSpaceRule.h b/layout/style/NameSpaceRule.h index 48976ef22dba..9f27b49f1f81 100644 --- a/layout/style/NameSpaceRule.h +++ b/layout/style/NameSpaceRule.h @@ -53,8 +53,8 @@ class nsIAtom; namespace mozilla { namespace css { -class NS_FINAL_CLASS NameSpaceRule : public Rule, - public nsIDOMCSSRule +class NameSpaceRule : public Rule, + public nsIDOMCSSRule { public: NameSpaceRule(nsIAtom* aPrefix, const nsString& aURLSpec); diff --git a/layout/style/StyleRule.h b/layout/style/StyleRule.h index ab9ca5b4609c..da1b1c64af43 100644 --- a/layout/style/StyleRule.h +++ b/layout/style/StyleRule.h @@ -318,7 +318,7 @@ protected: friend class StyleRule; }; -class NS_FINAL_CLASS StyleRule : public Rule +class StyleRule : public Rule { public: StyleRule(nsCSSSelectorList* aSelector, diff --git a/layout/style/nsCSSRules.cpp b/layout/style/nsCSSRules.cpp index e0331801887e..e9c82f6a7bec 100644 --- a/layout/style/nsCSSRules.cpp +++ b/layout/style/nsCSSRules.cpp @@ -120,7 +120,7 @@ Rule::GetParentStyleSheet(nsIDOMCSSStyleSheet** aSheet) // Style Rule List for group rules // -class NS_FINAL_CLASS GroupRuleRuleList : public nsICSSRuleList +class GroupRuleRuleList : public nsICSSRuleList { public: GroupRuleRuleList(GroupRule *aGroupRule); diff --git a/layout/style/nsCSSRules.h b/layout/style/nsCSSRules.h index a79354398c41..99c964378b08 100644 --- a/layout/style/nsCSSRules.h +++ b/layout/style/nsCSSRules.h @@ -43,6 +43,8 @@ #ifndef nsCSSRules_h_ #define nsCSSRules_h_ +#include "mozilla/Attributes.h" + #include "mozilla/css/GroupRule.h" #include "nsIDOMCSSMediaRule.h" #include "nsIDOMCSSMozDocumentRule.h" @@ -70,8 +72,8 @@ class nsMediaList; namespace mozilla { namespace css { -class NS_FINAL_CLASS MediaRule : public GroupRule, - public nsIDOMCSSMediaRule +class MediaRule : public GroupRule, + public nsIDOMCSSMediaRule { public: MediaRule(); @@ -113,8 +115,8 @@ protected: nsRefPtr mMedia; }; -class NS_FINAL_CLASS DocumentRule : public GroupRule, - public nsIDOMCSSMozDocumentRule +class DocumentRule : public GroupRule, + public nsIDOMCSSMozDocumentRule { public: DocumentRule(); @@ -212,8 +214,8 @@ private: void* operator new(size_t size) CPP_THROW_NEW; }; -class NS_FINAL_CLASS nsCSSFontFaceRule : public mozilla::css::Rule, - public nsIDOMCSSFontFaceRule +class nsCSSFontFaceRule MOZ_FINAL : public mozilla::css::Rule, + public nsIDOMCSSFontFaceRule { public: nsCSSFontFaceRule() {} @@ -273,8 +275,8 @@ nsCSSFontFaceStyleDecl::ContainingRule() const namespace mozilla { namespace css { -class NS_FINAL_CLASS CharsetRule : public Rule, - public nsIDOMCSSCharsetRule +class CharsetRule MOZ_FINAL : public Rule, + public nsIDOMCSSCharsetRule { public: CharsetRule(const nsAString& aEncoding); @@ -313,8 +315,7 @@ private: class nsCSSKeyframeRule; -class NS_FINAL_CLASS nsCSSKeyframeStyleDeclaration - : public nsDOMCSSDeclaration +class nsCSSKeyframeStyleDeclaration : public nsDOMCSSDeclaration { public: nsCSSKeyframeStyleDeclaration(nsCSSKeyframeRule *aRule); @@ -344,8 +345,8 @@ protected: nsCSSKeyframeRule *mRule; }; -class NS_FINAL_CLASS nsCSSKeyframeRule : public mozilla::css::Rule, - public nsIDOMMozCSSKeyframeRule +class nsCSSKeyframeRule MOZ_FINAL : public mozilla::css::Rule, + public nsIDOMMozCSSKeyframeRule { public: // WARNING: Steals the contents of aKeys *and* aDeclaration @@ -389,8 +390,8 @@ private: nsRefPtr mDOMDeclaration; }; -class NS_FINAL_CLASS nsCSSKeyframesRule : public mozilla::css::GroupRule, - public nsIDOMMozCSSKeyframesRule +class nsCSSKeyframesRule : public mozilla::css::GroupRule, + public nsIDOMMozCSSKeyframesRule { public: nsCSSKeyframesRule(const nsSubstring& aName) diff --git a/layout/style/nsCSSStyleSheet.h b/layout/style/nsCSSStyleSheet.h index 9cb5320d8c33..0860d2eb7207 100644 --- a/layout/style/nsCSSStyleSheet.h +++ b/layout/style/nsCSSStyleSheet.h @@ -44,6 +44,8 @@ #ifndef nsCSSStyleSheet_h_ #define nsCSSStyleSheet_h_ +#include "mozilla/Attributes.h" + #include "nscore.h" #include "nsCOMPtr.h" #include "nsAutoPtr.h" @@ -132,9 +134,9 @@ struct ChildSheetListBuilder; { 0x84, 0x67, 0x80, 0x3f, 0xb3, 0x2a, 0xf2, 0x0a } } -class NS_FINAL_CLASS nsCSSStyleSheet : public nsIStyleSheet, - public nsIDOMCSSStyleSheet, - public nsICSSLoaderObserver +class nsCSSStyleSheet : public nsIStyleSheet, + public nsIDOMCSSStyleSheet, + public nsICSSLoaderObserver { public: nsCSSStyleSheet(); @@ -271,9 +273,8 @@ private: nsIDocument* aDocumentToUse, nsIDOMNode* aOwningNodeToUse); - // These are not supported and are not implemented! - nsCSSStyleSheet(const nsCSSStyleSheet& aCopy); - nsCSSStyleSheet& operator=(const nsCSSStyleSheet& aCopy); + nsCSSStyleSheet(const nsCSSStyleSheet& aCopy) MOZ_DELETE; + nsCSSStyleSheet& operator=(const nsCSSStyleSheet& aCopy) MOZ_DELETE; protected: virtual ~nsCSSStyleSheet(); diff --git a/layout/xul/base/src/tree/src/nsTreeBodyFrame.h b/layout/xul/base/src/tree/src/nsTreeBodyFrame.h index 69127614a90b..474d80436422 100644 --- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.h +++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.h @@ -44,6 +44,8 @@ #ifndef nsTreeBodyFrame_h #define nsTreeBodyFrame_h +#include "mozilla/Attributes.h" + #include "nsLeafBoxFrame.h" #include "nsITreeView.h" #include "nsICSSPseudoComparator.h" @@ -77,7 +79,7 @@ struct nsTreeImageCacheEntry }; // The actual frame that paints the cells and rows. -class NS_FINAL_CLASS nsTreeBodyFrame +class nsTreeBodyFrame MOZ_FINAL : public nsLeafBoxFrame , public nsICSSPseudoComparator , public nsIScrollbarMediator diff --git a/mfbt/Attributes.h b/mfbt/Attributes.h index 11057a3c72b7..3a7c6d34e8d4 100644 --- a/mfbt/Attributes.h +++ b/mfbt/Attributes.h @@ -64,6 +64,7 @@ # if __clang_major__ >= 3 # define MOZ_HAVE_CXX11_DELETE # define MOZ_HAVE_CXX11_OVERRIDE +# define MOZ_HAVE_CXX11_FINAL final # elif __clang_major__ == 2 # if __clang_minor__ >= 9 # define MOZ_HAVE_CXX11_DELETE @@ -74,6 +75,7 @@ # if __GNUC__ > 4 # define MOZ_HAVE_CXX11_DELETE # define MOZ_HAVE_CXX11_OVERRIDE +# define MOZ_HAVE CXX11_FINAL final # elif __GNUC__ == 4 # if __GNUC_MINOR__ >= 7 # define MOZ_HAVE_CXX11_OVERRIDE @@ -82,10 +84,21 @@ # define MOZ_HAVE_CXX11_DELETE # endif # endif +# else + /* __final is a non-C++11 GCC synonym for 'final', per GCC r176655. */ +# if __GNUC__ > 4 +# define MOZ_HAVE_CXX11_FINAL __final +# elif __GNUC__ == 4 +# if __GNUC_MINOR__ >= 7 +# define MOZ_HAVE_CXX11_FINAL __final +# endif +# endif # endif #elif defined(_MSC_VER) # if _MSC_VER >= 1400 # define MOZ_HAVE_CXX11_OVERRIDE + /* MSVC currently spells "final" as "sealed". */ +# define MOZ_HAVE_CXX11_FINAL sealed # endif #endif @@ -158,4 +171,73 @@ # define MOZ_OVERRIDE /* no support */ #endif +/* + * MOZ_FINAL indicates that some functionality cannot be overridden through + * inheritance. It can be used to annotate either classes/structs or virtual + * member functions. + * + * To annotate a class/struct with MOZ_FINAL, place MOZ_FINAL immediately after + * the name of the class, before the list of classes from which it derives (if + * any) and before its opening brace. MOZ_FINAL must not be used to annotate + * unnamed classes or structs. (With some compilers, and with C++11 proper, the + * underlying expansion is ambiguous with specifying a class name.) + * + * class Base MOZ_FINAL + * { + * public: + * Base(); + * ~Base(); + * virtual void f() { } + * }; + * // This will be an error in some compilers: + * class Derived : public Base + * { + * public: + * ~Derived() { } + * }; + * + * One particularly common reason to specify MOZ_FINAL upon a class is to tell + * the compiler that it's not dangerous for it to have a non-virtual destructor + * yet have one or more virtual functions, silencing the warning it might emit + * in this case. Suppose Base above weren't annotated with MOZ_FINAL. Because + * ~Base() is non-virtual, an attempt to delete a Derived* through a Base* + * wouldn't call ~Derived(), so any cleanup ~Derived() might do wouldn't happen. + * (Formally C++ says behavior is undefined, but compilers will likely just call + * ~Base() and not ~Derived().) Specifying MOZ_FINAL tells the compiler that + * it's safe for the destructor to be non-virtual. + * + * In compilers implementing final controls, it is an error to inherit from a + * class annotated with MOZ_FINAL. In other compilers it serves only as + * documentation. + * + * To annotate a virtual member function with MOZ_FINAL, place MOZ_FINAL + * immediately before the ';' terminating the member function's declaration, or + * before '= 0;' if the member function is pure. If the member function is + * defined in the class definition, it should appear before the opening brace of + * the function body. (This placement is identical to that for MOZ_OVERRIDE. + * If both are used, they should appear in the order 'MOZ_FINAL MOZ_OVERRIDE' + * for consistency.) + * + * class Base + * { + * public: + * virtual void f() MOZ_FINAL; + * }; + * class Derived + * { + * public: + * // This will be an error in some compilers: + * virtual void f(); + * }; + * + * In compilers implementing final controls, it is an error for a derived class + * to override a method annotated with MOZ_FINAL. In other compilers it serves + * only as documentation. + */ +#if defined(MOZ_HAVE_CXX11_FINAL) +# define MOZ_FINAL MOZ_HAVE_CXX11_FINAL +#else +# define MOZ_FINAL /* no support */ +#endif + #endif /* mozilla_Attributes_h_ */ diff --git a/xpcom/base/nsConsoleMessage.h b/xpcom/base/nsConsoleMessage.h index 3d4a7e6cce20..c2f07edaae94 100644 --- a/xpcom/base/nsConsoleMessage.h +++ b/xpcom/base/nsConsoleMessage.h @@ -38,10 +38,12 @@ #ifndef __nsconsolemessage_h__ #define __nsconsolemessage_h__ +#include "mozilla/Attributes.h" + #include "nsIConsoleMessage.h" #include "nsString.h" -class nsConsoleMessage : public nsIConsoleMessage { +class nsConsoleMessage MOZ_FINAL : public nsIConsoleMessage { public: nsConsoleMessage(); nsConsoleMessage(const PRUnichar *message); diff --git a/xpcom/base/nsErrorService.h b/xpcom/base/nsErrorService.h index b9b1f0ff0bb4..e5331d570732 100644 --- a/xpcom/base/nsErrorService.h +++ b/xpcom/base/nsErrorService.h @@ -38,6 +38,8 @@ #ifndef nsErrorService_h__ #define nsErrorService_h__ +#include "mozilla/Attributes.h" + #include "nsIErrorService.h" #include "nsHashtable.h" @@ -54,7 +56,7 @@ protected: nsObjectHashtable mHashtable; }; -class nsErrorService : public nsIErrorService +class nsErrorService MOZ_FINAL : public nsIErrorService { public: NS_DECL_ISUPPORTS diff --git a/xpcom/glue/GenericFactory.h b/xpcom/glue/GenericFactory.h index f64ad242288b..727448daba8d 100644 --- a/xpcom/glue/GenericFactory.h +++ b/xpcom/glue/GenericFactory.h @@ -38,6 +38,8 @@ #ifndef mozilla_GenericFactory_h #define mozilla_GenericFactory_h +#include "mozilla/Attributes.h" + #include "mozilla/Module.h" namespace mozilla { @@ -47,7 +49,7 @@ namespace mozilla { * This class is intended for use by the component manager and the generic * module. */ -class GenericFactory : public nsIFactory +class GenericFactory MOZ_FINAL : public nsIFactory { public: typedef Module::ConstructorProcPtr ConstructorProcPtr; diff --git a/xpcom/glue/nsArrayEnumerator.cpp b/xpcom/glue/nsArrayEnumerator.cpp index 8e0d81561adf..4b6ea3395e7d 100644 --- a/xpcom/glue/nsArrayEnumerator.cpp +++ b/xpcom/glue/nsArrayEnumerator.cpp @@ -36,6 +36,8 @@ * * ***** END LICENSE BLOCK ***** */ +#include "mozilla/Attributes.h" + #include "nsArrayEnumerator.h" #include "nsIArray.h" @@ -44,7 +46,7 @@ #include "nsCOMArray.h" #include "nsCOMPtr.h" -class nsSimpleArrayEnumerator : public nsISimpleEnumerator +class nsSimpleArrayEnumerator MOZ_FINAL : public nsISimpleEnumerator { public: // nsISupports interface @@ -126,7 +128,7 @@ NS_NewArrayEnumerator(nsISimpleEnumerator* *result, // creates a snapshot of the array in question // you MUST use NS_NewArrayEnumerator to create this, so that // allocation is done correctly -class nsCOMArrayEnumerator : public nsISimpleEnumerator +class nsCOMArrayEnumerator MOZ_FINAL : public nsISimpleEnumerator { public: // nsISupports interface diff --git a/xpcom/glue/nsCOMPtr.h b/xpcom/glue/nsCOMPtr.h index a4ddd7eb0223..b58ab33b11d0 100644 --- a/xpcom/glue/nsCOMPtr.h +++ b/xpcom/glue/nsCOMPtr.h @@ -53,6 +53,7 @@ -- scc */ +#include "mozilla/Attributes.h" // Wrapping includes can speed up compiles (see "Large Scale C++ Software Design") #ifndef nsDebug_h___ @@ -277,8 +278,7 @@ class nsCOMPtr_helper class NS_COM_GLUE NS_STACK_CLASS - NS_FINAL_CLASS -nsQueryInterface +nsQueryInterface MOZ_FINAL { public: explicit @@ -513,9 +513,7 @@ nsCOMPtr_base // template class nsGetterAddRefs; template -class - NS_FINAL_CLASS -nsCOMPtr +class nsCOMPtr MOZ_FINAL #ifdef NSCAP_FEATURE_USE_BASE : private nsCOMPtr_base #endif diff --git a/xpcom/glue/nsEnumeratorUtils.cpp b/xpcom/glue/nsEnumeratorUtils.cpp index 96ea94b965e4..54d0321e7c10 100644 --- a/xpcom/glue/nsEnumeratorUtils.cpp +++ b/xpcom/glue/nsEnumeratorUtils.cpp @@ -40,6 +40,8 @@ * * ***** END LICENSE BLOCK ***** */ +#include "mozilla/Attributes.h" + #include "nsEnumeratorUtils.h" #include "nsISimpleEnumerator.h" @@ -124,7 +126,7 @@ NS_NewEmptyEnumerator(nsISimpleEnumerator** aResult) //////////////////////////////////////////////////////////////////////////////// -class nsSingletonEnumerator : public nsISimpleEnumerator +class nsSingletonEnumerator MOZ_FINAL : public nsISimpleEnumerator { public: NS_DECL_ISUPPORTS diff --git a/xpcom/glue/nsWeakReference.cpp b/xpcom/glue/nsWeakReference.cpp index a62d2a3fc560..23287368a3d6 100644 --- a/xpcom/glue/nsWeakReference.cpp +++ b/xpcom/glue/nsWeakReference.cpp @@ -40,10 +40,12 @@ // nsWeakReference.cpp +#include "mozilla/Attributes.h" + #include "nsWeakReference.h" #include "nsCOMPtr.h" -class nsWeakReference : public nsIWeakReference +class nsWeakReference MOZ_FINAL : public nsIWeakReference { public: // nsISupports...