Skip to content

Commit

Permalink
Bug 1330235 - Remove NS_STDCALL_FUNCPROTO and replace its usage with …
Browse files Browse the repository at this point in the history
…decltype. r=froydnj

MozReview-Commit-ID: 5jrTqTfDzSk
  • Loading branch information
upsuper committed May 9, 2017
1 parent 2d4e33a commit cb6d98e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 76 deletions.
15 changes: 2 additions & 13 deletions dom/base/nsContentPolicy.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,8 @@ class nsContentPolicy : public nsIContentPolicy
nsCOMPtr<nsIContentPolicy> mCSPService;

//Helper type for CheckPolicy
typedef
NS_STDCALL_FUNCPROTO(nsresult, CPMethod, nsIContentPolicy,
ShouldProcess,
(uint32_t, nsIURI*, nsIURI*, nsISupports*,
const nsACString &, nsISupports*, nsIPrincipal*,
int16_t*));

typedef
NS_STDCALL_FUNCPROTO(nsresult, SCPMethod, nsISimpleContentPolicy,
ShouldProcess,
(uint32_t, nsIURI*, nsIURI*, nsIDOMElement*, bool,
const nsACString &, nsISupports*, nsIPrincipal*,
int16_t*));
typedef decltype(&nsIContentPolicy::ShouldProcess) CPMethod;
typedef decltype(&nsISimpleContentPolicy::ShouldProcess) SCPMethod;

//Helper method that applies policyMethod across all policies in mPolicies
// with the given parameters
Expand Down
3 changes: 1 addition & 2 deletions layout/style/nsCSSRules.h
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,7 @@ class nsCSSCounterStyleRule final : public mozilla::css::Rule,
JS::Handle<JSObject*> aGivenProto) override;

private:
typedef NS_STDCALL_FUNCPROTO(nsresult, Getter, nsCSSCounterStyleRule,
GetSymbols, (nsAString&));
typedef decltype(&nsCSSCounterStyleRule::GetSymbols) Getter;
static const Getter kGetters[];

nsresult GetDescriptor(nsCSSCounterDesc aDescID, nsAString& aValue);
Expand Down
13 changes: 2 additions & 11 deletions rdf/base/nsRDFContentSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,8 @@ enum RDFContentSinkParseMode {
eRDFContentSinkParseMode_Date
};

typedef
NS_STDCALL_FUNCPROTO(nsresult,
nsContainerTestFn,
nsIRDFContainerUtils, IsAlt,
(nsIRDFDataSource*, nsIRDFResource*, bool*));

typedef
NS_STDCALL_FUNCPROTO(nsresult,
nsMakeContainerFn,
nsIRDFContainerUtils, MakeAlt,
(nsIRDFDataSource*, nsIRDFResource*, nsIRDFContainer**));
typedef decltype(&nsIRDFContainerUtils::IsAlt) nsContainerTestFn;
typedef decltype(&nsIRDFContainerUtils::MakeAlt) nsMakeContainerFn;

class RDFContentSinkImpl : public nsIRDFContentSink,
public nsIExpatSink
Expand Down
30 changes: 9 additions & 21 deletions toolkit/components/places/nsNavHistoryQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,9 @@ static nsresult ParseQueryBooleanString(const nsCString& aString,
bool* aValue);

