Bug 313309 part 1 - use __fastcall for NS_FASTCALL on windows, r=shaver

This commit is contained in:
bsmedberg%covad.net 2005-11-10 14:43:22 +00:00
parent ee19e5b458
commit a4d3866df3
9 changed files with 46 additions and 33 deletions

View File

@ -148,7 +148,7 @@ public:
explicit nsCSSValue(URL* aValue) NS_HIDDEN;
explicit nsCSSValue(Image* aValue) NS_HIDDEN;
nsCSSValue(const nsCSSValue& aCopy) NS_HIDDEN;
NS_FASTCALL ~nsCSSValue() NS_HIDDEN;
NS_CONSTRUCTOR_FASTCALL ~nsCSSValue() NS_HIDDEN;
NS_HIDDEN_(nsCSSValue&) operator=(const nsCSSValue& aCopy);
NS_HIDDEN_(PRBool) operator==(const nsCSSValue& aOther) const;

View File

@ -135,6 +135,9 @@
* to all implementations - the compiler will _not_ warn but it will crash.
* - This has no effect for inline functions or functions which take a
* variable number of arguments.
* - __fastcall on windows should not be applied to class
* constructors/destructors - use the NS_CONSTRUCTOR_FASTCALL macro for
* constructors/destructors.
*
* Examples: int NS_FASTCALL func1(char *foo);
* NS_HIDDEN_(int) NS_FASTCALL func2(char *foo);
@ -142,8 +145,13 @@
#if defined(__i386__) && defined(__GNUC__) && (__GNUC__ >= 3) && !defined(XP_OS2) && !defined(XP_MACOSX)
#define NS_FASTCALL __attribute__ ((regparm (3), stdcall))
#define NS_CONSTRUCTOR_FASTCALL __attribute__ ((regparm (3), stdcall))
#elif defined(XP_WIN)
#define NS_FASTCALL __fastcall
#define NS_CONSTRUCTOR_FASTCALL
#else
#define NS_FASTCALL
#define NS_CONSTRUCTOR_FASTCALL
#endif
/*

View File

@ -62,7 +62,7 @@
#ifndef nsISupportsUtils_h__
#include "nsISupportsUtils.h"
// for |nsresult|, |NS_ADDREF|, |NS_GET_IID| et al
// for |nsresult|, |NS_ADDREF|, |NS_GET_TEMPLATE_IID| et al
#endif
#ifndef nscore_h___
@ -497,7 +497,7 @@ class nsCOMPtr_base
// nothing else to do here
}
NS_COM_GLUE NS_FASTCALL ~nsCOMPtr_base();
NS_COM_GLUE NS_CONSTRUCTOR_FASTCALL ~nsCOMPtr_base();
NS_COM_GLUE void NS_FASTCALL assign_with_AddRef( nsISupports* );
NS_COM_GLUE void NS_FASTCALL assign_from_qi( const nsQueryInterface, const nsIID& );
@ -642,7 +642,7 @@ class nsCOMPtr
// construct from |do_QueryInterface(expr)|
{
NSCAP_LOG_ASSIGNMENT(this, 0);
assign_from_qi(qi, NS_GET_IID(T));
assign_from_qi(qi, NS_GET_TEMPLATE_IID(T));
}
nsCOMPtr( const nsQueryInterfaceWithError& qi )
@ -650,7 +650,7 @@ class nsCOMPtr
// construct from |do_QueryInterface(expr, &rv)|
{
NSCAP_LOG_ASSIGNMENT(this, 0);
assign_from_qi_with_error(qi, NS_GET_IID(T));
assign_from_qi_with_error(qi, NS_GET_TEMPLATE_IID(T));
}
nsCOMPtr( const nsGetServiceByCID gs )
@ -658,7 +658,7 @@ class nsCOMPtr
// construct from |do_GetService(cid_expr)|
{
NSCAP_LOG_ASSIGNMENT(this, 0);
assign_from_gs_cid(gs, NS_GET_IID(T));
assign_from_gs_cid(gs, NS_GET_TEMPLATE_IID(T));
}
nsCOMPtr( const nsGetServiceByCIDWithError& gs )
@ -666,7 +666,7 @@ class nsCOMPtr
// construct from |do_GetService(cid_expr, &rv)|
{
NSCAP_LOG_ASSIGNMENT(this, 0);
assign_from_gs_cid_with_error(gs, NS_GET_IID(T));
assign_from_gs_cid_with_error(gs, NS_GET_TEMPLATE_IID(T));
}
nsCOMPtr( const nsGetServiceByContractID gs )
@ -674,7 +674,7 @@ class nsCOMPtr
// construct from |do_GetService(contractid_expr)|
{
NSCAP_LOG_ASSIGNMENT(this, 0);
assign_from_gs_contractid(gs, NS_GET_IID(T));
assign_from_gs_contractid(gs, NS_GET_TEMPLATE_IID(T));
}
nsCOMPtr( const nsGetServiceByContractIDWithError& gs )
@ -682,7 +682,7 @@ class nsCOMPtr
// construct from |do_GetService(contractid_expr, &rv)|
{
NSCAP_LOG_ASSIGNMENT(this, 0);
assign_from_gs_contractid_with_error(gs, NS_GET_IID(T));
assign_from_gs_contractid_with_error(gs, NS_GET_TEMPLATE_IID(T));
}
nsCOMPtr( const nsCOMPtr_helper& helper )
@ -691,7 +691,7 @@ class nsCOMPtr
// can exploit the |nsCOMPtr_helper| facility
{
NSCAP_LOG_ASSIGNMENT(this, 0);
assign_from_helper(helper, NS_GET_IID(T));
assign_from_helper(helper, NS_GET_TEMPLATE_IID(T));
NSCAP_ASSERT_NO_QUERY_NEEDED();
}
@ -728,7 +728,7 @@ class nsCOMPtr
operator=( const nsQueryInterface rhs )
// assign from |do_QueryInterface(expr)|
{
assign_from_qi(rhs, NS_GET_IID(T));
assign_from_qi(rhs, NS_GET_TEMPLATE_IID(T));
return *this;
}
@ -736,7 +736,7 @@ class nsCOMPtr
operator=( const nsQueryInterfaceWithError& rhs )
// assign from |do_QueryInterface(expr, &rv)|
{
assign_from_qi_with_error(rhs, NS_GET_IID(T));
assign_from_qi_with_error(rhs, NS_GET_TEMPLATE_IID(T));
return *this;
}
@ -744,7 +744,7 @@ class nsCOMPtr
operator=( const nsGetServiceByCID rhs )
// assign from |do_GetService(cid_expr)|
{
assign_from_gs_cid(rhs, NS_GET_IID(T));
assign_from_gs_cid(rhs, NS_GET_TEMPLATE_IID(T));
return *this;
}
@ -752,7 +752,7 @@ class nsCOMPtr
operator=( const nsGetServiceByCIDWithError& rhs )
// assign from |do_GetService(cid_expr, &rv)|
{
assign_from_gs_cid_with_error(rhs, NS_GET_IID(T));
assign_from_gs_cid_with_error(rhs, NS_GET_TEMPLATE_IID(T));
return *this;
}
@ -760,7 +760,7 @@ class nsCOMPtr
operator=( const nsGetServiceByContractID rhs )
// assign from |do_GetService(contractid_expr)|
{
assign_from_gs_contractid(rhs, NS_GET_IID(T));
assign_from_gs_contractid(rhs, NS_GET_TEMPLATE_IID(T));
return *this;
}
@ -768,7 +768,7 @@ class nsCOMPtr
operator=( const nsGetServiceByContractIDWithError& rhs )
// assign from |do_GetService(contractid_expr, &rv)|
{
assign_from_gs_contractid_with_error(rhs, NS_GET_IID(T));
assign_from_gs_contractid_with_error(rhs, NS_GET_TEMPLATE_IID(T));
return *this;
}
@ -777,7 +777,7 @@ class nsCOMPtr
// ...and finally, anything else we might need to assign from
// can exploit the |nsCOMPtr_helper| facility.
{
assign_from_helper(rhs, NS_GET_IID(T));
assign_from_helper(rhs, NS_GET_TEMPLATE_IID(T));
NSCAP_ASSERT_NO_QUERY_NEEDED();
return *this;
}

View File

@ -233,7 +233,7 @@ CallCreateInstance( const nsCID &aClass,
NS_PRECONDITION(aDestination, "null parameter");
return CallCreateInstance(aClass, aDelegate,
NS_GET_IID(DestinationType),
NS_GET_TEMPLATE_IID(DestinationType),
NS_REINTERPRET_CAST(void**, aDestination));
}
@ -246,7 +246,7 @@ CallCreateInstance( const nsCID &aClass,
NS_PRECONDITION(aDestination, "null parameter");
return CallCreateInstance(aClass, nsnull,
NS_GET_IID(DestinationType),
NS_GET_TEMPLATE_IID(DestinationType),
NS_REINTERPRET_CAST(void**, aDestination));
}
@ -262,7 +262,7 @@ CallCreateInstance( const char *aContractID,
return CallCreateInstance(aContractID,
aDelegate,
NS_GET_IID(DestinationType),
NS_GET_TEMPLATE_IID(DestinationType),
NS_REINTERPRET_CAST(void**, aDestination));
}
@ -276,7 +276,7 @@ CallCreateInstance( const char *aContractID,
NS_PRECONDITION(aDestination, "null parameter");
return CallCreateInstance(aContractID, nsnull,
NS_GET_IID(DestinationType),
NS_GET_TEMPLATE_IID(DestinationType),
NS_REINTERPRET_CAST(void**, aDestination));
}
@ -291,7 +291,7 @@ CallCreateInstance( nsIFactory *aFactory,
NS_PRECONDITION(aDestination, "null parameter");
return aFactory->CreateInstance(aDelegate,
NS_GET_IID(DestinationType),
NS_GET_TEMPLATE_IID(DestinationType),
NS_REINTERPRET_CAST(void**, aDestination));
}
@ -305,7 +305,7 @@ CallCreateInstance( nsIFactory *aFactory,
NS_PRECONDITION(aDestination, "null parameter");
return aFactory->CreateInstance(nsnull,
NS_GET_IID(DestinationType),
NS_GET_TEMPLATE_IID(DestinationType),
NS_REINTERPRET_CAST(void**, aDestination));
}
@ -318,7 +318,7 @@ CallGetClassObject( const nsCID &aClass,
NS_PRECONDITION(aDestination, "null parameter");
return CallGetClassObject(aClass,
NS_GET_IID(DestinationType), NS_REINTERPRET_CAST(void**, aDestination));
NS_GET_TEMPLATE_IID(DestinationType), NS_REINTERPRET_CAST(void**, aDestination));
}
template <class DestinationType>
@ -330,7 +330,7 @@ CallGetClassObject( const char* aContractID,
NS_PRECONDITION(aDestination, "null parameter");
return CallGetClassObject(aContractID,
NS_GET_IID(DestinationType), NS_REINTERPRET_CAST(void**, aDestination));
NS_GET_TEMPLATE_IID(DestinationType), NS_REINTERPRET_CAST(void**, aDestination));
}
#endif /* nsComponentManagerUtils_h__ */

View File

@ -75,7 +75,8 @@ void GlueShutdownDebug()
}
#endif
void NSGlue_Abort(const char* aFile, PRIntn aLine)
void NS_FASTCALL
NSGlue_Abort(const char* aFile, PRIntn aLine)
{
if (!ENSURE_DEBUGOBJECT)
return;
@ -83,7 +84,8 @@ void NSGlue_Abort(const char* aFile, PRIntn aLine)
gDebugObject->Abort(aFile, aLine);
}
void NSGlue_Break(const char* aFile, PRIntn aLine)
void NS_FASTCALL
NSGlue_Break(const char* aFile, PRIntn aLine)
{
if (!ENSURE_DEBUGOBJECT)
return;
@ -91,14 +93,16 @@ void NSGlue_Break(const char* aFile, PRIntn aLine)
gDebugObject->Break(aFile, aLine);
}
void NSGlue_Warning(const char* aStr, const char* aFile, PRIntn aLine)
void NS_FASTCALL
NSGlue_Warning(const char* aStr, const char* aFile, PRIntn aLine)
{
if (!ENSURE_DEBUGOBJECT)
return;
gDebugObject->Warning(aStr, aFile, aLine);
}
void NSGlue_Assertion(const char* aStr, const char* aExpr,
void NS_FASTCALL
NSGlue_Assertion(const char* aStr, const char* aExpr,
const char* aFile, PRIntn aLine)
{
if (!ENSURE_DEBUGOBJECT)

View File

@ -211,6 +211,7 @@ struct nsCOMTypeInfo<nsISupports>
};
#define NS_GET_IID(T) nsCOMTypeInfo<T>::GetIID()
#define NS_GET_TEMPLATE_IID(T) nsCOMTypeInfo<T>::GetIID()
// a type-safe shortcut for calling the |QueryInterface()| member function
template <class T, class DestinationType>

View File

@ -130,7 +130,7 @@ class nsTAString_CharT
public:
// this acts like a virtual destructor
NS_COM NS_FASTCALL ~nsTAString_CharT();
NS_COM NS_CONSTRUCTOR_FASTCALL ~nsTAString_CharT();
/**

View File

@ -72,7 +72,7 @@ class nsTSubstring_CharT : public nsTAString_CharT
#ifndef MOZ_V1_STRING_ABI
// this acts like a virtual destructor
NS_COM NS_FASTCALL ~nsTSubstring_CharT();
NS_COM NS_CONSTRUCTOR_FASTCALL ~nsTSubstring_CharT();
#endif
/**

View File

@ -36,7 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
NS_COM int
NS_COM int NS_FASTCALL
Compare( const nsTSubstring_CharT::base_string_type& lhs, const nsTSubstring_CharT::base_string_type& rhs, const nsTStringComparator_CharT& comp )
{
typedef nsTAString_CharT::size_type size_type;