Jacek Caban : include: Added macros for unions and structs that should remain nameless regardless NONAMELESSUNION /NONAMELESSSTRUCT definition.

Alexandre Julliard julliard at winehq.org
Fri Dec 24 09:26:18 CST 2010


Module: wine
Branch: master
Commit: 45be01952a21e4f42e4e4114c11f6084090e941e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=45be01952a21e4f42e4e4114c11f6084090e941e

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Dec 23 16:05:29 2010 +0100

include: Added macros for unions and structs that should remain nameless regardless NONAMELESSUNION/NONAMELESSSTRUCT definition.

---

 Maketest.rules.in  |    2 +-
 include/winineti.h |   16 ++++++++--------
 include/winnt.h    |   38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 47 insertions(+), 9 deletions(-)

diff --git a/Maketest.rules.in b/Maketest.rules.in
index 31404d5..5725d41 100644
--- a/Maketest.rules.in
+++ b/Maketest.rules.in
@@ -10,7 +10,7 @@
 #
 
 DLLFLAGS     = @DLLFLAGS@
-DEFS         = -DWINE_STRICT_PROTOTYPES $(EXTRADEFS)
+DEFS         = -DWINE_STRICT_PROTOTYPES -DWINE_NO_NAMELESS_EXTENSION $(EXTRADEFS)
 
 MODULE       = $(TESTDLL:%.dll=%)_test.exe
 TESTRESULTS  = $(C_SRCS:.c=.ok)
diff --git a/include/winineti.h b/include/winineti.h
index 27efa50..4f86db6 100644
--- a/include/winineti.h
+++ b/include/winineti.h
@@ -46,15 +46,15 @@ typedef struct _INTERNET_CACHE_CONFIG_INFOA
     BOOL fPerUser;
     DWORD dwSyncMode;
     DWORD dwNumCachePaths;
-    union
+    __C89_NAMELESSUNION union
     {
-        struct
+        __C89_NAMELESSSTRUCT struct
         {
             CHAR CachePath[MAX_PATH];
             DWORD dwCacheSize;
-        } DUMMYSTRUCTNAME;
+        } __C89_NAMELESSSTRUCTNAME;
         INTERNET_CACHE_CONFIG_PATH_ENTRYA CachePaths[ANYSIZE_ARRAY];
-    } DUMYUNIONNAME;
+    } __C89_NAMELESSUNIONNAME;
     DWORD dwNormalUsage;
     DWORD dwExemptUsage;
 } INTERNET_CACHE_CONFIG_INFOA, *LPINTERNET_CACHE_CONFIG_INFOA;
@@ -68,15 +68,15 @@ typedef struct _INTERNET_CACHE_CONFIG_INFOW
     BOOL  fPerUser;
     DWORD dwSyncMode;
     DWORD dwNumCachePaths;
-    union
+    __C89_NAMELESSUNION union
     {
-        struct
+        __C89_NAMELESSSTRUCT struct
         {
             WCHAR CachePath[MAX_PATH];
             DWORD dwCacheSize;
-        } DUMMYSTRUCTNAME;
+        } __C89_NAMELESSSTRUCTNAME;
         INTERNET_CACHE_CONFIG_PATH_ENTRYW CachePaths[ANYSIZE_ARRAY];
-    } ;
+    } __C89_NAMELESSUNIONNAME;
     DWORD dwNormalUsage;
     DWORD dwExemptUsage;
 } INTERNET_CACHE_CONFIG_INFOW, *LPINTERNET_CACHE_CONFIG_INFOW;
diff --git a/include/winnt.h b/include/winnt.h
index 65dde7a..6cd97bc 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -230,6 +230,44 @@ extern "C" {
 #define DUMMYUNIONNAME8  u8
 #endif /* !defined(NONAMELESSUNION) */
 
+#ifndef __C89_NAMELESSSTRUCT
+# if !defined(__WINESRC__) && !defined(WINE_NO_NAMELESS_EXTENSION)
+#  ifdef __GNUC__
+    /* Anonymous structs support starts with gcc 2.96/g++ 2.95 */
+#   if (__GNUC__ > 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ > 95) || ((__GNUC_MINOR__ == 95) && defined(__cplusplus))))
+#    define __C89_NAMELESSSTRUCT __extension__
+#   endif
+#  elif defined(_MSC_VER)
+#   define __C89_NAMELESSSTRUCT
+#  endif
+# endif
+# ifdef __C89_NAMELESSSTRUCT
+#   define __C89_NAMELESSSTRUCTNAME
+# else
+#   define __C89_NAMELESSSTRUCT
+#   define __C89_NAMELESSSTRUCTNAME DUMMYSTRUCTNAME
+# endif
+#endif
+
+#ifndef __C89_NAMELESSUNION
+# if !defined(__WINESRC__) && !defined(WINE_NO_NAMELESS_EXTENSION)
+#  ifdef __GNUC__
+    /* Anonymous unions support starts with gcc 2.96/g++ 2.95 */
+#   if (__GNUC__ > 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ > 95) || ((__GNUC_MINOR__ == 95) && defined(__cplusplus))))
+#    define __C89_NAMELESSUNION __extension__
+#   endif
+#  elif defined(_MSC_VER)
+#   define __C89_NAMELESSUNION
+#  endif
+# endif
+# ifdef __C89_NAMELESSUNION
+#   define __C89_NAMELESSUNIONNAME
+# else
+#   define __C89_NAMELESSUNION
+#   define __C89_NAMELESSUNIONNAME DUMMYUNIONNAME
+# endif
+#endif
+
 /* C99 restrict support */
 
 #if defined(ENABLE_RESTRICTED) && !defined(MIDL_PASS) && !defined(RC_INVOKED)




More information about the wine-cvs mailing list