[PATCH] include: Define the _STGMEDIUM_UNION type for C++ only.

Jeff Smith whydoubt at gmail.com
Thu Dec 19 09:16:29 CST 2019


Fixes a regression introduced by 732f67ed38a45911d726df8da5a68710d175ba1d
Based on a patch from Zebediah Figura <z.figura12 at gmail.com>

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47710
Signed-off-by: Jeff Smith <whydoubt at gmail.com>
---
This is like https://source.winehq.org/patches/data/175999 except that
this version uses #define to blank-out _STGMEDIUM_UNION for non-C++,
rather than having an idl version of the enclosing struct for C++ and a
baked version of that struct for non-C++.

 include/objidl.idl | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/objidl.idl b/include/objidl.idl
index a0ad1f6e01..844b94af86 100644
--- a/include/objidl.idl
+++ b/include/objidl.idl
@@ -1426,8 +1426,14 @@ 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("#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 {
     case TYMED_NULL:     ;
     case TYMED_MFPICT:   wireHMETAFILEPICT hMetaFilePict;
     case TYMED_ENHMF:    wireHENHMETAFILE hHEnhMetaFile;
@@ -1440,6 +1446,10 @@ interface IAdviseSink : IUnknown
     IUnknown *pUnkForRelease;
   } userSTGMEDIUM;
 
+  cpp_quote("#ifndef __cplusplus")
+  cpp_quote("#undef _STGMEDIUM_UNION")
+  cpp_quote("#endif")
+
   typedef [unique] userSTGMEDIUM *wireSTGMEDIUM;
   typedef [wire_marshal(wireSTGMEDIUM)] uSTGMEDIUM STGMEDIUM;
 
-- 
2.23.0




More information about the wine-devel mailing list