Add support for anonymous struct/unions on compilers that implement it.

This commit is contained in:
Patrik Stridvall 1999-09-14 07:52:16 +00:00 committed by Alexandre Julliard
parent 9af3ebaa7b
commit 32b4325d6b
11 changed files with 66 additions and 69 deletions

View File

@ -11,24 +11,6 @@
#include "imagelist.h" #include "imagelist.h"
#include "prsht.h" #include "prsht.h"
/* c++ likes nameless unions whereas c doesnt */
/* (used in property sheet structures) */
#if defined(__cplusplus) && !defined(NONAMELESSUNION)
#define DUMMYUNIONNAME
#define DUMMYUNIONNAME1
#define DUMMYUNIONNAME2
#define DUMMYUNIONNAME3
#define DUMMYUNIONNAME4
#define DUMMYUNIONNAME5
#else /* defined(__cplusplus) && !defined(NONAMELESSUNION) */
#define DUMMYUNIONNAME u
#define DUMMYUNIONNAME1 u1
#define DUMMYUNIONNAME2 u2
#define DUMMYUNIONNAME3 u3
#define DUMMYUNIONNAME4 u4
#define DUMMYUNIONNAME5 u5
#endif /* defined(__cplusplus) && !defined(NONAMELESSUNION) */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif

View File

