// FIXME: Should we include these here?
#include <stdarg.h>
-#include <string.h>
+#include <string.h>
typedef unsigned long POINTER_64; // FIXME! HACK!!!
#define CONST const
#endif
-
-//
-// FIXME: Non standard, should be deprecated
-//
-#ifndef STATIC
-#define STATIC static
-#endif
-
//
// TRUE/FALSE
//
// We should use the -fms-extensions compiler flag for gcc,
// and clean up the mess.
//
-#ifdef __GNUC__
#ifndef NONAMELESSUNION
+#ifdef __GNUC__
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
#define _ANONYMOUS_UNION __extension__
#define _ANONYMOUS_STRUCT __extension__
#define _ANONYMOUS_UNION __extension__
#endif /* __cplusplus */
#endif /* __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) */
-#endif /* NONAMELESSUNION */
#elif defined(__WATCOMC__) || defined(_MSC_VER)
#define _ANONYMOUS_UNION
#define _ANONYMOUS_STRUCT
#endif /* __GNUC__/__WATCOMC__ */
+#endif /* NONAMELESSUNION */
#ifndef _ANONYMOUS_UNION
#define _ANONYMOUS_UNION
// FIXME
+#undef UNALIGNED
#define UNALIGNED
#define RESTRICTED_POINTER
//
// Returns the byte offset of the specified structure's member
//
-#ifndef FIELD_OFFSET
-#define FIELD_OFFSET(Type, Field) \
- ((LONG_PTR) (&(((Type *) 0)->Field)))
+#ifndef __GNUC__
+#define FIELD_OFFSET(Type, Field) ((LONG)(LONG_PTR)&(((Type*) 0)->Field))
+#else
+#define FIELD_OFFSET(Type, Field) __builtin_offsetof(Type, Field)
#endif
//
// Returns the type's alignment
//
+#if defined(_MSC_VER) && (_MSC_VER >= 1300)
+#define TYPE_ALIGNMENT(t) __alignof(t)
+#else
#define TYPE_ALIGNMENT(t) FIELD_OFFSET( struct { char x; t test; }, test )
-
+#endif
//
// Calling Conventions
//
// Import and Export Specifiers
//
-#ifndef DECL_IMPORT
-#define DECL_IMPORT DECLSPEC_IMPORT //FIXME: DECL_IMPORT -> DECLSPEC_IMPORT
-#endif
-#ifndef DECL_EXPORT
-#define DECL_EXPORT DECLSPEC_EXPORT //FIXME: DECL_EXPORT -> DECLSPEC_EXPORT
-#endif
-// Done the same way as in windef.h (for now *cough*)
+// Done the same way as in windef.h for now
#define DECLSPEC_IMPORT __declspec(dllimport)
#define DECLSPEC_EXPORT __declspec(dllexport)
#define DECLSPEC_NORETURN __declspec(noreturn)
#endif
#endif
+#ifndef DECLSPEC_NOINLINE
#if (_MSC_VER >= 1300)
#define DECLSPEC_NOINLINE __declspec(noinline)
#elif defined(__GNUC__)
#else
#define DECLSPEC_NOINLINE
#endif
+#endif
#if !defined(_M_CEE_PURE)
#define NTAPI_INLINE NTAPI
//
-// Use to silence unused variable warnings when it is intentional
+// Use to silence unused variable warnings when it is intentional
//
#define UNREFERENCED_PARAMETER(P) {(P)=(P);}
#define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);}
// Void Pointers
//
typedef void *PVOID;
-//typedef void * POINTER_64 PVOID64;
+//typedef void * POINTER_64 PVOID64;
typedef PVOID PVOID64; // FIXME!
//
typedef union _LARGE_INTEGER {
_ANONYMOUS_STRUCT struct
{
- ULONG LowPart;
+ DWORD LowPart;
LONG HighPart;
} DUMMYSTRUCTNAME;
struct
{
- ULONG LowPart;
+ DWORD LowPart;
LONG HighPart;
} u;
#endif //MIDL_PASS
typedef union _ULARGE_INTEGER {
_ANONYMOUS_STRUCT struct
{
- ULONG LowPart;
- ULONG HighPart;
+ DWORD LowPart;
+ DWORD HighPart;
} DUMMYSTRUCTNAME;
struct
{
- ULONG LowPart;
- ULONG HighPart;
+ DWORD LowPart;
+ DWORD HighPart;
} u;
#endif //MIDL_PASS
ULONGLONG QuadPart;