From d4ce06cca8f735d48911b52756baa8ba0a2916b5 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Wed, 16 Nov 2016 17:08:26 +0100 Subject: [PATCH] Bug 1318004 - Use C++11's override and remove virtual where applicable. r=Ehsan MozReview-Commit-ID: H9tAe0YN1tx --HG-- extra : rebase_source : a11a03af4105afaae2945d2e0cad4eee65022f37 --- .../osfile/NativeOSFileInternals.cpp | 4 +- toolkit/components/telemetry/Telemetry.cpp | 2 +- .../components/telemetry/TelemetryScalar.cpp | 10 ++-- .../components/terminator/nsTerminator.cpp | 3 +- toolkit/identity/IdentityCryptoService.cpp | 8 +-- toolkit/mozapps/update/updater/updater.cpp | 58 +++++++++---------- 6 files changed, 42 insertions(+), 43 deletions(-) diff --git a/toolkit/components/osfile/NativeOSFileInternals.cpp b/toolkit/components/osfile/NativeOSFileInternals.cpp index e4725d390de9..249484489075 100644 --- a/toolkit/components/osfile/NativeOSFileInternals.cpp +++ b/toolkit/components/osfile/NativeOSFileInternals.cpp @@ -741,7 +741,7 @@ public: , mResult(new TypedArrayResult(TimeStamp::Now())) { } - ~DoReadToTypedArrayEvent() { + ~DoReadToTypedArrayEvent() override { // If AbstractReadEvent::Run() has bailed out, we may need to cleanup // mResult, which is main-thread only data if (!mResult) { @@ -778,7 +778,7 @@ public: , mResult(new StringResult(TimeStamp::Now())) { } - ~DoReadToStringEvent() { + ~DoReadToStringEvent() override { // If AbstraactReadEvent::Run() has bailed out, we may need to cleanup // mResult, which is main-thread only data if (!mResult) { diff --git a/toolkit/components/telemetry/Telemetry.cpp b/toolkit/components/telemetry/Telemetry.cpp index d7194fb3a385..8f96746202d4 100644 --- a/toolkit/components/telemetry/Telemetry.cpp +++ b/toolkit/components/telemetry/Telemetry.cpp @@ -429,7 +429,7 @@ public: * An implementation of Observe that records statistics of all * file IO operations. */ - void Observe(Observation& aOb); + void Observe(Observation& aOb) override; /** * Reflect recorded file IO statistics into Javascript diff --git a/toolkit/components/telemetry/TelemetryScalar.cpp b/toolkit/components/telemetry/TelemetryScalar.cpp index a64eb04675b9..47c17f3c4013 100644 --- a/toolkit/components/telemetry/TelemetryScalar.cpp +++ b/toolkit/components/telemetry/TelemetryScalar.cpp @@ -154,7 +154,7 @@ ScalarInfo::expiration() const class ScalarBase { public: - virtual ~ScalarBase() = default;; + virtual ~ScalarBase() = default; // Set, Add and SetMaximum functions as described in the Telemetry IDL. virtual ScalarResult SetValue(nsIVariant* aValue) = 0; @@ -194,7 +194,7 @@ public: using ScalarBase::SetValue; ScalarUnsigned() : mStorage(0) {}; - ~ScalarUnsigned() = default;; + ~ScalarUnsigned() override = default; ScalarResult SetValue(nsIVariant* aValue) final; void SetValue(uint32_t aValue) final; @@ -334,7 +334,7 @@ public: using ScalarBase::SetValue; ScalarString() : mStorage(EmptyString()) {}; - ~ScalarString() = default;; + ~ScalarString() override = default; ScalarResult SetValue(nsIVariant* aValue) final; ScalarResult SetValue(const nsAString& aValue) final; @@ -415,7 +415,7 @@ public: using ScalarBase::SetValue; ScalarBoolean() : mStorage(false) {}; - ~ScalarBoolean() = default;; + ~ScalarBoolean() override = default; ScalarResult SetValue(nsIVariant* aValue) final; void SetValue(bool aValue) final; @@ -514,7 +514,7 @@ public: typedef mozilla::Pair> KeyValuePair; explicit KeyedScalar(uint32_t aScalarKind) : mScalarKind(aScalarKind) {}; - ~KeyedScalar() = default;; + ~KeyedScalar() = default; // Set, Add and SetMaximum functions as described in the Telemetry IDL. // These methods implicitly instantiate a Scalar[*] for each key. diff --git a/toolkit/components/terminator/nsTerminator.cpp b/toolkit/components/terminator/nsTerminator.cpp index 2c096bb2fc07..9a54760b190f 100644 --- a/toolkit/components/terminator/nsTerminator.cpp +++ b/toolkit/components/terminator/nsTerminator.cpp @@ -175,8 +175,7 @@ class PR_CloseDelete public: constexpr PR_CloseDelete() = default; - PR_CloseDelete(const PR_CloseDelete& aOther) - = default; + PR_CloseDelete(const PR_CloseDelete& aOther) = default; void operator()(PRFileDesc* aPtr) const { diff --git a/toolkit/identity/IdentityCryptoService.cpp b/toolkit/identity/IdentityCryptoService.cpp index 192c6e77fc5a..0aeaed2f3f94 100644 --- a/toolkit/identity/IdentityCryptoService.cpp +++ b/toolkit/identity/IdentityCryptoService.cpp @@ -56,7 +56,7 @@ public: KeyPair(SECKEYPrivateKey* aPrivateKey, SECKEYPublicKey* aPublicKey); private: - ~KeyPair() + ~KeyPair() override { nsNSSShutDownPreventionLock locker; if (isAlreadyShutDown()) { @@ -96,7 +96,7 @@ public: KeyGenRunnable(KeyType keyType, nsIIdentityKeyGenCallback * aCallback); private: - ~KeyGenRunnable() + ~KeyGenRunnable() override { nsNSSShutDownPreventionLock locker; if (isAlreadyShutDown()) { @@ -106,7 +106,7 @@ private: shutdown(ShutdownCalledFrom::Object); } - virtual void virtualDestroyNSSReference() override + void virtualDestroyNSSReference() override { destructorSafeDestroyNSSReference(); } @@ -133,7 +133,7 @@ public: nsIIdentitySignCallback * aCallback); private: - ~SignRunnable() + ~SignRunnable() override { nsNSSShutDownPreventionLock locker; if (isAlreadyShutDown()) { diff --git a/toolkit/mozapps/update/updater/updater.cpp b/toolkit/mozapps/update/updater/updater.cpp index 6e8d639df10f..e50938defd8f 100644 --- a/toolkit/mozapps/update/updater/updater.cpp +++ b/toolkit/mozapps/update/updater/updater.cpp @@ -1115,10 +1115,10 @@ class RemoveFile : public Action public: RemoveFile() : mSkip(0) { } - int Parse(NS_tchar *line); - int Prepare(); - int Execute(); - void Finish(int status); + int Parse(NS_tchar *line) override; + int Prepare() override; + int Execute() override; + void Finish(int status) override; private: mozilla::UniquePtr mFile; @@ -1246,10 +1246,10 @@ class RemoveDir : public Action public: RemoveDir() : mSkip(0) { } - virtual int Parse(NS_tchar *line); - virtual int Prepare(); // check that the source dir exists - virtual int Execute(); - virtual void Finish(int status); + int Parse(NS_tchar *line) override; + int Prepare() override; // check that the source dir exists + int Execute() override; + void Finish(int status) override; private: mozilla::UniquePtr mDir; @@ -1363,10 +1363,10 @@ class AddFile : public Action public: AddFile() : mAdded(false) { } - virtual int Parse(NS_tchar *line); - virtual int Prepare(); - virtual int Execute(); - virtual void Finish(int status); + int Parse(NS_tchar *line) override; + int Prepare() override; + int Execute() override; + void Finish(int status) override; private: mozilla::UniquePtr mFile; @@ -1466,12 +1466,12 @@ class PatchFile : public Action public: PatchFile() : mPatchFile(nullptr), mPatchIndex(-1), buf(nullptr) { } - virtual ~PatchFile(); + ~PatchFile() override; - virtual int Parse(NS_tchar *line); - virtual int Prepare(); // should check for patch file and for checksum here - virtual int Execute(); - virtual void Finish(int status); + int Parse(NS_tchar *line) override; + int Prepare() override; // should check for patch file and for checksum here + int Execute() override; + void Finish(int status) override; private: int LoadSourceFile(FILE* ofile); @@ -1787,10 +1787,10 @@ PatchFile::Finish(int status) class AddIfFile : public AddFile { public: - virtual int Parse(NS_tchar *line); - virtual int Prepare(); - virtual int Execute(); - virtual void Finish(int status); + int Parse(NS_tchar *line) override; + int Prepare() override; + int Execute() override; + void Finish(int status) override; protected: mozilla::UniquePtr mTestFile; @@ -1848,10 +1848,10 @@ AddIfFile::Finish(int status) class AddIfNotFile : public AddFile { public: - virtual int Parse(NS_tchar *line); - virtual int Prepare(); - virtual int Execute(); - virtual void Finish(int status); + int Parse(NS_tchar *line) override; + int Prepare() override; + int Execute() override; + void Finish(int status) override; protected: mozilla::UniquePtr mTestFile; @@ -1909,10 +1909,10 @@ AddIfNotFile::Finish(int status) class PatchIfFile : public PatchFile { public: - virtual int Parse(NS_tchar *line); - virtual int Prepare(); // should check for patch file and for checksum here - virtual int Execute(); - virtual void Finish(int status); + int Parse(NS_tchar *line) override; + int Prepare() override; // should check for patch file and for checksum here + int Execute() override; + void Finish(int status) override; private: mozilla::UniquePtr mTestFile;