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 "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
extern "C" {
#endif

View File

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

View File

@ -20,10 +20,11 @@ extern "C" {
#undef Status /* conflict with X11-includes*/
typedef struct _IO_STATUS_BLOCK
{ union
{ NTSTATUS Status;
{
union {
NTSTATUS Status;
PVOID Pointer;
} u;
} DUMMYUNIONNAME;
ULONG_PTR Information;
} 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 *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)
*/

View File

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

View File

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

View File

@ -53,6 +53,49 @@ extern "C" {
# define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
#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 */

View File

@ -10,12 +10,6 @@
#include "wine/obj_moniker.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
extern "C" {
#endif /* defined(__cplusplus) */

View File

@ -61,11 +61,6 @@ typedef struct ISupportErrorInfo ISupportErrorInfo,*LPSUPPORTERRORINFO;
/*****************************************************************************
* 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

View File

@ -56,7 +56,7 @@ VOID WINAPI GetSystemInfo(
/* choose sensible defaults ...
* FIXME: perhaps overrideable with precompiler flags?
*/
cachedsi.u.x.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL;
cachedsi.u.s.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL;
cachedsi.dwPageSize = VIRTUAL_GetPageSize();
/* 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...
* look at conversions done in (Get|Set)ControlDetails to stay in [0, 100] range
*/
mc->Bounds.dw.dwMinimum = 0;
mc->Bounds.dw.dwMaximum = 100;
mc->Bounds.s1.dwMinimum = 0;
mc->Bounds.s1.dwMaximum = 100;
memset(&mc->Metrics, 0, sizeof(mc->Metrics));
mc->Metrics.cSteps = 0;
return MMSYSERR_NOERROR;