Commit 2d5519f1 authored by Alexandre Julliard's avatar Alexandre Julliard

The com_interface attribute is not needed on derived classes.

Removed the ICOM_CTHIS* macros.
parent 31e78f47
......@@ -139,7 +139,7 @@ VOID WINAPI IMalloc16_fnFree(IMalloc16* iface,SEGPTR pv)
*/
DWORD WINAPI IMalloc16_fnGetSize(const IMalloc16* iface,SEGPTR pv)
{
ICOM_CTHIS(IMalloc16Impl,iface);
ICOM_THIS(IMalloc16Impl,iface);
TRACE("(%p)->GetSize(%08lx)\n",This,pv);
return HeapSize( GetProcessHeap(), 0, MapSL(pv) );
}
......@@ -148,7 +148,7 @@ DWORD WINAPI IMalloc16_fnGetSize(const IMalloc16* iface,SEGPTR pv)
* IMalloc16_DidAlloc [COMPOBJ.507]
*/
INT16 WINAPI IMalloc16_fnDidAlloc(const IMalloc16* iface,LPVOID pv) {
ICOM_CTHIS(IMalloc16,iface);
ICOM_THIS(IMalloc16,iface);
TRACE("(%p)->DidAlloc(%p)\n",This,pv);
return (INT16)-1;
}
......
......@@ -246,7 +246,11 @@
#define THIS void
#define interface struct
#ifdef ICOM_USE_COM_INTERFACE_ATTRIBUTE
#define DECLARE_INTERFACE(iface) interface __attribute__((com_interface)) iface
#else
#define DECLARE_INTERFACE(iface) interface iface
#endif
#define DECLARE_INTERFACE_(iface,ibase) interface iface : public ibase
#define BEGIN_INTERFACE
......@@ -293,17 +297,11 @@
/* Wine-specific macros */
#define ICOM_DEFINE(iface,ibase) \
DECLARE_INTERFACE_(iface,ibase) { iface##_METHODS } ICOM_COM_INTERFACE_ATTRIBUTE;
#define ICOM_DEFINE(iface,ibase) DECLARE_INTERFACE_(iface,ibase) { iface##_METHODS };
#define ICOM_VTABLE(iface) iface##Vtbl
#define ICOM_VFIELD(iface) ICOM_VTABLE(iface)* lpVtbl
#define ICOM_THIS(impl,iface) impl* const This=(impl*)(iface)
#define ICOM_CTHIS(impl,iface) const impl* const This=(const impl*)(iface)
#define ICOM_THIS(impl,iface) impl* const This=(impl*)(iface)
#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
#define ICOM_CTHIS_MULTI(impl,field,iface) const impl* const This=(const impl*)((char*)(iface) - offsetof(impl,field))
#include "objidl.h"
......
......@@ -8,11 +8,6 @@
extern "C" {
#endif
#include "wtypes.h"
#if defined(ICOM_USE_COM_INTERFACE_ATTRIBUTE) && defined(__cplusplus) && !defined(CINTERFACE)
# define ICOM_COM_INTERFACE_ATTRIBUTE __attribute__((com_interface))
#else
# define ICOM_COM_INTERFACE_ATTRIBUTE
#endif
#if defined(ICOM_MSVTABLE_COMPAT) && (!defined(__cplusplus) || defined(CINTERFACE))
# define ICOM_MSVTABLE_COMPAT_FIELDS long dummyRTTI1,dummyRTTI2;
# define ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 0,0,
......@@ -28,8 +23,12 @@ typedef IUnknown *LPUNKNOWN;
*/
DEFINE_GUID(IID_IUnknown, 0x00000000, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46);
#if defined(__cplusplus) && !defined(CINTERFACE)
struct IUnknown {
#ifdef ICOM_USE_COM_INTERFACE_ATTRIBUTE
struct __attribute__((com_interface)) IUnknown
#else
struct IUnknown
#endif
{
virtual HRESULT STDMETHODCALLTYPE QueryInterface(
REFIID riid,
void** ppvObject) = 0;
......@@ -40,7 +39,7 @@ struct IUnknown {
virtual ULONG STDMETHODCALLTYPE Release(
) = 0;
} ICOM_COM_INTERFACE_ATTRIBUTE;
};
#else
typedef struct IUnknownVtbl IUnknownVtbl;
struct IUnknown {
......@@ -109,8 +108,8 @@ typedef IClassFactory *LPCLASSFACTORY;
*/
DEFINE_GUID(IID_IClassFactory, 0x00000001, 0x0000, 0x0000, 0xc0,0x00, 0x00,0x00,0x00,0x00,0x00,0x46);
#if defined(__cplusplus) && !defined(CINTERFACE)
struct IClassFactory: IUnknown {
struct IClassFactory : public IUnknown
{
virtual HRESULT STDMETHODCALLTYPE CreateInstance(
IUnknown* pUnkOuter,
REFIID riid,
......@@ -119,7 +118,7 @@ struct IClassFactory: IUnknown {
virtual HRESULT STDMETHODCALLTYPE LockServer(
BOOL fLock) = 0;
} ICOM_COM_INTERFACE_ATTRIBUTE;
};
#else
typedef struct IClassFactoryVtbl IClassFactoryVtbl;
struct IClassFactory {
......
......@@ -21,11 +21,6 @@ import "wtypes.idl";
/* COM vtable compatibility macros for g++ */
/* Included here because the generated header needs them */
cpp_quote("#if defined(ICOM_USE_COM_INTERFACE_ATTRIBUTE) && defined(__cplusplus) && !defined(CINTERFACE)")
cpp_quote("# define ICOM_COM_INTERFACE_ATTRIBUTE __attribute__((com_interface))")
cpp_quote("#else")
cpp_quote("# define ICOM_COM_INTERFACE_ATTRIBUTE")
cpp_quote("#endif")
cpp_quote("#if defined(ICOM_MSVTABLE_COMPAT) && (!defined(__cplusplus) || defined(CINTERFACE))")
cpp_quote("# define ICOM_MSVTABLE_COMPAT_FIELDS long dummyRTTI1,dummyRTTI2;")
cpp_quote("# define ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 0,0,")
......
......@@ -688,15 +688,21 @@ void write_com_interface(type_t *iface)
write_forward(iface);
/* C++ interface */
fprintf(header, "#if defined(__cplusplus) && !defined(CINTERFACE)\n");
fprintf(header, "struct %s", iface->name);
if (iface->ref)
fprintf(header, ": %s", iface->ref->name);
fprintf(header, " {\n");
fprintf(header, "struct %s : public %s\n", iface->name, iface->ref->name);
else
{
fprintf(header, "#ifdef ICOM_USE_COM_INTERFACE_ATTRIBUTE\n");
fprintf(header, "struct __attribute__((com_interface)) %s\n", iface->name);
fprintf(header, "#else\n");
fprintf(header, "struct %s\n", iface->name);
fprintf(header, "#endif\n");
}
fprintf(header, "{\n");
indentation++;
fprintf(header, "\n");
write_cpp_method_def(iface);
indentation--;
fprintf(header, "} ICOM_COM_INTERFACE_ATTRIBUTE;\n");
fprintf(header, "};\n");
fprintf(header, "#else\n");
/* C interface */
fprintf(header, "typedef struct %sVtbl %sVtbl;\n", iface->name, iface->name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment