Skip to content

Commit df3797a

Browse files
committed
Bug 758992 - Make the classes which use the XPCOM nsISupports implementation macros final, to avoid the warning about deleting using a pointer to a base class with virtual functions and no virtual dtor (XPCOM parts); r=bsmedberg
1 parent d2ff9e8 commit df3797a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+122
-73
lines changed

intl/uconv/src/nsConverterOutputStream.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "nsIOutputStream.h"
1010
#include "nsIConverterOutputStream.h"
1111
#include "nsCOMPtr.h"
12+
#include "mozilla/Attributes.h"
1213

1314
class nsIUnicodeEncoder;
1415
class nsIOutputStream;
@@ -18,7 +19,7 @@ class nsIOutputStream;
1819
{ 0xff8780a5, 0xbbb1, 0x4bc5, \
1920
{ 0x8e, 0xe7, 0x05, 0x7e, 0x7b, 0xc5, 0xc9, 0x25 } }
2021

21-
class nsConverterOutputStream : public nsIConverterOutputStream {
22+
class nsConverterOutputStream MOZ_FINAL : public nsIConverterOutputStream {
2223
public:
2324
nsConverterOutputStream() {}
2425

intl/uconv/src/nsUnicodeToUTF8.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#ifndef nsUnicodeToUTF8_h___
77
#define nsUnicodeToUTF8_h___
88

9+
#include "mozilla/Attributes.h"
10+
911
// Class ID for our UnicodeToUTF8 charset converter
1012
// {7C657D18-EC5E-11d2-8AAC-00600811A836}
1113
#define NS_UNICODETOUTF8_CID \
@@ -25,7 +27,7 @@
2527
* @created 05/Apr/1999
2628
* @author Catalin Rotaru [CATA]
2729
*/
28-
class nsUnicodeToUTF8 : public nsIUnicodeEncoder
30+
class nsUnicodeToUTF8 MOZ_FINAL : public nsIUnicodeEncoder
2931
{
3032
NS_DECL_ISUPPORTS
3133

xpcom/base/nsCycleCollector.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
#include "nsThreadUtils.h"
117117
#include "nsTArray.h"
118118
#include "mozilla/Services.h"
119+
#include "mozilla/Attributes.h"
119120
#include "nsICycleCollectorListener.h"
120121
#include "nsIXPConnect.h"
121122
#include "nsIJSRuntimeService.h"
@@ -1264,7 +1265,7 @@ struct CCGraphDescriber
12641265
Type mType;
12651266
};
12661267

1267-
class nsCycleCollectorLogger : public nsICycleCollectorListener
1268+
class nsCycleCollectorLogger MOZ_FINAL : public nsICycleCollectorListener
12681269
{
12691270
public:
12701271
nsCycleCollectorLogger() :

xpcom/base/nsInterfaceRequestorAgg.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
#include "nsInterfaceRequestorAgg.h"
66
#include "nsCOMPtr.h"
7+
#include "mozilla/Attributes.h"
78

8-
class nsInterfaceRequestorAgg : public nsIInterfaceRequestor
9+
class nsInterfaceRequestorAgg MOZ_FINAL : public nsIInterfaceRequestor
910
{
1011
public:
1112
NS_DECL_ISUPPORTS

xpcom/base/nsMacUtilsImpl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88

99
#include "nsIMacUtils.h"
1010
#include "nsString.h"
11+
#include "mozilla/Attributes.h"
1112

12-
class nsMacUtilsImpl : public nsIMacUtils
13+
class nsMacUtilsImpl MOZ_FINAL : public nsIMacUtils
1314
{
1415
public:
1516
NS_DECL_ISUPPORTS

xpcom/base/nsMemoryReporterManager.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "nsArrayEnumerator.h"
1212
#include "nsISimpleEnumerator.h"
1313
#include "mozilla/Telemetry.h"
14+
#include "mozilla/Attributes.h"
1415

1516
using namespace mozilla;
1617

@@ -687,15 +688,15 @@ struct MemoryReport {
687688
#ifdef DEBUG
688689
// This is just a wrapper for PRInt64 that implements nsISupports, so it can be
689690
// passed to nsIMemoryMultiReporter::CollectReports.
690-
class PRInt64Wrapper : public nsISupports {
691+
class PRInt64Wrapper MOZ_FINAL : public nsISupports {
691692
public:
692693
NS_DECL_ISUPPORTS
693694
PRInt64Wrapper() : mValue(0) { }
694695
PRInt64 mValue;
695696
};
696697
NS_IMPL_ISUPPORTS0(PRInt64Wrapper)
697698

698-
class ExplicitNonHeapCountingCallback : public nsIMemoryMultiReporterCallback
699+
class ExplicitNonHeapCountingCallback MOZ_FINAL : public nsIMemoryMultiReporterCallback
699700
{
700701
public:
701702
NS_DECL_ISUPPORTS

xpcom/base/nsMemoryReporterManager.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
#include "nsIMemoryReporter.h"
77
#include "nsCOMArray.h"
88
#include "mozilla/Mutex.h"
9+
#include "mozilla/Attributes.h"
910
#include "nsString.h"
1011

1112
using mozilla::Mutex;
1213

13-
class nsMemoryReporter : public nsIMemoryReporter
14+
class nsMemoryReporter MOZ_FINAL : public nsIMemoryReporter
1415
{
1516
public:
1617
NS_DECL_ISUPPORTS

xpcom/components/nsComponentManager.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "nsTArray.h"
3535

3636
#include "mozilla/Omnijar.h"
37+
#include "mozilla/Attributes.h"
3738

3839
struct nsFactoryEntry;
3940
class nsIServiceManager;
@@ -68,7 +69,7 @@ struct nsLoaderdata {
6869
nsCString type;
6970
};
7071

71-
class nsComponentManagerImpl
72+
class nsComponentManagerImpl MOZ_FINAL
7273
: public nsIComponentManager
7374
, public nsIServiceManager
7475
, public nsSupportsWeakReference

xpcom/ds/nsArray.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "nsCOMArray.h"
1111
#include "nsCOMPtr.h"
1212
#include "nsCycleCollectionParticipant.h"
13+
#include "mozilla/Attributes.h"
1314

1415
#define NS_ARRAY_CLASSNAME \
1516
"nsIArray implementation"
@@ -36,12 +37,12 @@ class nsArray : public nsIMutableArray
3637
NS_DECL_NSIMUTABLEARRAY
3738

3839
protected:
39-
~nsArray();
40+
virtual ~nsArray(); // nsArrayCC inherits from this
4041

4142
nsCOMArray_base mArray;
4243
};
4344

44-
class nsArrayCC : public nsArray
45+
class nsArrayCC MOZ_FINAL : public nsArray
4546
{
4647
public:
4748
nsArrayCC() : nsArray() { }

xpcom/ds/nsAtomService.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
#define __nsAtomService_h
88

99
#include "nsIAtomService.h"
10+
#include "mozilla/Attributes.h"
1011

11-
class nsAtomService : public nsIAtomService
12+
class nsAtomService MOZ_FINAL : public nsIAtomService
1213
{
1314
public:
1415
nsAtomService();

xpcom/ds/nsAtomTable.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
66

77
#include "mozilla/Assertions.h"
8+
#include "mozilla/Attributes.h"
89
#include "mozilla/HashFunctions.h"
910

1011
#include "nsAtomTable.h"
@@ -102,7 +103,7 @@ class AtomImpl : public nsIAtom {
102103
* A non-refcounted implementation of nsIAtom.
103104
*/
104105

105-
class PermanentAtomImpl : public AtomImpl {
106+
class PermanentAtomImpl MOZ_FINAL : public AtomImpl {
106107
public:
107108
PermanentAtomImpl(const nsAString& aString, PLDHashNumber aKeyHash)
108109
: AtomImpl(aString, aKeyHash)

xpcom/ds/nsHashPropertyBag.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "nsIVariant.h"
1212
#include "nsIProperty.h"
1313
#include "nsVariant.h"
14+
#include "mozilla/Attributes.h"
1415

1516
nsresult
1617
NS_NewHashPropertyBag(nsIWritablePropertyBag* *_retval)
@@ -110,7 +111,7 @@ nsHashPropertyBag::DeleteProperty(const nsAString& name)
110111
// nsSimpleProperty class and impl; used for GetEnumerator
111112
//
112113

113-
class nsSimpleProperty : public nsIProperty {
114+
class nsSimpleProperty MOZ_FINAL : public nsIProperty {
114115
public:
115116
nsSimpleProperty(const nsAString& aName, nsIVariant* aValue)
116117
: mName(aName), mValue(aValue)

xpcom/ds/nsINIParserImpl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
#include "nsINIParser.h"
1010
#include "nsStringEnumerator.h"
1111
#include "nsTArray.h"
12+
#include "mozilla/Attributes.h"
1213

13-
class nsINIParserImpl :
14+
class nsINIParserImpl MOZ_FINAL :
1415
public nsIINIParser
1516
{
1617
public:

xpcom/ds/nsINIParserImpl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include "nsIINIParser.h"
99
#include "nsIFactory.h"
10+
#include "mozilla/Attributes.h"
1011

1112
#define NS_INIPARSERFACTORY_CID \
1213
{ 0xdfac10a9, 0xdd24, 0x43cf, \
@@ -15,7 +16,7 @@
1516
#define NS_INIPARSERFACTORY_CONTRACTID \
1617
"@mozilla.org/xpcom/ini-parser-factory;1"
1718

18-
class nsINIParserFactory :
19+
class nsINIParserFactory MOZ_FINAL :
1920
public nsIINIParserFactory,
2021
public nsIFactory
2122
{

xpcom/ds/nsObserverList.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "nsIWeakReference.h"
1515
#include "nsHashKeys.h"
1616
#include "nsISimpleEnumerator.h"
17+
#include "mozilla/Attributes.h"
1718

1819
struct ObserverRef
1920
{
@@ -67,7 +68,7 @@ class nsObserverList : public nsCharPtrHashKey
6768
nsTArray<ObserverRef> mObservers;
6869
};
6970

70-
class nsObserverEnumerator : public nsISimpleEnumerator
71+
class nsObserverEnumerator MOZ_FINAL : public nsISimpleEnumerator
7172
{
7273
public:
7374
NS_DECL_ISUPPORTS

xpcom/ds/nsObserverService.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99
#include "nsIObserverService.h"
1010
#include "nsObserverList.h"
1111
#include "nsTHashtable.h"
12+
#include "mozilla/Attributes.h"
1213

1314
#define NS_OBSERVERSERVICE_CLASSNAME "Observer Service"
1415

1516
// {D07F5195-E3D1-11d2-8ACD-00105A1B8860}
1617
#define NS_OBSERVERSERVICE_CID \
1718
{ 0xd07f5195, 0xe3d1, 0x11d2, { 0x8a, 0xcd, 0x0, 0x10, 0x5a, 0x1b, 0x88, 0x60 } }
1819

19-
class nsObserverService : public nsIObserverService {
20+
class nsObserverService MOZ_FINAL : public nsIObserverService {
2021
public:
2122
NS_DECLARE_STATIC_IID_ACCESSOR(NS_OBSERVERSERVICE_CID)
2223

xpcom/ds/nsPersistentProperties.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
#include "plarena.h"
1212
#include "nsString.h"
1313
#include "nsCOMPtr.h"
14+
#include "mozilla/Attributes.h"
1415

1516
#include "nsIUnicharInputStream.h"
1617

1718

18-
class nsPersistentProperties : public nsIPersistentProperties
19+
class nsPersistentProperties MOZ_FINAL : public nsIPersistentProperties
1920
{
2021
public:
2122
nsPersistentProperties();
@@ -39,7 +40,7 @@ class nsPersistentProperties : public nsIPersistentProperties
3940
PLArenaPool mArena;
4041
};
4142

42-
class nsPropertyElement : public nsIPropertyElement
43+
class nsPropertyElement MOZ_FINAL : public nsIPropertyElement
4344
{
4445
public:
4546
nsPropertyElement()

xpcom/ds/nsProperties.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "nsInterfaceHashtable.h"
1111
#include "nsHashKeys.h"
1212
#include "nsAgg.h"
13+
#include "mozilla/Attributes.h"
1314

1415
#define NS_PROPERTIES_CID \
1516
{ /* 4de2bc90-b1bf-11d3-93b6-00104ba0fd40 */ \
@@ -24,8 +25,8 @@ class nsIUnicharInputStream;
2425
typedef nsInterfaceHashtable<nsCharPtrHashKey, nsISupports>
2526
nsProperties_HashBase;
2627

27-
class nsProperties : public nsIProperties,
28-
public nsProperties_HashBase {
28+
class nsProperties MOZ_FINAL : public nsIProperties,
29+
public nsProperties_HashBase {
2930
public:
3031

3132
NS_DECL_AGGREGATED

xpcom/ds/nsStringEnumerator.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111
#include "nsReadableUtils.h"
1212
#include "nsISimpleEnumerator.h"
1313
#include "nsSupportsPrimitives.h"
14+
#include "mozilla/Attributes.h"
1415

1516
//
1617
// nsStringEnumerator
1718
//
1819

19-
class nsStringEnumerator : public nsIStringEnumerator,
20-
public nsIUTF8StringEnumerator,
21-
public nsISimpleEnumerator
20+
class nsStringEnumerator MOZ_FINAL : public nsIStringEnumerator,
21+
public nsIUTF8StringEnumerator,
22+
public nsISimpleEnumerator
2223
{
2324
public:
2425
nsStringEnumerator(const nsTArray<nsString>* aArray, bool aOwnsArray) :

xpcom/ds/nsSupportsArray.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ NS_NewISupportsArray(nsISupportsArray** aInstancePtrResult)
648648
return rv;
649649
}
650650

651-
class nsArrayEnumerator : public nsISimpleEnumerator
651+
class nsArrayEnumerator MOZ_FINAL : public nsISimpleEnumerator
652652
{
653653
public:
654654
// nsISupports interface

xpcom/ds/nsSupportsArray.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
//#define DEBUG_SUPPORTSARRAY 1
1010

1111
#include "nsISupportsArray.h"
12+
#include "mozilla/Attributes.h"
1213

1314
static const PRUint32 kAutoArraySize = 8;
1415

15-
class nsSupportsArray : public nsISupportsArray {
16+
class nsSupportsArray MOZ_FINAL : public nsISupportsArray {
1617
public:
1718
nsSupportsArray(void);
1819
~nsSupportsArray(void); // nonvirtual since we're not subclassed

xpcom/ds/nsSupportsArrayEnumerator.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
#define nsSupportsArrayEnumerator_h___
88

99
#include "nsIEnumerator.h"
10+
#include "mozilla/Attributes.h"
1011

1112
class nsISupportsArray;
1213

13-
class nsSupportsArrayEnumerator : public nsIBidirectionalEnumerator {
14+
class nsSupportsArrayEnumerator MOZ_FINAL : public nsIBidirectionalEnumerator {
1415
public:
1516
NS_DECL_ISUPPORTS
1617

xpcom/ds/nsUnicharBuffer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
#define nsUnicharBuffer_h__
88

99
#include "nsIUnicharBuffer.h"
10+
#include "mozilla/Attributes.h"
1011

11-
class UnicharBufferImpl : public nsIUnicharBuffer {
12+
class UnicharBufferImpl MOZ_FINAL : public nsIUnicharBuffer {
1213
public:
1314
UnicharBufferImpl();
1415

xpcom/ds/nsVariant.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "nsIVariant.h"
1313
#include "nsStringFwd.h"
1414
#include "xpt_struct.h"
15+
#include "mozilla/Attributes.h"
1516

1617
class nsCycleCollectionTraversalCallback;
1718

@@ -83,7 +84,7 @@ struct nsDiscriminatedUnion
8384
* use to help them do all the 'standard' nsIVariant data conversions.
8485
*/
8586

86-
class nsVariant : public nsIWritableVariant
87+
class nsVariant MOZ_FINAL : public nsIWritableVariant
8788
{
8889
public:
8990
NS_DECL_ISUPPORTS

xpcom/glue/nsEnumeratorUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ NS_NewSingletonEnumerator(nsISimpleEnumerator* *result,
165165

166166
////////////////////////////////////////////////////////////////////////////////
167167

168-
class nsUnionEnumerator : public nsISimpleEnumerator
168+
class nsUnionEnumerator MOZ_FINAL : public nsISimpleEnumerator
169169
{
170170
public:
171171
NS_DECL_ISUPPORTS

0 commit comments

Comments
 (0)