From 91874e20bf881a7b519c2eeae57b07f456138f79 Mon Sep 17 00:00:00 2001
From: Earnie Boyd <earnie@users.sf.net>
Date: Tue, 17 Apr 2001 12:58:06 +0000
Subject: [PATCH] 	* include/windows.h: Define _ANONYMOUS_STRUCT and
 _ANONYMOUS_UNION 	as __extenstion__ when appropriate. 	*
 include/mmsystem.h: Mark anonymous structs and unions as 	__extension__
 to prevent compiler warning when invoked with 	-pedantic 	*
 include/oaidl.h: Ditto. 	* include/objidl.h: Ditto. 	*
 include/olectl.h: Ditto. 	* include/prsht.h: Ditto. 	*
 include/shlobj.h: Ditto. 	* include/winbase.h: Ditto. 	*
 include/winnt.h: Ditto. 	* include/wtypes.h: Ditto.

---
 winsup/w32api/ChangeLog          | 16 ++++++++++++++++
 winsup/w32api/include/mmsystem.h | 14 +++++++-------
 winsup/w32api/include/oaidl.h    |  6 +++---
 winsup/w32api/include/objidl.h   |  6 +++---
 winsup/w32api/include/olectl.h   |  2 +-
 winsup/w32api/include/prsht.h    | 20 ++++++++++----------
 winsup/w32api/include/shlobj.h   |  2 +-
 winsup/w32api/include/winbase.h  |  6 +++---
 winsup/w32api/include/windows.h  | 10 ++++++----
 winsup/w32api/include/winnt.h    | 22 +++++++++++-----------
 winsup/w32api/include/wtypes.h   | 10 +++++-----
 11 files changed, 66 insertions(+), 48 deletions(-)

diff --git a/winsup/w32api/ChangeLog b/winsup/w32api/ChangeLog
index 21f91bfc6..245a475e3 100644
--- a/winsup/w32api/ChangeLog
+++ b/winsup/w32api/ChangeLog
@@ -1,4 +1,20 @@
 
