From 47a88ba221e7f04e5ab8f3ede96723752ca72bcc Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 4 May 2004 00:43:02 +0000 Subject: [PATCH] Explicitly specify alignment of 64-bit types. --- include/axcore.idl | 2 +- include/basetsd.h | 21 ++++++++++++++++----- include/strmif.h | 2 +- include/winnt.h | 6 +++--- include/wtypes.h | 8 ++++++++ include/wtypes.idl | 8 ++++++++ 6 files changed, 37 insertions(+), 10 deletions(-) diff --git a/include/axcore.idl b/include/axcore.idl index ecac8930ba..de5dbbb5cd 100644 --- a/include/axcore.idl +++ b/include/axcore.idl @@ -48,7 +48,7 @@ cpp_quote("#define MAX_PIN_NAME 128") cpp_quote("#define MAX_FILTER_NAME 128") typedef LONGLONG REFERENCE_TIME; -typedef double REFTIME; +typedef DOUBLE REFTIME; typedef DWORD_PTR HSEMAPHORE; typedef DWORD_PTR HEVENT; diff --git a/include/basetsd.h b/include/basetsd.h index 615b37197a..274f41b48f 100644 --- a/include/basetsd.h +++ b/include/basetsd.h @@ -59,20 +59,31 @@ extern "C" { # endif #endif /* !defined(_MSC_VER) */ +/* FIXME: DECLSPEC_ALIGN should be declared only in winnt.h, but we need it here too */ +#ifndef DECLSPEC_ALIGN +# if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS) +# define DECLSPEC_ALIGN(x) __declspec(align(x)) +# elif defined(__GNUC__) +# define DECLSPEC_ALIGN(x) __attribute__((aligned(x))) +# else +# define DECLSPEC_ALIGN(x) +# endif +#endif + typedef signed char INT8, *PINT8; typedef signed short INT16, *PINT16; typedef signed int INT32, *PINT32; -typedef signed __int64 INT64, *PINT64; +typedef signed __int64 DECLSPEC_ALIGN(8) INT64, *PINT64; typedef unsigned char UINT8, *PUINT8; typedef unsigned short UINT16, *PUINT16; typedef unsigned int UINT32, *PUINT32; -typedef unsigned __int64 UINT64, *PUINT64; +typedef unsigned __int64 DECLSPEC_ALIGN(8) UINT64, *PUINT64; typedef signed int LONG32, *PLONG32; typedef unsigned int ULONG32, *PULONG32; typedef unsigned int DWORD32, *PDWORD32; -typedef signed __int64 LONG64, *PLONG64; -typedef unsigned __int64 ULONG64, *PULONG64; -typedef unsigned __int64 DWORD64, *PDWORD64; +typedef signed __int64 DECLSPEC_ALIGN(8) LONG64, *PLONG64; +typedef unsigned __int64 DECLSPEC_ALIGN(8) ULONG64, *PULONG64; +typedef unsigned __int64 DECLSPEC_ALIGN(8) DWORD64, *PDWORD64; /* Win32 or Win64 dependent typedef/defines. */ diff --git a/include/strmif.h b/include/strmif.h index 1b0fb6d853..1ff27d0db0 100644 --- a/include/strmif.h +++ b/include/strmif.h @@ -117,7 +117,7 @@ typedef enum _PinDirection { #define MAX_FILTER_NAME 128 typedef LONGLONG REFERENCE_TIME; -typedef double REFTIME; +typedef DOUBLE REFTIME; typedef DWORD_PTR HSEMAPHORE; diff --git a/include/winnt.h b/include/winnt.h index 33166081c8..067fd29e91 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -319,13 +319,13 @@ typedef unsigned short WCHAR, *PWCHAR; /* 'Extended/Wide' numerical types */ #ifndef _ULONGLONG_ #define _ULONGLONG_ -typedef signed __int64 LONGLONG, *PLONGLONG; -typedef unsigned __int64 ULONGLONG, *PULONGLONG; +typedef signed __int64 DECLSPEC_ALIGN(8) LONGLONG, *PLONGLONG; +typedef unsigned __int64 DECLSPEC_ALIGN(8) ULONGLONG, *PULONGLONG; #endif #ifndef _DWORDLONG_ #define _DWORDLONG_ -typedef ULONGLONG DWORDLONG, *PDWORDLONG; +typedef ULONGLONG DECLSPEC_ALIGN(8) DWORDLONG, *PDWORDLONG; #endif /* ANSI string types */ diff --git a/include/wtypes.h b/include/wtypes.h index 8096615bae..e32c80de2a 100644 --- a/include/wtypes.h +++ b/include/wtypes.h @@ -184,8 +184,12 @@ typedef struct tagMSG { } MSG, *PMSG, *NPMSG, *LPMSG; #endif /* winnt.h */ +#if 0 typedef double DOUBLE; +#else +typedef double DECLSPEC_ALIGN(8) DOUBLE; +#endif #ifndef _PALETTEENTRY_DEFINED #define _PALETTEENTRY_DEFINED typedef struct tagPALETTEENTRY { @@ -609,8 +613,12 @@ typedef enum tagSTATFLAG { STATFLAG_NOOPEN = 2 } STATFLAG; +#if 0 typedef double DATE; +#else +typedef double DECLSPEC_ALIGN(8) DATE; +#endif #if 0 typedef struct tagCY { LONGLONG int64; diff --git a/include/wtypes.idl b/include/wtypes.idl index d51467d02d..6608f34412 100644 --- a/include/wtypes.idl +++ b/include/wtypes.idl @@ -184,7 +184,11 @@ typedef struct tagMSG cpp_quote("#endif /* winnt.h */") +cpp_quote("#if 0") /* for IDL only */ typedef double DOUBLE; +cpp_quote("#else") +cpp_quote("typedef double DECLSPEC_ALIGN(8) DOUBLE;") +cpp_quote("#endif") cpp_quote("#ifndef _PALETTEENTRY_DEFINED") cpp_quote("#define _PALETTEENTRY_DEFINED") @@ -563,7 +567,11 @@ typedef enum tagSTATFLAG { /******************** OLE Automation ********************/ +cpp_quote("#if 0") /* for IDL only */ typedef double DATE; +cpp_quote("#else") +cpp_quote("typedef double DECLSPEC_ALIGN(8) DATE;") +cpp_quote("#endif") cpp_quote("#if 0") /* for IDL only */ typedef struct tagCY { -- 2.32.0.93.g670b81a890