Bug 1317954 - Use C++11's override and remove virtual where applicable in xpcom/. draft
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Wed, 16 Nov 2016 14:27:07 +0200
changeset 441045 541a3496ba9fe73d3e9cd3924191d78d85e11887
parent 441044 fb7a697c952ef7e745e8e4369c6f56079e54937f
child 537478 7b1c50c06e0d3a19e82bda62fce807e1b6932b5b
push id36341
push userbmo:bpostelnicu@mozilla.com
push dateFri, 18 Nov 2016 09:38:52 +0000
bugs1317954
milestone53.0a1
Bug 1317954 - Use C++11's override and remove virtual where applicable in xpcom/. MozReview-Commit-ID: 2XXoxNHYCKm
xpcom/build/NSPRInterposer.cpp
xpcom/glue/nsWeakReference.cpp
xpcom/tests/gtest/TestCOMPtr.cpp
xpcom/tests/gtest/TestHashtables.cpp
xpcom/tests/gtest/TestNsRefPtr.cpp
--- a/xpcom/build/NSPRInterposer.cpp
+++ b/xpcom/build/NSPRInterposer.cpp
@@ -31,17 +31,17 @@ PRFileInfo64FN sFileInfo64Fn = nullptr;
 class NSPRIOAutoObservation : public IOInterposeObserver::Observation
 {
 public:
   explicit NSPRIOAutoObservation(IOInterposeObserver::Operation aOp)
     : IOInterposeObserver::Observation(aOp, "NSPRIOInterposer")
   {
   }
 
-  ~NSPRIOAutoObservation()
+  ~NSPRIOAutoObservation() override
   {
     Report();
   }
 };
 
 PRStatus PR_CALLBACK
 interposedClose(PRFileDesc* aFd)
 {
--- a/xpcom/glue/nsWeakReference.cpp
+++ b/xpcom/glue/nsWeakReference.cpp
@@ -31,17 +31,17 @@
 class nsWeakReference final : public nsIWeakReference
 {
 public:
   // nsISupports...
   NS_DECL_ISUPPORTS
 
   // nsIWeakReference...
   NS_DECL_NSIWEAKREFERENCE
-  virtual size_t SizeOfOnlyThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
+  size_t SizeOfOnlyThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
 
 private:
   MOZ_WEAKREF_DECL_OWNINGTHREAD
 
   friend class nsSupportsWeakReference;
 
   explicit nsWeakReference(nsSupportsWeakReference* aReferent)
     : mReferent(aReferent)
--- a/xpcom/tests/gtest/TestCOMPtr.cpp
+++ b/xpcom/tests/gtest/TestCOMPtr.cpp
@@ -20,19 +20,19 @@ class IFoo : public nsISupports
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFOO_IID)
 
 public:
   IFoo();
   // virtual dtor because IBar uses our Release()
   virtual ~IFoo();
 
-  NS_IMETHOD_(MozExternalRefCountType) AddRef();
-  NS_IMETHOD_(MozExternalRefCountType) Release();
-  NS_IMETHOD QueryInterface( const nsIID&, void** );
+  NS_IMETHOD_(MozExternalRefCountType) AddRef() override;
+  NS_IMETHOD_(MozExternalRefCountType) Release() override;
+  NS_IMETHOD QueryInterface( const nsIID&, void** ) override;
 
   unsigned int refcount_;
 
   static int total_constructions_;
   static int total_destructions_;
   static int total_queries_;
 };
 
@@ -130,19 +130,19 @@ return_a_IFoo()
 
 class IBar : public IFoo
 {
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_IBAR_IID)
 
 public:
   IBar();
-  virtual ~IBar();
+  ~IBar() override;
 
-  NS_IMETHOD QueryInterface( const nsIID&, void** );
+  NS_IMETHOD QueryInterface( const nsIID&, void** ) override;
 
   static int total_destructions_;
   static int total_queries_;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(IBar, NS_IBAR_IID)
 
 int IBar::total_destructions_;
--- a/xpcom/tests/gtest/TestHashtables.cpp
+++ b/xpcom/tests/gtest/TestHashtables.cpp
@@ -139,19 +139,19 @@ testTHashtable(nsTHashtable<EntityToUnic
 
 class IFoo final : public nsISupports
   {
     public:
       NS_DECLARE_STATIC_IID_ACCESSOR(NS_IFOO_IID)
 
       IFoo();
 
-      NS_IMETHOD_(MozExternalRefCountType) AddRef();
-      NS_IMETHOD_(MozExternalRefCountType) Release();
-      NS_IMETHOD QueryInterface( const nsIID&, void** );
+      NS_IMETHOD_(MozExternalRefCountType) AddRef() override;
+      NS_IMETHOD_(MozExternalRefCountType) Release() override;
+      NS_IMETHOD QueryInterface( const nsIID&, void** ) override;
 
       NS_IMETHOD SetString(const nsACString& /*in*/ aString);
       NS_IMETHOD GetString(nsACString& /*out*/ aString);
 
       static void print_totals();
 
     private:
       ~IFoo();
--- a/xpcom/tests/gtest/TestNsRefPtr.cpp
+++ b/xpcom/tests/gtest/TestNsRefPtr.cpp
@@ -23,19 +23,19 @@ class Foo : public nsISupports
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_FOO_IID)
 
 public:
   Foo();
   // virtual dtor because Bar uses our Release()
   virtual ~Foo();
 
-  NS_IMETHOD_(MozExternalRefCountType) AddRef();
-  NS_IMETHOD_(MozExternalRefCountType) Release();
-  NS_IMETHOD QueryInterface( const nsIID&, void** );
+  NS_IMETHOD_(MozExternalRefCountType) AddRef() override;
+  NS_IMETHOD_(MozExternalRefCountType) Release() override;
+  NS_IMETHOD QueryInterface( const nsIID&, void** ) override;
   void MemberFunction( int, int*, int& );
   virtual void VirtualMemberFunction( int, int*, int& );
   virtual void VirtualConstMemberFunction( int, int*, int& ) const;
 
   void NonconstMethod() {}
   void ConstMethod() const {}
 
   int refcount_;
@@ -158,22 +158,22 @@ return_a_Foo()
 
 class Bar : public Foo
 {
 public:
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_BAR_IID)
 
 public:
   Bar();
-  virtual ~Bar();
+  ~Bar() override;
 
   NS_IMETHOD QueryInterface( const nsIID&, void** ) override;
 
-  virtual void VirtualMemberFunction( int, int*, int& ) override;
-  virtual void VirtualConstMemberFunction( int, int*, int& ) const override;
+  void VirtualMemberFunction( int, int*, int& ) override;
+  void VirtualConstMemberFunction( int, int*, int& ) const override;
 
   static int total_constructions_;
   static int total_destructions_;
   static int total_queries_;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(Bar, NS_BAR_IID)