+2001-04-17  Egor Duda  <deo@logos-m.ru>
+
+	* include/windows.h: Define _ANONYMOUS_STRUCT and _ANONYMOUS_UNION
+	as __extenstion__ when appropriate.
+	* include/mmsystem.h: Mark anonymous structs and unions as
+	__extension__ to prevent compiler warning when invoked with
+	-pedantic
+	* include/oaidl.h: Ditto.
+	* include/objidl.h: Ditto.
+	* include/olectl.h: Ditto.
+	* include/prsht.h: Ditto.
+	* include/shlobj.h: Ditto.
+	* include/winbase.h: Ditto.
+	* include/winnt.h: Ditto.
+	* include/wtypes.h: Ditto.
+
 2001-04-11 Danny Smith <dannysmith@users.sourceforge.net>
 
 	* include/windows.h (#include <winsock.h>): Include <winsock2.h>
diff --git a/winsup/w32api/include/mmsystem.h b/winsup/w32api/include/mmsystem.h
index a35a78929..63451f974 100644
--- a/winsup/w32api/include/mmsystem.h
+++ b/winsup/w32api/include/mmsystem.h
@@ -1185,11 +1185,11 @@ typedef struct tagMIXERCONTROLA {
 	CHAR szShortName[MIXER_SHORT_NAME_CHARS];
 	CHAR szName[MIXER_LONG_NAME_CHARS];
 	union {
-		struct {
+		_ANONYMOUS_STRUCT struct {
 			LONG lMinimum;
 			LONG lMaximum;
 		}_STRUCT_NAME(s);
-		struct {
+		_ANONYMOUS_STRUCT struct {
 			DWORD dwMinimum;
 			DWORD dwMaximum;
 		}_STRUCT_NAME(s1);
@@ -1210,11 +1210,11 @@ typedef struct tagMIXERCONTROLW {
 	WCHAR szShortName[MIXER_SHORT_NAME_CHARS];
 	WCHAR szName[MIXER_LONG_NAME_CHARS];
 	union {
-		struct {
+		_ANONYMOUS_STRUCT struct {
 			LONG lMinimum;
 			LONG lMaximum;
 		}_STRUCT_NAME(s);
-		struct {
+		_ANONYMOUS_STRUCT struct {
 			DWORD dwMinimum;
 			DWORD dwMaximum;
 		}_STRUCT_NAME(s1);
@@ -1229,7 +1229,7 @@ typedef struct tagMIXERCONTROLW {
 typedef struct tagMIXERLINECONTROLSA {
 	DWORD cbStruct;
 	DWORD dwLineID;
-	union {
+	_ANONYMOUS_UNION union {
 		DWORD dwControlID;
 		DWORD dwControlType;
 	} DUMMYUNIONNAME;
@@ -1240,7 +1240,7 @@ typedef struct tagMIXERLINECONTROLSA {
 typedef struct tagMIXERLINECONTROLSW {
 	DWORD cbStruct;
 	DWORD dwLineID;
-	union {
+	_ANONYMOUS_UNION union {
 		DWORD dwControlID;
 		DWORD dwControlType;
 	} DUMMYUNIONNAME;
@@ -1252,7 +1252,7 @@ typedef struct tMIXERCONTROLDETAILS {
 	DWORD cbStruct;
 	DWORD dwControlID;
 	DWORD cChannels;
-	union {
+	_ANONYMOUS_UNION union {
 		HWND hwndOwner;
 		DWORD cMultipleItems;
 	} DUMMYUNIONNAME;
diff --git a/winsup/w32api/include/oaidl.h b/winsup/w32api/include/oaidl.h
index cc0e932a5..9eccd7742 100644
--- a/winsup/w32api/include/oaidl.h
+++ b/winsup/w32api/include/oaidl.h
@@ -216,7 +216,7 @@ typedef struct _wireVARIANT {
 	USHORT wReserved1;
 	USHORT wReserved2;
 	USHORT wReserved3;
-	union {
+	_ANONYMOUS_UNION union {
 		LONG lVal;
 		BYTE bVal;
 		SHORT iVal;
@@ -292,7 +292,7 @@ typedef struct tagIDLDESC {
 }IDLDESC,*LPIDLDESC;
 typedef struct tagELEMDESC {
 	TYPEDESC tdesc;
-	union {
+	_ANONYMOUS_UNION union {
 		IDLDESC idldesc;
 		PARAMDESC paramdesc;
 	} DUMMYUNIONNAME;
@@ -367,7 +367,7 @@ typedef enum tagVARKIND {
 typedef struct tagVARDESC {
 	MEMBERID memid;
 	LPOLESTR lpstrSchema;
-	union {
+	_ANONYMOUS_UNION union {
 		ULONG oInst;
 		VARIANT *lpvarValue;
 	} DUMMYUNIONNAME;
diff --git a/winsup/w32api/include/objidl.h b/winsup/w32api/include/objidl.h
index 5a8fc3b90..63d14484e 100644
--- a/winsup/w32api/include/objidl.h
+++ b/winsup/w32api/include/objidl.h
@@ -151,7 +151,7 @@ typedef enum tagBIND_FLAGS {
 } BIND_FLAGS;
 typedef struct tagSTGMEDIUM {
 	DWORD tymed;
-	union {
+	_ANONYMOUS_UNION union {
 		HBITMAP hBitmap;
 		PVOID hMetaFilePict;
 		HENHMETAFILE hEnhMetaFile;
@@ -297,7 +297,7 @@ typedef struct tagPROPVARIANT {
 	WORD wReserved1;
 	WORD wReserved2;
 	WORD wReserved3;
-	union {
+	_ANONYMOUS_UNION union {
 		UCHAR bVal;
 		short iVal;
 		USHORT uiVal;
@@ -349,7 +349,7 @@ typedef struct tagPROPVARIANT {
 } PROPVARIANT;
 typedef struct tagPROPSPEC {
 	ULONG ulKind;
-	union {
+	_ANONYMOUS_UNION union {
 		PROPID propid;
 		LPOLESTR lpwstr;
 	} DUMMYUNIONNAME;
diff --git a/winsup/w32api/include/olectl.h b/winsup/w32api/include/olectl.h
index 97ea9f40d..6c2163074 100644
--- a/winsup/w32api/include/olectl.h
+++ b/winsup/w32api/include/olectl.h
@@ -325,7 +325,7 @@ typedef struct tagFONTDESC {
 typedef struct tagPICTDESC {
 	UINT cbSizeofstruct;
 	UINT picType;
-	union {
+	_ANONYMOUS_UNION union {
 		struct {
 			HBITMAP hbitmap;
 			HPALETTE hpal;
diff --git a/winsup/w32api/include/prsht.h b/winsup/w32api/include/prsht.h
index 8b2ab2de2..296ea6bf1 100644
--- a/winsup/w32api/include/prsht.h
+++ b/winsup/w32api/include/prsht.h
@@ -97,11 +97,11 @@ typedef struct _PROPSHEETPAGEA {
 	DWORD	dwSize;
 	DWORD	dwFlags;
 	HINSTANCE	hInstance;
-	union {
+	_ANONYMOUS_UNION union {
 		LPCSTR	pszTemplate;
 		LPCDLGTEMPLATE	pResource;
 	} DUMMYUNIONNAME;
-	union {
+	_ANONYMOUS_UNION union {
 		HICON hIcon;
 		LPCSTR pszIcon;
 	} DUMMYUNIONNAME2;
@@ -116,11 +116,11 @@ typedef struct _PROPSHEETPAGEW {
 	DWORD	dwSize;
 	DWORD	dwFlags;
 	HINSTANCE	hInstance;
-	union {
+	_ANONYMOUS_UNION union {
 		LPCWSTR	pszTemplate;
 		LPCDLGTEMPLATE	pResource;
 	} DUMMYUNIONNAME;
-	union {
+	_ANONYMOUS_UNION union {
 		HICON hIcon;
 		LPCWSTR pszIcon;
 	} DUMMYUNIONNAME2;
@@ -140,17 +140,17 @@ typedef struct _PROPSHEETHEADERA {
 	DWORD	dwFlags;
 	HWND	hwndParent;
 	HINSTANCE	hInstance;
-	union {
+	_ANONYMOUS_UNION union {
 		HICON	hIcon;
 		LPCSTR	pszIcon;
 	}DUMMYUNIONNAME;
 	LPCSTR	pszCaption;
 	UINT	nPages;
-	union {
+	_ANONYMOUS_UNION union {
 		UINT	nStartPage;
 		LPCSTR	pStartPage;
 	}DUMMYUNIONNAME2;
-	union {
+	_ANONYMOUS_UNION union {
 		LPCPROPSHEETPAGEA ppsp;
 		HPROPSHEETPAGE *phpage;
 	}DUMMYUNIONNAME3;
@@ -162,17 +162,17 @@ typedef struct _PROPSHEETHEADERW {
 	DWORD	dwFlags;
 	HWND	hwndParent;
 	HINSTANCE	hInstance;
-	union {
+	_ANONYMOUS_UNION union {
 		HICON	hIcon;
 		LPCWSTR	pszIcon;
 	}DUMMYUNIONNAME;
 	LPCWSTR	pszCaption;
 	UINT	nPages;
-	union {
+	_ANONYMOUS_UNION union {
 		UINT	nStartPage;
 		LPCWSTR	pStartPage;
 	}DUMMYUNIONNAME2;
-	union {
+	_ANONYMOUS_UNION union {
 		LPCPROPSHEETPAGEW ppsp;
 		HPROPSHEETPAGE *phpage;
 	}DUMMYUNIONNAME3;
diff --git a/winsup/w32api/include/shlobj.h b/winsup/w32api/include/shlobj.h
index 77526cce1..6f6eb8774 100644
--- a/winsup/w32api/include/shlobj.h
+++ b/winsup/w32api/include/shlobj.h
@@ -272,7 +272,7 @@ typedef enum tagSHCONTF {
 } SHCONTF;
 typedef struct _STRRET {
 	UINT uType;
-	union {
+	_ANONYMOUS_UNION union {
 		LPWSTR pOleStr;
 		UINT uOffset;
 		char cStr[MAX_PATH];
diff --git a/winsup/w32api/include/winbase.h b/winsup/w32api/include/winbase.h
index ed228b1f9..1713d6146 100644
--- a/winsup/w32api/include/winbase.h
+++ b/winsup/w32api/include/winbase.h
@@ -807,9 +807,9 @@ typedef enum _GET_FILEEX_INFO_LEVELS {
 	GetFileExMaxInfoLevel
 } GET_FILEEX_INFO_LEVELS;
 typedef struct _SYSTEM_INFO {
-	union {
+	_ANONYMOUS_UNION union {
 		DWORD dwOemId;
-		struct {
+		_ANONYMOUS_STRUCT struct {
 			WORD wProcessorArchitecture;
 			WORD wReserved;
 		} DUMMYSTRUCTNAME;
@@ -897,7 +897,7 @@ typedef struct _PROCESS_HEAP_ENTRY {
 	BYTE cbOverhead;
 	BYTE iRegionIndex;
 	WORD wFlags;
-	union {
+	_ANONYMOUS_UNION union {
 		struct {
 			HANDLE hMem;
 			DWORD dwReserved[3];
diff --git a/winsup/w32api/include/windows.h b/winsup/w32api/include/windows.h
index 59fc63496..3b9273a97 100644
--- a/winsup/w32api/include/windows.h
+++ b/winsup/w32api/include/windows.h
@@ -42,18 +42,19 @@
 
 #ifdef __GNUC__
 #ifndef NONAMELESSUNION
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
-#define _ANONYMOUS_UNION
-#define _ANONYMOUS_STRUCT
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) 
+#define _ANONYMOUS_UNION __extension__
+#define _ANONYMOUS_STRUCT __extension__
 #else
 #if defined(__cplusplus)
-#define _ANONYMOUS_UNION
+#define _ANONYMOUS_UNION __extension__
 #endif
 #endif /* __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) */
 #endif /* NONAMELESSUNION */
 #endif /* __GNUC__ */
 
 #ifndef _ANONYMOUS_UNION
+#define _ANONYMOUS_UNION
 #define _UNION_NAME(x) x
 #define DUMMYUNIONNAME	u
 #define DUMMYUNIONNAME2	u2
@@ -75,6 +76,7 @@
 #define DUMMYUNIONNAME8
 #endif
 #ifndef _ANONYMOUS_STRUCT
+#define _ANONYMOUS_STRUCT
 #define _STRUCT_NAME(x) x
 #define DUMMYSTRUCTNAME	s
 #define DUMMYSTRUCTNAME2 s2
diff --git a/winsup/w32api/include/winnt.h b/winsup/w32api/include/winnt.h
index 1165426b6..35a0facdd 100644
--- a/winsup/w32api/include/winnt.h
+++ b/winsup/w32api/include/winnt.h
@@ -1693,7 +1693,7 @@ typedef struct _EXCEPTION_POINTERS {
 	PCONTEXT ContextRecord;
 } EXCEPTION_POINTERS,*PEXCEPTION_POINTERS,*LPEXCEPTION_POINTERS;
 typedef union _LARGE_INTEGER {
-	struct {
+	_ANONYMOUS_STRUCT struct {
 		DWORD LowPart;
 		LONG HighPart;
 	}_STRUCT_NAME(u);
@@ -1701,7 +1701,7 @@ typedef union _LARGE_INTEGER {
 } LARGE_INTEGER;
 typedef LARGE_INTEGER *PLARGE_INTEGER;
 typedef union _ULARGE_INTEGER {
-	struct {
+	_ANONYMOUS_STRUCT struct {
 		DWORD LowPart;
 		DWORD HighPart;
 	}_STRUCT_NAME(u);
@@ -2231,7 +2231,7 @@ typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
 	DWORD RvaToLastByteOfData;
 } IMAGE_COFF_SYMBOLS_HEADER,*PIMAGE_COFF_SYMBOLS_HEADER;
 typedef struct _IMAGE_RELOCATION {
-	union {
+	_ANONYMOUS_UNION union {
 		DWORD VirtualAddress;
 		DWORD RelocCount;
 	} DUMMYUNIONNAME;
@@ -2290,7 +2290,7 @@ typedef struct _IMAGE_THUNK_DATA {
 	} u1;
 } IMAGE_THUNK_DATA,*PIMAGE_THUNK_DATA;
 typedef struct _IMAGE_IMPORT_DESCRIPTOR {
-	union {
+	_ANONYMOUS_UNION union {
 		DWORD Characteristics;
 		PIMAGE_THUNK_DATA OriginalFirstThunk;
 	} DUMMYUNIONNAME;
@@ -2326,18 +2326,18 @@ typedef struct _IMAGE_RESOURCE_DIRECTORY {
 	WORD NumberOfNamedEntries;
 	WORD NumberOfIdEntries;
 } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY;
-typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
-	union {
-		struct {
+_ANONYMOUS_STRUCT typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
+	_ANONYMOUS_UNION union {
+		_ANONYMOUS_STRUCT struct {
 			DWORD NameOffset:31;
 			DWORD NameIsString:1;
 		}DUMMYSTRUCTNAME;
 		DWORD Name;
 		WORD Id;
 	} DUMMYUNIONNAME;
-	union {
+	_ANONYMOUS_UNION union {
 		DWORD OffsetToData;
-		struct {
+		_ANONYMOUS_STRUCT struct {
 			DWORD OffsetToDirectory:31;
 			DWORD DataIsDirectory:1;
 		} DUMMYSTRUCTNAME2;
@@ -2455,7 +2455,7 @@ typedef struct _NT_TIB {
 	PVOID StackBase;
 	PVOID StackLimit;
 	PVOID SubSystemTib;
-	union {
+	_ANONYMOUS_UNION union {
 		PVOID FiberData;
 		DWORD Version;
 	} DUMMYUNIONNAME;
@@ -2466,7 +2466,7 @@ typedef struct _REPARSE_DATA_BUFFER {
 	DWORD  ReparseTag;
 	WORD   ReparseDataLength;
 	WORD   Reserved;
-	union {
+	_ANONYMOUS_UNION union {
 		struct {
 			WORD   SubstituteNameOffset;
 			WORD   SubstituteNameLength;
diff --git a/winsup/w32api/include/wtypes.h b/winsup/w32api/include/wtypes.h
index c35dcec3a..c54043176 100644
--- a/winsup/w32api/include/wtypes.h
+++ b/winsup/w32api/include/wtypes.h
@@ -78,7 +78,7 @@ typedef BSTR *LPBSTR;
 typedef LONG SCODE;
 typedef void *HCONTEXT;
 typedef union tagCY {
-	struct {
+	_ANONYMOUS_STRUCT struct {
 		unsigned long Lo;
 		long Hi;
 	}_STRUCT_NAME(s);
@@ -138,16 +138,16 @@ typedef struct _HYPER_SIZEDARR {
 typedef double DOUBLE;
 typedef struct tagDEC {
 	USHORT wReserved;
-	union {
-		struct {
+	_ANONYMOUS_UNION union {
+		_ANONYMOUS_STRUCT struct {
 			BYTE scale;
 			BYTE sign;
 		}_STRUCT_NAME(s);
 		USHORT signscale;
 	} DUMMYUNIONNAME;
 	ULONG Hi32;
-	union {
-		struct {
+	_ANONYMOUS_UNION union {
+		_ANONYMOUS_STRUCT struct {
 			ULONG Lo32;
 			ULONG Mid32;
 		}_STRUCT_NAME(s2);