// query getters
typedef NS_STDCALL_FUNCPROTO(nsresult, BoolQueryGetter, nsINavHistoryQuery,
GetOnlyBookmarked, (bool*));
typedef NS_STDCALL_FUNCPROTO(nsresult, Uint32QueryGetter, nsINavHistoryQuery,
GetBeginTimeReference, (uint32_t*));
typedef NS_STDCALL_FUNCPROTO(nsresult, Int64QueryGetter, nsINavHistoryQuery,
GetBeginTime, (int64_t*));
typedef decltype(&nsINavHistoryQuery::GetOnlyBookmarked) BoolQueryGetter;
typedef decltype(&nsINavHistoryQuery::GetBeginTimeReference) Uint32QueryGetter;
typedef decltype(&nsINavHistoryQuery::GetBeginTime) Int64QueryGetter;
static void AppendBoolKeyValueIfTrue(nsACString& aString,
const nsCString& aName,
nsINavHistoryQuery* aQuery,
Expand All @@ -76,12 +73,9 @@ static void AppendInt64KeyValueIfNonzero(nsACString& aString,
Int64QueryGetter getter);

// query setters
typedef NS_STDCALL_FUNCPROTO(nsresult, BoolQuerySetter, nsINavHistoryQuery,
SetOnlyBookmarked, (bool));
typedef NS_STDCALL_FUNCPROTO(nsresult, Uint32QuerySetter, nsINavHistoryQuery,
SetBeginTimeReference, (uint32_t));
typedef NS_STDCALL_FUNCPROTO(nsresult, Int64QuerySetter, nsINavHistoryQuery,
SetBeginTime, (int64_t));
typedef decltype(&nsINavHistoryQuery::SetOnlyBookmarked) BoolQuerySetter;
typedef decltype(&nsINavHistoryQuery::SetBeginTimeReference) Uint32QuerySetter;
typedef decltype(&nsINavHistoryQuery::SetBeginTime) Int64QuerySetter;
static void SetQueryKeyBool(const nsCString& aValue, nsINavHistoryQuery* aQuery,
BoolQuerySetter setter);
static void SetQueryKeyUint32(const nsCString& aValue, nsINavHistoryQuery* aQuery,
Expand All @@ -90,15 +84,9 @@ static void SetQueryKeyInt64(const nsCString& aValue, nsINavHistoryQuery* aQuery
Int64QuerySetter setter);

// options setters
typedef NS_STDCALL_FUNCPROTO(nsresult, BoolOptionsSetter,
nsINavHistoryQueryOptions,
SetExpandQueries, (bool));
typedef NS_STDCALL_FUNCPROTO(nsresult, Uint32OptionsSetter,
nsINavHistoryQueryOptions,
SetMaxResults, (uint32_t));
typedef NS_STDCALL_FUNCPROTO(nsresult, Uint16OptionsSetter,
nsINavHistoryQueryOptions,
SetResultType, (uint16_t));
typedef decltype(&nsINavHistoryQueryOptions::SetExpandQueries) BoolOptionsSetter;
typedef decltype(&nsINavHistoryQueryOptions::SetMaxResults) Uint32OptionsSetter;
typedef decltype(&nsINavHistoryQueryOptions::SetResultType) Uint16OptionsSetter;
static void SetOptionsKeyBool(const nsCString& aValue,
nsINavHistoryQueryOptions* aOptions,
BoolOptionsSetter setter);
Expand Down
3 changes: 1 addition & 2 deletions widget/cocoa/nsMenuItemIconX.mm
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@
static const uint32_t kIconWidth = 16;
static const uint32_t kIconHeight = 16;

typedef NS_STDCALL_FUNCPROTO(nsresult, GetRectSideMethod, nsIDOMRect,
GetBottom, (nsIDOMCSSPrimitiveValue**));
typedef decltype(&nsIDOMRect::GetBottom) GetRectSideMethod;

NS_IMPL_ISUPPORTS(nsMenuItemIconX, imgINotificationObserver)

Expand Down
27 changes: 0 additions & 27 deletions xpcom/base/nscore.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,33 +133,6 @@
#define NS_IMETHOD NS_IMETHOD_(nsresult)
#define NS_IMETHODIMP NS_IMETHODIMP_(nsresult)

/**
* Macro for creating typedefs for pointer-to-member types which are
* declared with stdcall. It is important to use this for any type which is
* declared as stdcall (i.e. NS_IMETHOD). For example, instead of writing:
*
* typedef nsresult (nsIFoo::*someType)(nsISupports* arg);
*
* you should write:
*
* typedef
* NS_STDCALL_FUNCPROTO(nsresult, someType, nsIFoo, typeFunc, (nsISupports*));
*
* where nsIFoo::typeFunc is any method declared as
* NS_IMETHOD typeFunc(nsISupports*);
*
* XXX this can be simplified to always use the non-typeof implementation
* when http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11893 is fixed.
*/

#ifdef __GNUC__
#define NS_STDCALL_FUNCPROTO(ret, name, class, func, args) \
typeof(&class::func) name
#else
#define NS_STDCALL_FUNCPROTO(ret, name, class, func, args) \
ret (NS_STDCALL class::*name) args
#endif

/**
* Deprecated declarations.
*/
Expand Down

0 comments on commit cb6d98e

Please sign in to comment.