Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit fa9c49f

Browse files
committed
Bug 1330235 - Remove NS_STDCALL_FUNCPROTO and replace its usage with decltype. r=froydnj
MozReview-Commit-ID: 5jrTqTfDzSk --HG-- extra : rebase_source : e2345a4f518757ed9760618d07599a60353875cc
1 parent c821469 commit fa9c49f

6 files changed

Lines changed: 15 additions & 76 deletions

File tree

dom/base/nsContentPolicy.h

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,8 @@ class nsContentPolicy : public nsIContentPolicy
3535
nsCOMPtr<nsIContentPolicy> mCSPService;
3636

3737
//Helper type for CheckPolicy
38-
typedef
39-
NS_STDCALL_FUNCPROTO(nsresult, CPMethod, nsIContentPolicy,
40-
ShouldProcess,
41-
(uint32_t, nsIURI*, nsIURI*, nsISupports*,
42-
const nsACString &, nsISupports*, nsIPrincipal*,
43-
int16_t*));
44-
45-
typedef
46-
NS_STDCALL_FUNCPROTO(nsresult, SCPMethod, nsISimpleContentPolicy,
47-
ShouldProcess,
48-
(uint32_t, nsIURI*, nsIURI*, nsIDOMElement*, bool,
49-
const nsACString &, nsISupports*, nsIPrincipal*,
50-
int16_t*));
38+
typedef decltype(&nsIContentPolicy::ShouldProcess) CPMethod;
39+
typedef decltype(&nsISimpleContentPolicy::ShouldProcess) SCPMethod;
5140

5241
//Helper method that applies policyMethod across all policies in mPolicies
5342
// with the given parameters

layout/style/nsCSSRules.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,7 @@ class nsCSSCounterStyleRule final : public mozilla::css::Rule,
567567
JS::Handle<JSObject*> aGivenProto) override;
568568

569569
private:
570-
typedef NS_STDCALL_FUNCPROTO(nsresult, Getter, nsCSSCounterStyleRule,
571-
GetSymbols, (nsAString&));
570+
typedef decltype(&nsCSSCounterStyleRule::GetSymbols) Getter;
572571
static const Getter kGetters[];
573572

574573
nsresult GetDescriptor(nsCSSCounterDesc aDescID, nsAString& aValue);

rdf/base/nsRDFContentSink.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,8 @@ enum RDFContentSinkParseMode {
8585
eRDFContentSinkParseMode_Date
8686
};
8787

88-
typedef
89-
NS_STDCALL_FUNCPROTO(nsresult,
90-
nsContainerTestFn,
91-
nsIRDFContainerUtils, IsAlt,
92-
(nsIRDFDataSource*, nsIRDFResource*, bool*));
93-
94-
typedef
95-
NS_STDCALL_FUNCPROTO(nsresult,
96-
nsMakeContainerFn,
97-
nsIRDFContainerUtils, MakeAlt,
98-
(nsIRDFDataSource*, nsIRDFResource*, nsIRDFContainer**));
88+
typedef decltype(&nsIRDFContainerUtils::IsAlt) nsContainerTestFn;
89+
typedef decltype(&nsIRDFContainerUtils::MakeAlt) nsMakeContainerFn;
9990

10091
class RDFContentSinkImpl : public nsIRDFContentSink,
10192
public nsIExpatSink

toolkit/components/places/nsNavHistoryQuery.cpp

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,9 @@ static nsresult ParseQueryBooleanString(const nsCString& aString,
5656
bool* aValue);
5757

5858
// query getters
59-
typedef NS_STDCALL_FUNCPROTO(nsresult, BoolQueryGetter, nsINavHistoryQuery,
60-
GetOnlyBookmarked, (bool*));
61-
typedef NS_STDCALL_FUNCPROTO(nsresult, Uint32QueryGetter, nsINavHistoryQuery,
62-
GetBeginTimeReference, (uint32_t*));
63-
typedef NS_STDCALL_FUNCPROTO(nsresult, Int64QueryGetter, nsINavHistoryQuery,
64-
GetBeginTime, (int64_t*));
59+
typedef decltype(&nsINavHistoryQuery::GetOnlyBookmarked) BoolQueryGetter;
60+
typedef decltype(&nsINavHistoryQuery::GetBeginTimeReference) Uint32QueryGetter;
61+
typedef decltype(&nsINavHistoryQuery::GetBeginTime) Int64QueryGetter;
6562
static void AppendBoolKeyValueIfTrue(nsACString& aString,
6663
const nsCString& aName,
6764
nsINavHistoryQuery* aQuery,
@@ -76,12 +73,9 @@ static void AppendInt64KeyValueIfNonzero(nsACString& aString,
7673
Int64QueryGetter getter);
7774

7875
// query setters
79-
typedef NS_STDCALL_FUNCPROTO(nsresult, BoolQuerySetter, nsINavHistoryQuery,
80-
SetOnlyBookmarked, (bool));
81-
typedef NS_STDCALL_FUNCPROTO(nsresult, Uint32QuerySetter, nsINavHistoryQuery,
82-
SetBeginTimeReference, (uint32_t));
83-
typedef NS_STDCALL_FUNCPROTO(nsresult, Int64QuerySetter, nsINavHistoryQuery,
84-
SetBeginTime, (int64_t));
76+
typedef decltype(&nsINavHistoryQuery::SetOnlyBookmarked) BoolQuerySetter;
77+
typedef decltype(&nsINavHistoryQuery::SetBeginTimeReference) Uint32QuerySetter;
78+
typedef decltype(&nsINavHistoryQuery::SetBeginTime) Int64QuerySetter;
8579
static void SetQueryKeyBool(const nsCString& aValue, nsINavHistoryQuery* aQuery,
8680
BoolQuerySetter setter);
8781
static void SetQueryKeyUint32(const nsCString& aValue, nsINavHistoryQuery* aQuery,
@@ -90,15 +84,9 @@ static void SetQueryKeyInt64(const nsCString& aValue, nsINavHistoryQuery* aQuery
9084
Int64QuerySetter setter);
9185

9286
// options setters
93-
typedef NS_STDCALL_FUNCPROTO(nsresult, BoolOptionsSetter,
94-
nsINavHistoryQueryOptions,
95-
SetExpandQueries, (bool));
96-
typedef NS_STDCALL_FUNCPROTO(nsresult, Uint32OptionsSetter,
97-
nsINavHistoryQueryOptions,
98-
SetMaxResults, (uint32_t));
99-
typedef NS_STDCALL_FUNCPROTO(nsresult, Uint16OptionsSetter,
100-
nsINavHistoryQueryOptions,
101-
SetResultType, (uint16_t));
87+
typedef decltype(&nsINavHistoryQueryOptions::SetExpandQueries) BoolOptionsSetter;
88+
typedef decltype(&nsINavHistoryQueryOptions::SetMaxResults) Uint32OptionsSetter;
89+
typedef decltype(&nsINavHistoryQueryOptions::SetResultType) Uint16OptionsSetter;
10290
static void SetOptionsKeyBool(const nsCString& aValue,
10391
nsINavHistoryQueryOptions* aOptions,
10492
BoolOptionsSetter setter);

widget/cocoa/nsMenuItemIconX.mm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@
5050
static const uint32_t kIconWidth = 16;
5151
static const uint32_t kIconHeight = 16;
5252

53-
typedef NS_STDCALL_FUNCPROTO(nsresult, GetRectSideMethod, nsIDOMRect,
54-
GetBottom, (nsIDOMCSSPrimitiveValue**));
53+
typedef decltype(&nsIDOMRect::GetBottom) GetRectSideMethod;
5554

5655
NS_IMPL_ISUPPORTS(nsMenuItemIconX, imgINotificationObserver)
5756

xpcom/base/nscore.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -133,33 +133,6 @@
133133
#define NS_IMETHOD NS_IMETHOD_(nsresult)
134134
#define NS_IMETHODIMP NS_IMETHODIMP_(nsresult)
135135

136-
/**
137-
* Macro for creating typedefs for pointer-to-member types which are
138-
* declared with stdcall. It is important to use this for any type which is
139-
* declared as stdcall (i.e. NS_IMETHOD). For example, instead of writing:
140-
*
141-
* typedef nsresult (nsIFoo::*someType)(nsISupports* arg);
142-
*
143-
* you should write:
144-
*
145-
* typedef
146-
* NS_STDCALL_FUNCPROTO(nsresult, someType, nsIFoo, typeFunc, (nsISupports*));
147-
*
148-
* where nsIFoo::typeFunc is any method declared as
149-
* NS_IMETHOD typeFunc(nsISupports*);
150-
*
151-
* XXX this can be simplified to always use the non-typeof implementation
152-
* when http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11893 is fixed.
153-
*/
154-
155-
#ifdef __GNUC__
156-
#define NS_STDCALL_FUNCPROTO(ret, name, class, func, args) \
157-
typeof(&class::func) name
158-
#else
159-
#define NS_STDCALL_FUNCPROTO(ret, name, class, func, args) \
160-
ret (NS_STDCALL class::*name) args
161-
#endif
162-
163136
/**
164137
* Deprecated declarations.
165138
*/

0 commit comments

Comments
 (0)