@ -1242,11 +1242,11 @@ typedef struct {
struct { struct {
LONG lMinimum; /* signed minimum for this control */ LONG lMinimum; /* signed minimum for this control */
LONG lMaximum; /* signed maximum for this control */ LONG lMaximum; /* signed maximum for this control */
} l; } DUMMYSTRUCTNAME;
struct { struct {
DWORD dwMinimum; /* unsigned minimum for this control */ DWORD dwMinimum; /* unsigned minimum for this control */
DWORD dwMaximum; /* unsigned maximum for this control */ DWORD dwMaximum; /* unsigned maximum for this control */
} dw; } DUMMYSTRUCTNAME1;
DWORD dwReserved[6]; DWORD dwReserved[6];
} Bounds; } Bounds;
union { union {
@ -1268,11 +1268,11 @@ typedef struct {
struct { struct {
LONG lMinimum; LONG lMinimum;
LONG lMaximum; LONG lMaximum;
} l; } DUMMYSTRUCTNAME;
struct { struct {
DWORD dwMinimum; DWORD dwMinimum;
DWORD dwMaximum; DWORD dwMaximum;
} dw; } DUMMYSTRUCTNAME1;
DWORD dwReserved[6]; DWORD dwReserved[6];
} Bounds; } Bounds;
union { union {
@ -1294,11 +1294,11 @@ typedef struct {
struct { struct {
LONG lMinimum; LONG lMinimum;
LONG lMaximum; LONG lMaximum;
} l; } DUMMYSTRUCTNAME;
struct { struct {
DWORD dwMinimum; DWORD dwMinimum;
DWORD dwMaximum; DWORD dwMaximum;
} dw; } DUMMYSTRUCTNAME1;
DWORD dwReserved[6]; DWORD dwReserved[6];
} Bounds; } Bounds;
union { union {
@ -1317,7 +1317,7 @@ typedef struct {
union { union {
DWORD dwControlID; /* MIXER_GETLINECONTROLSF_ONEBYID */ DWORD dwControlID; /* MIXER_GETLINECONTROLSF_ONEBYID */
DWORD dwControlType; /* MIXER_GETLINECONTROLSF_ONEBYTYPE */ DWORD dwControlType; /* MIXER_GETLINECONTROLSF_ONEBYTYPE */
} u; } DUMMYUNIONNAME;
DWORD cControls; /* count of controls pmxctrl points to */ DWORD cControls; /* count of controls pmxctrl points to */
DWORD cbmxctrl; /* size in bytes of _one_ MIXERCONTROL */ DWORD cbmxctrl; /* size in bytes of _one_ MIXERCONTROL */
LPMIXERCONTROL16 pamxctrl;/* pointer to first MIXERCONTROL array */ LPMIXERCONTROL16 pamxctrl;/* pointer to first MIXERCONTROL array */
@ -1329,7 +1329,7 @@ typedef struct {
union { union {
DWORD dwControlID; DWORD dwControlID;
DWORD dwControlType; DWORD dwControlType;
} u; } DUMMYUNIONNAME;
DWORD cControls; DWORD cControls;
DWORD cbmxctrl; DWORD cbmxctrl;
LPMIXERCONTROLA pamxctrl; LPMIXERCONTROLA pamxctrl;
@ -1341,7 +1341,7 @@ typedef struct {
union { union {
DWORD dwControlID; DWORD dwControlID;
DWORD dwControlType; DWORD dwControlType;
} u; } DUMMYUNIONNAME;
DWORD cControls; DWORD cControls;
DWORD cbmxctrl; DWORD cbmxctrl;
LPMIXERCONTROLW pamxctrl; LPMIXERCONTROLW pamxctrl;
@ -1357,7 +1357,7 @@ typedef struct {
union { union {
HWND16 hwndOwner; /* for MIXER_SETCONTROLDETAILSF_CUSTOM */ HWND16 hwndOwner; /* for MIXER_SETCONTROLDETAILSF_CUSTOM */
DWORD cMultipleItems; /* if _MULTIPLE, the number of items per channel */ DWORD cMultipleItems; /* if _MULTIPLE, the number of items per channel */
} u; } DUMMYUNIONNAME;
DWORD cbDetails; /* size of _one_ details_XX struct */ DWORD cbDetails; /* size of _one_ details_XX struct */
LPVOID paDetails; /* pointer to array of details_XX structs */ LPVOID paDetails; /* pointer to array of details_XX structs */
} MIXERCONTROLDETAILS16,*LPMIXERCONTROLDETAILS16; } MIXERCONTROLDETAILS16,*LPMIXERCONTROLDETAILS16;
@ -1369,7 +1369,7 @@ typedef struct {
union { union {
HWND hwndOwner; HWND hwndOwner;
DWORD cMultipleItems; DWORD cMultipleItems;
} u; } DUMMYUNIONNAME;
DWORD cbDetails; DWORD cbDetails;
LPVOID paDetails; LPVOID paDetails;
} MIXERCONTROLDETAILS,*LPMIXERCONTROLDETAILS; } MIXERCONTROLDETAILS,*LPMIXERCONTROLDETAILS;

View File

@ -20,10 +20,11 @@ extern "C" {
#undef Status /* conflict with X11-includes*/ #undef Status /* conflict with X11-includes*/
typedef struct _IO_STATUS_BLOCK typedef struct _IO_STATUS_BLOCK
{ union {
{ NTSTATUS Status; union {
NTSTATUS Status;
PVOID Pointer; PVOID Pointer;
} u; } DUMMYUNIONNAME;
ULONG_PTR Information; ULONG_PTR Information;
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK; } IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;

View File

@ -29,24 +29,6 @@ typedef INT (CALLBACK *PFNPROPSHEETCALLBACK)(HWND, UINT, LPARAM);
typedef BOOL (CALLBACK *LPFNADDPROPSHEETPAGE)(HPROPSHEETPAGE, LPARAM); typedef BOOL (CALLBACK *LPFNADDPROPSHEETPAGE)(HPROPSHEETPAGE, LPARAM);
typedef BOOL (CALLBACK *LPFNADDPROPSHEETPAGES)(LPVOID, LPFNADDPROPSHEETPAGE, LPARAM); typedef BOOL (CALLBACK *LPFNADDPROPSHEETPAGES)(LPVOID, LPFNADDPROPSHEETPAGE, LPARAM);
/* c++ likes nameless unions whereas c doesnt */
/* (used in property sheet structures) */
#if defined(__cplusplus) && !defined(NONAMELESSUNION)
#define DUMMYUNIONNAME
#define DUMMYUNIONNAME1
#define DUMMYUNIONNAME2
#define DUMMYUNIONNAME3
#define DUMMYUNIONNAME4
#define DUMMYUNIONNAME5
#else /* defined(__cplusplus) && !defined(NONAMELESSUNION) */
#define DUMMYUNIONNAME u
#define DUMMYUNIONNAME1 u1
#define DUMMYUNIONNAME2 u2
#define DUMMYUNIONNAME3 u3
#define DUMMYUNIONNAME4 u4
#define DUMMYUNIONNAME5 u5
#endif /* defined(__cplusplus) && !defined(NONAMELESSUNION) */
/* /*
* Property sheet support (structures) * Property sheet support (structures)
*/ */

View File

@ -150,7 +150,7 @@ typedef struct _SHELLEXECUTEINFOA
union union
{ HANDLE hIcon; { HANDLE hIcon;
HANDLE hMonitor; HANDLE hMonitor;
} u; } DUMMYUNIONNAME;
HANDLE hProcess; HANDLE hProcess;
} SHELLEXECUTEINFOA, *LPSHELLEXECUTEINFOA; } SHELLEXECUTEINFOA, *LPSHELLEXECUTEINFOA;
@ -172,7 +172,7 @@ typedef struct _SHELLEXECUTEINFOW
union union
{ HANDLE hIcon; { HANDLE hIcon;
HANDLE hMonitor; HANDLE hMonitor;
} u; } DUMMYUNIONNAME;
HANDLE hProcess; HANDLE hProcess;
} SHELLEXECUTEINFOW, *LPSHELLEXECUTEINFOW; } SHELLEXECUTEINFOW, *LPSHELLEXECUTEINFOW;

View File

@ -798,12 +798,12 @@ DECL_WINELIB_TYPE_AW(LOCALE_ENUMPROC)
typedef struct tagSYSTEM_INFO typedef struct tagSYSTEM_INFO
{ {
union { union {
DWORD dwOemId; DWORD dwOemId; /* Obsolete field - do not use */
struct { struct {
WORD wProcessorArchitecture; WORD wProcessorArchitecture;
WORD wReserved; WORD wReserved;
} x; } DUMMYSTRUCTNAME;
} u; } DUMMYUNIONNAME;
DWORD dwPageSize; DWORD dwPageSize;
LPVOID lpMinimumApplicationAddress; LPVOID lpMinimumApplicationAddress;
LPVOID lpMaximumApplicationAddress; LPVOID lpMaximumApplicationAddress;

View File

@ -53,6 +53,49 @@ extern "C" {
# define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type; # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
#endif /* __WINE__ */ #endif /* __WINE__ */
#ifndef NONAMELESSSTRUCT
# if defined(__WINE__) || !defined(_FORCENAMELESSSTRUCT)
# define NONAMELESSSTRUCT
# endif
#endif /* !defined(NONAMELESSSTRUCT) */
#ifndef NONAMELESSUNION
# if defined(__WINE__) || !defined(_FORCENAMELESSUNION) || !defined(__cplusplus)
# define NONAMELESSUNION
# endif
#endif /* !defined(NONAMELESSUNION) */
#ifndef NONAMELESSSTRUCT
#define DUMMYSTRUCTNAME
#define DUMMYSTRUCTNAME1
#define DUMMYSTRUCTNAME2
#define DUMMYSTRUCTNAME3
#define DUMMYSTRUCTNAME4
#define DUMMYSTRUCTNAME5
#else /* !defined(NONAMELESSSTRUCT) */
#define DUMMYSTRUCTNAME s
#define DUMMYSTRUCTNAME1 s1
#define DUMMYSTRUCTNAME2 s2
#define DUMMYSTRUCTNAME3 s3
#define DUMMYSTRUCTNAME4 s4
#define DUMMYSTRUCTNAME5 s5
#endif /* !defined(NONAMELESSSTRUCT) */
#ifndef NONAMELESSUNION
#define DUMMYUNIONNAME
#define DUMMYUNIONNAME1
#define DUMMYUNIONNAME2
#define DUMMYUNIONNAME3
#define DUMMYUNIONNAME4
#define DUMMYUNIONNAME5
#else /* !defined(NONAMELESSUNION) */
#define DUMMYUNIONNAME u
#define DUMMYUNIONNAME1 u1
#define DUMMYUNIONNAME2 u2
#define DUMMYUNIONNAME3 u3
#define DUMMYUNIONNAME4 u4
#define DUMMYUNIONNAME5 u5
#endif /* !defined(NONAMELESSUNION) */
/* Calling conventions definitions */ /* Calling conventions definitions */

View File

@ -10,12 +10,6 @@
#include "wine/obj_moniker.h" #include "wine/obj_moniker.h"
#include "wine/obj_storage.h" #include "wine/obj_storage.h"
#if defined(__cplusplus) && !defined(NONAMELESSUNION)
#define DUMMYUNIONNAME
#else /* defined(__cplusplus) && !defined(NONAMELESSUNION) */
#define DUMMYUNIONNAME u
#endif /* defined(__cplusplus) && !defined(NONAMELESSUNION) */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif /* defined(__cplusplus) */ #endif /* defined(__cplusplus) */

View File

@ -61,11 +61,6 @@ typedef struct ISupportErrorInfo ISupportErrorInfo,*LPSUPPORTERRORINFO;
/***************************************************************************** /*****************************************************************************
* Automation data types * Automation data types
*/ */
#if defined(__cplusplus) && !defined(NONAMELESSUNION)
#define DUMMYUNIONNAME
#else /* defined(__cplusplus) && !defined(NONAMELESSUNION) */
#define DUMMYUNIONNAME u
#endif /* defined(__cplusplus) && !defined(NONAMELESSUNION) */
/***************************************************************** /*****************************************************************
* SafeArray defines and structs * SafeArray defines and structs

View File

@ -56,7 +56,7 @@ VOID WINAPI GetSystemInfo(
/* choose sensible defaults ... /* choose sensible defaults ...
* FIXME: perhaps overrideable with precompiler flags? * FIXME: perhaps overrideable with precompiler flags?
*/ */
cachedsi.u.x.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL; cachedsi.u.s.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL;
cachedsi.dwPageSize = VIRTUAL_GetPageSize(); cachedsi.dwPageSize = VIRTUAL_GetPageSize();
/* FIXME: better values for the two entries below... */ /* FIXME: better values for the two entries below... */

View File

@ -387,8 +387,8 @@ static DWORD MIX_GetLineControls(WORD wDevID, LPMIXERLINECONTROLSA lpMlc, DWORD
* FIXME: sounds like MIXERCONTROL_CONTROLTYPE_VOLUME is always between 0 and 65536... * FIXME: sounds like MIXERCONTROL_CONTROLTYPE_VOLUME is always between 0 and 65536...
* look at conversions done in (Get|Set)ControlDetails to stay in [0, 100] range * look at conversions done in (Get|Set)ControlDetails to stay in [0, 100] range
*/ */
mc->Bounds.dw.dwMinimum = 0; mc->Bounds.s1.dwMinimum = 0;
mc->Bounds.dw.dwMaximum = 100; mc->Bounds.s1.dwMaximum = 100;
memset(&mc->Metrics, 0, sizeof(mc->Metrics)); memset(&mc->Metrics, 0, sizeof(mc->Metrics));
mc->Metrics.cSteps = 0; mc->Metrics.cSteps = 0;
return MMSYSERR_NOERROR; return MMSYSERR_NOERROR;