On Wed, Dec 18, 2019 at 11:55 AM Zebediah Figura z.figura12@gmail.com wrote:
This fixes a regression introduced by 732f67ed38a45911d726df8da5a68710d175ba1d.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47710 Signed-off-by: Zebediah Figura z.figura12@gmail.com
include/objidl.idl | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/include/objidl.idl b/include/objidl.idl index a0ad1f6e01..a5466c3698 100644 --- a/include/objidl.idl +++ b/include/objidl.idl @@ -1426,8 +1426,11 @@ interface IAdviseSink : IUnknown default: wireHGLOBAL hGeneric; } GDI_OBJECT;
+/* Defining the _STGMEDIUM_UNION type yields a violation of the C spec when
- NONAMELESSUNION is not defined, so only define it for C++. */
+cpp_quote("#ifdef __cplusplus") typedef struct _userSTGMEDIUM {
- union switch(DWORD tymed) u {
- union _STGMEDIUM_UNION switch(DWORD tymed) u { case TYMED_NULL: ; case TYMED_MFPICT: wireHMETAFILEPICT hMetaFilePict; case TYMED_ENHMF: wireHENHMETAFILE hHEnhMetaFile;
@@ -1439,6 +1442,23 @@ interface IAdviseSink : IUnknown } DUMMYUNIONNAME; IUnknown *pUnkForRelease; } userSTGMEDIUM; +cpp_quote("#else") +cpp_quote("typedef struct _userSTGMEDIUM {") +cpp_quote(" struct {") +cpp_quote(" DWORD tymed;") +cpp_quote(" union {") +cpp_quote(" wireHMETAFILEPICT hMetaFilePict;") +cpp_quote(" wireHENHMETAFILE hHEnhMetaFile;") +cpp_quote(" GDI_OBJECT *hGdiHandle;") +cpp_quote(" wireHGLOBAL hGlobal;") +cpp_quote(" LPOLESTR lpszFileName;") +cpp_quote(" BYTE_BLOB *pstm;") +cpp_quote(" BYTE_BLOB *pstg;") +cpp_quote(" } u;") +cpp_quote(" } DUMMYUNIONNAME;") +cpp_quote(" IUnknown *pUnkForRelease;") +cpp_quote("} userSTGMEDIUM;") +cpp_quote("#endif")
typedef [unique] userSTGMEDIUM *wireSTGMEDIUM; typedef [wire_marshal(wireSTGMEDIUM)] uSTGMEDIUM STGMEDIUM; -- 2.24.1
Hi Zebediah,
I know this is getting into a "what's the least bad way to handle a bad situation"... But I'm wondering if defining away _STGMEDIUM_UNION for C wouldn't be marginally better than pre-baking the code for C as you've done here. Something along the lines of (I'm not where I can really test this) ...
+cpp_quote("#ifndef __cplusplus") +cpp_quote("#define _STGMEDIUM_UNION") +cpp_quote("#endif") typedef struct _userSTGMEDIUM { - union switch(DWORD tymed) u { + union _STGMEDIUM_UNION switch(DWORD tymed) u { ... +cpp_quote("#ifndef __cplusplus") +cpp_quote("#undef _STGMEDIUM_UNION") +cpp_quote("#endif")
-- Jeff