Backout bug 313309 part 3 again due to gcc2.9x bustage and an ICE on MSVC6

git-svn-id: svn://10.0.0.236/trunk@191063 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
benjamin%smedbergs.us 2006-02-23 19:57:50 +00:00
parent 05c2c8b5b7
commit 4bf3112d3d
3 changed files with 27 additions and 21 deletions

View File

@ -66,8 +66,6 @@
class NS_NO_VTABLE nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISUPPORTS_IID)
/**
* @name Methods
*/
@ -103,9 +101,5 @@ public:
//@}
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsISupports, NS_ISUPPORTS_IID)
/*@}*/
#endif

View File

@ -134,23 +134,13 @@ typedef nsID nsIID;
const nsIID _name = _iidspec
/**
* A macro to build the static const IID accessor method. The Dummy
* template parameter only exists so that the kIID symbol will be linked
* properly (weak symbol on linux, gnu_linkonce on mac, multiple-definitions
* merged on windows). Dummy should always be instantiated as "int".
* A macro to build the static const IID accessor method
*/
#define NS_DECLARE_STATIC_IID_ACCESSOR(the_iid) \
template <class Dummy> \
struct COMTypeInfo \
{ \
static const nsIID kIID NS_HIDDEN; \
}; \
static const nsIID& GetIID() {return COMTypeInfo<int>::kIID;}
static const nsIID& GetIID() {static const nsIID iid = the_iid; return iid;}
#define NS_DEFINE_STATIC_IID_ACCESSOR(the_interface, the_iid) \
template <class Dummy> \
const nsIID the_interface::COMTypeInfo<Dummy>::kIID NS_HIDDEN = the_iid;
#define NS_DEFINE_STATIC_IID_ACCESSOR(the_interface, the_iid)
/**
* A macro to build the static const CID accessor method
@ -159,7 +149,7 @@ typedef nsID nsIID;
#define NS_DEFINE_STATIC_CID_ACCESSOR(the_cid) \
static const nsID& GetCID() {static const nsID cid = the_cid; return cid;}
#define NS_GET_IID(T) (::T::COMTypeInfo<int>::kIID)
#define NS_GET_TEMPLATE_IID(T) (T::template COMTypeInfo<int>::kIID)
#define NS_GET_IID(T) nsCOMTypeInfo<T>::GetIID()
#define NS_GET_TEMPLATE_IID(T) NS_GET_IID(T)
#endif

View File

@ -190,6 +190,26 @@ ns_if_addref( T expr )
#define NS_ISUPPORTS_CAST(__unambiguousBase, __expr) \
NS_STATIC_CAST(nsISupports*, NS_STATIC_CAST(__unambiguousBase, __expr))
extern "C++" {
// ...because some one is accidentally including this file inside
// an |extern "C"|
class nsISupports;
template <class T>
struct nsCOMTypeInfo
{
static const nsIID& GetIID() { return T::GetIID(); }
};
NS_SPECIALIZE_TEMPLATE
struct nsCOMTypeInfo<nsISupports>
{
static const nsIID& GetIID() {
static const nsIID iid_NS_ISUPPORTS_IID = NS_ISUPPORTS_IID; return iid_NS_ISUPPORTS_IID;
}
};
// a type-safe shortcut for calling the |QueryInterface()| member function
template <class T, class DestinationType>
inline
@ -203,4 +223,6 @@ CallQueryInterface( T* aSource, DestinationType** aDestination )
NS_REINTERPRET_CAST(void**, aDestination));
}
} // extern "C++"
#endif /* __nsISupportsUtils_h */