mirror of
https://github.com/reactos/reactos.git
synced 2025-05-19 17:14:32 +00:00
[INCLUDE]
- ntdef.h: Add #pragma once, include guiddef.h and kernelspecs.h, slightly cleanup the nameless struct/union stuff, fix PVOID64 definition, fix definition of UNALIGNED on ARM, stop checking for too outdated MSVC versions (< 1300), start using ULONG32 instead of ULONG at some places (this is to be able to share the code with winnt.h later), add missing PROBE_ALIGNMENT32, DECLSPEC_NOTHROW, DECLSPEC_UUID, DECLSPEC_NOVTABLE, DECLSPEC_DEPRECATED, DECLSPEC_DEPRECATED_DDK, simpify HANDLE definition. svn path=/trunk/; revision=63500
This commit is contained in:
parent
aaff11172a
commit
717f8cb0e9
1 changed files with 108 additions and 58 deletions
|
@ -20,25 +20,23 @@
|
||||||
|
|
||||||
#ifndef _NTDEF_
|
#ifndef _NTDEF_
|
||||||
#define _NTDEF_
|
#define _NTDEF_
|
||||||
|
#pragma once
|
||||||
|
|
||||||
/* Dependencies */
|
/* Dependencies */
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <basetsd.h>
|
#include <basetsd.h>
|
||||||
|
#include <guiddef.h>
|
||||||
#include <excpt.h>
|
#include <excpt.h>
|
||||||
#include <sdkddkver.h>
|
#include <sdkddkver.h>
|
||||||
#include <specstrings.h>
|
#include <specstrings.h>
|
||||||
|
#include <kernelspecs.h>
|
||||||
|
|
||||||
// FIXME: Shouldn't be included!
|
// FIXME: Shouldn't be included!
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
/* Helper macro to enable gcc's extension. */
|
#ifdef __cplusplus
|
||||||
#ifndef __GNU_EXTENSION
|
extern "C" {
|
||||||
#ifdef __GNUC__
|
|
||||||
#define __GNU_EXTENSION __extension__
|
|
||||||
#else
|
|
||||||
#define __GNU_EXTENSION
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Pseudo Modifiers for Input Parameters */
|
/* Pseudo Modifiers for Input Parameters */
|
||||||
|
@ -63,16 +61,11 @@
|
||||||
#define CRITICAL
|
#define CRITICAL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// FIXME: deprecated
|
||||||
#ifndef FAR
|
#ifndef FAR
|
||||||
#define FAR
|
#define FAR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Defines the "size" of an any-size array */
|
|
||||||
#ifndef ANYSIZE_ARRAY
|
|
||||||
#define ANYSIZE_ARRAY 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Constant modifier */
|
/* Constant modifier */
|
||||||
#ifndef CONST
|
#ifndef CONST
|
||||||
#define CONST const
|
#define CONST const
|
||||||
|
@ -93,26 +86,22 @@
|
||||||
#endif
|
#endif
|
||||||
#endif /* NULL */
|
#endif /* NULL */
|
||||||
|
|
||||||
|
/* Defines the "size" of an any-size array */
|
||||||
|
#ifndef ANYSIZE_ARRAY
|
||||||
|
#define ANYSIZE_ARRAY 1
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
/* Helper macro to enable gcc's extension. */
|
||||||
// FIXME
|
#ifndef __GNU_EXTENSION
|
||||||
// We should use the -fms-extensions compiler flag for gcc,
|
|
||||||
// and clean up the mess.
|
|
||||||
//
|
|
||||||
#ifndef __ANONYMOUS_DEFINED
|
|
||||||
#define __ANONYMOUS_DEFINED
|
|
||||||
|
|
||||||
#ifndef NONAMELESSUNION
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define _ANONYMOUS_UNION __GNU_EXTENSION
|
#define __GNU_EXTENSION __extension__
|
||||||
#define _ANONYMOUS_STRUCT __GNU_EXTENSION
|
#else
|
||||||
#elif defined(__WATCOMC__) || defined(_MSC_VER)
|
#define __GNU_EXTENSION
|
||||||
#define _ANONYMOUS_UNION
|
#endif
|
||||||
#define _ANONYMOUS_STRUCT
|
#endif
|
||||||
#endif /* __GNUC__/__WATCOMC__ */
|
|
||||||
#endif /* NONAMELESSUNION */
|
|
||||||
|
|
||||||
#ifndef _ANONYMOUS_UNION
|
#ifndef DUMMYUNIONNAME
|
||||||
|
#if defined(NONAMELESSUNION)// || !defined(_MSC_EXTENSIONS)
|
||||||
#define _ANONYMOUS_UNION
|
#define _ANONYMOUS_UNION
|
||||||
#define _UNION_NAME(x) x
|
#define _UNION_NAME(x) x
|
||||||
#define DUMMYUNIONNAME u
|
#define DUMMYUNIONNAME u
|
||||||
|
@ -124,7 +113,9 @@
|
||||||
#define DUMMYUNIONNAME6 u6
|
#define DUMMYUNIONNAME6 u6
|
||||||
#define DUMMYUNIONNAME7 u7
|
#define DUMMYUNIONNAME7 u7
|
||||||
#define DUMMYUNIONNAME8 u8
|
#define DUMMYUNIONNAME8 u8
|
||||||
|
#define DUMMYUNIONNAME9 u9
|
||||||
#else
|
#else
|
||||||
|
#define _ANONYMOUS_UNION __GNU_EXTENSION
|
||||||
#define _UNION_NAME(x)
|
#define _UNION_NAME(x)
|
||||||
#define DUMMYUNIONNAME
|
#define DUMMYUNIONNAME
|
||||||
#define DUMMYUNIONNAME1
|
#define DUMMYUNIONNAME1
|
||||||
|
@ -135,9 +126,12 @@
|
||||||
#define DUMMYUNIONNAME6
|
#define DUMMYUNIONNAME6
|
||||||
#define DUMMYUNIONNAME7
|
#define DUMMYUNIONNAME7
|
||||||
#define DUMMYUNIONNAME8
|
#define DUMMYUNIONNAME8
|
||||||
#endif
|
#define DUMMYUNIONNAME9
|
||||||
|
#endif /* NONAMELESSUNION */
|
||||||
|
#endif /* !DUMMYUNIONNAME */
|
||||||
|
|
||||||
#ifndef _ANONYMOUS_STRUCT
|
#ifndef DUMMYSTRUCTNAME
|
||||||
|
#if defined(NONAMELESSUNION)// || !defined(_MSC_EXTENSIONS)
|
||||||
#define _ANONYMOUS_STRUCT
|
#define _ANONYMOUS_STRUCT
|
||||||
#define _STRUCT_NAME(x) x
|
#define _STRUCT_NAME(x) x
|
||||||
#define DUMMYSTRUCTNAME s
|
#define DUMMYSTRUCTNAME s
|
||||||
|
@ -147,6 +141,7 @@
|
||||||
#define DUMMYSTRUCTNAME4 s4
|
#define DUMMYSTRUCTNAME4 s4
|
||||||
#define DUMMYSTRUCTNAME5 s5
|
#define DUMMYSTRUCTNAME5 s5
|
||||||
#else
|
#else
|
||||||
|
#define _ANONYMOUS_STRUCT __GNU_EXTENSION
|
||||||
#define _STRUCT_NAME(x)
|
#define _STRUCT_NAME(x)
|
||||||
#define DUMMYSTRUCTNAME
|
#define DUMMYSTRUCTNAME
|
||||||
#define DUMMYSTRUCTNAME1
|
#define DUMMYSTRUCTNAME1
|
||||||
|
@ -154,11 +149,14 @@
|
||||||
#define DUMMYSTRUCTNAME3
|
#define DUMMYSTRUCTNAME3
|
||||||
#define DUMMYSTRUCTNAME4
|
#define DUMMYSTRUCTNAME4
|
||||||
#define DUMMYSTRUCTNAME5
|
#define DUMMYSTRUCTNAME5
|
||||||
|
#endif /* NONAMELESSUNION */
|
||||||
|
#endif /* DUMMYSTRUCTNAME */
|
||||||
|
|
||||||
|
#if defined(STRICT_GS_ENABLED)
|
||||||
|
#pragma strict_gs_check(push, on)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __ANONYMOUS_DEFINED */
|
#if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64) || defined(_M_ARM)
|
||||||
|
|
||||||
#if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64)
|
|
||||||
#define ALIGNMENT_MACHINE
|
#define ALIGNMENT_MACHINE
|
||||||
#define UNALIGNED __unaligned
|
#define UNALIGNED __unaligned
|
||||||
#if defined(_WIN64)
|
#if defined(_WIN64)
|
||||||
|
@ -203,7 +201,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Returns the type's alignment */
|
/* Returns the type's alignment */
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
|
#if defined(_MSC_VER)
|
||||||
#define TYPE_ALIGNMENT(t) __alignof(t)
|
#define TYPE_ALIGNMENT(t) __alignof(t)
|
||||||
#else
|
#else
|
||||||
#define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
|
#define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
|
||||||
|
@ -217,8 +215,14 @@
|
||||||
#error "unknown architecture"
|
#error "unknown architecture"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_WIN64)
|
||||||
|
#define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(ULONG)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Calling Conventions */
|
/* Calling Conventions */
|
||||||
#if defined(_M_IX86)
|
#if defined(_MANAGED)
|
||||||
|
#define FASTCALL __stdcall
|
||||||
|
#elif defined(_M_IX86)
|
||||||
#define FASTCALL __fastcall
|
#define FASTCALL __fastcall
|
||||||
#else
|
#else
|
||||||
#define FASTCALL
|
#define FASTCALL
|
||||||
|
@ -234,15 +238,23 @@
|
||||||
#define DECLSPEC_NORETURN __declspec(noreturn)
|
#define DECLSPEC_NORETURN __declspec(noreturn)
|
||||||
|
|
||||||
#ifndef DECLSPEC_ADDRSAFE
|
#ifndef DECLSPEC_ADDRSAFE
|
||||||
#if (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
|
#if defined(_MSC_VER) && (defined(_M_ALPHA) || defined(_M_AXP64))
|
||||||
#define DECLSPEC_ADDRSAFE __declspec(address_safe)
|
#define DECLSPEC_ADDRSAFE __declspec(address_safe)
|
||||||
#else
|
#else
|
||||||
#define DECLSPEC_ADDRSAFE
|
#define DECLSPEC_ADDRSAFE
|
||||||
#endif
|
#endif
|
||||||
#endif /* DECLSPEC_ADDRSAFE */
|
#endif /* DECLSPEC_ADDRSAFE */
|
||||||
|
|
||||||
|
#ifndef DECLSPEC_NOTHROW
|
||||||
|
#if !defined(MIDL_PASS)
|
||||||
|
#define DECLSPEC_NOTHROW __declspec(nothrow)
|
||||||
|
#else
|
||||||
|
#define DECLSPEC_NOTHROW
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef NOP_FUNCTION
|
#ifndef NOP_FUNCTION
|
||||||
#if (_MSC_VER >= 1210)
|
#if defined(_MSC_VER)
|
||||||
#define NOP_FUNCTION __noop
|
#define NOP_FUNCTION __noop
|
||||||
#else
|
#else
|
||||||
#define NOP_FUNCTION (void)0
|
#define NOP_FUNCTION (void)0
|
||||||
|
@ -263,17 +275,13 @@
|
||||||
|
|
||||||
/* Inlines */
|
/* Inlines */
|
||||||
#ifndef FORCEINLINE
|
#ifndef FORCEINLINE
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
#if defined(_MSC_VER)
|
||||||
#define FORCEINLINE __forceinline
|
#define FORCEINLINE __forceinline
|
||||||
#elif defined(_MSC_VER)
|
#elif ( __MINGW_GNUC_PREREQ(4, 3) && __STDC_VERSION__ >= 199901L)
|
||||||
#define FORCEINLINE __inline
|
|
||||||
#else /* __GNUC__ */
|
|
||||||
# if ( __MINGW_GNUC_PREREQ(4, 3) && __STDC_VERSION__ >= 199901L)
|
|
||||||
# define FORCEINLINE extern inline __attribute__((__always_inline__,__gnu_inline__))
|
# define FORCEINLINE extern inline __attribute__((__always_inline__,__gnu_inline__))
|
||||||
#else
|
#else
|
||||||
# define FORCEINLINE extern __inline__ __attribute__((__always_inline__))
|
# define FORCEINLINE extern __inline__ __attribute__((__always_inline__))
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#endif /* FORCEINLINE */
|
#endif /* FORCEINLINE */
|
||||||
|
|
||||||
#ifndef DECLSPEC_NOINLINE
|
#ifndef DECLSPEC_NOINLINE
|
||||||
|
@ -294,7 +302,7 @@
|
||||||
|
|
||||||
/* Use to specify structure alignment */
|
/* Use to specify structure alignment */
|
||||||
#ifndef DECLSPEC_ALIGN
|
#ifndef DECLSPEC_ALIGN
|
||||||
#if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
|
#if defined(_MSC_VER) && !defined(MIDL_PASS)
|
||||||
#define DECLSPEC_ALIGN(x) __declspec(align(x))
|
#define DECLSPEC_ALIGN(x) __declspec(align(x))
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
#define DECLSPEC_ALIGN(x) __attribute__ ((__aligned__(x)))
|
#define DECLSPEC_ALIGN(x) __attribute__ ((__aligned__(x)))
|
||||||
|
@ -315,14 +323,55 @@
|
||||||
#define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(SYSTEM_CACHE_ALIGNMENT_SIZE)
|
#define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(SYSTEM_CACHE_ALIGNMENT_SIZE)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef DECLSPEC_UUID
|
||||||
|
#if defined(_MSC_VER) && defined(__cplusplus)
|
||||||
|
#define DECLSPEC_UUID(x) __declspec(uuid(x))
|
||||||
|
#else
|
||||||
|
#define DECLSPEC_UUID(x)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DECLSPEC_NOVTABLE
|
||||||
|
#if defined(_MSC_VER) && defined(__cplusplus)
|
||||||
|
#define DECLSPEC_NOVTABLE __declspec(novtable)
|
||||||
|
#else
|
||||||
|
#define DECLSPEC_NOVTABLE
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef DECLSPEC_SELECTANY
|
#ifndef DECLSPEC_SELECTANY
|
||||||
#if (_MSC_VER >= 1100) || defined(__GNUC__)
|
#if defined(_MSC_VER) || defined(__GNUC__)
|
||||||
#define DECLSPEC_SELECTANY __declspec(selectany)
|
#define DECLSPEC_SELECTANY __declspec(selectany)
|
||||||
#else
|
#else
|
||||||
#define DECLSPEC_SELECTANY
|
#define DECLSPEC_SELECTANY
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef DECLSPEC_DEPRECATED
|
||||||
|
#if (defined(_MSC_VER) || defined(__GNUC__)) && !defined(MIDL_PASS)
|
||||||
|
#define DECLSPEC_DEPRECATED __declspec(deprecated)
|
||||||
|
#define DEPRECATE_SUPPORTED
|
||||||
|
#else
|
||||||
|
#define DECLSPEC_DEPRECATED
|
||||||
|
#undef DEPRECATE_SUPPORTED
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEPRECATE_DDK_FUNCTIONS
|
||||||
|
#ifdef _NTDDK_
|
||||||
|
#define DECLSPEC_DEPRECATED_DDK DECLSPEC_DEPRECATED
|
||||||
|
#ifdef DEPRECATE_SUPPORTED
|
||||||
|
#define PRAGMA_DEPRECATED_DDK 1
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define DECLSPEC_DEPRECATED_DDK
|
||||||
|
#define PRAGMA_DEPRECATED_DDK 1
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define DECLSPEC_DEPRECATED_DDK
|
||||||
|
#define PRAGMA_DEPRECATED_DDK 0
|
||||||
|
#endif
|
||||||
|
|
||||||
/* 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_PARAMETER(P) {(P)=(P);}
|
||||||
#define UNREFERENCED_LOCAL_VARIABLE(L) ((void)(L))
|
#define UNREFERENCED_LOCAL_VARIABLE(L) ((void)(L))
|
||||||
|
@ -347,18 +396,15 @@
|
||||||
|
|
||||||
/* Void Pointers */
|
/* Void Pointers */
|
||||||
typedef void *PVOID;
|
typedef void *PVOID;
|
||||||
//typedef void * POINTER_64 PVOID64;
|
typedef void * POINTER_64 PVOID64;
|
||||||
typedef PVOID PVOID64; // FIXME!
|
|
||||||
|
|
||||||
/* Handle Type */
|
/* Handle Type */
|
||||||
|
typedef void *HANDLE, **PHANDLE;;
|
||||||
#ifdef STRICT
|
#ifdef STRICT
|
||||||
typedef void *HANDLE;
|
#define DECLARE_HANDLE(n) typedef struct n##__{int unused;} *n
|
||||||
#define DECLARE_HANDLE(n) typedef struct n##__{int i;}*n
|
|
||||||
#else
|
#else
|
||||||
typedef PVOID HANDLE;
|
|
||||||
#define DECLARE_HANDLE(n) typedef HANDLE n
|
#define DECLARE_HANDLE(n) typedef HANDLE n
|
||||||
#endif
|
#endif
|
||||||
typedef HANDLE *PHANDLE;
|
|
||||||
|
|
||||||
/* Upper-Case Versions of Some Standard C Types */
|
/* Upper-Case Versions of Some Standard C Types */
|
||||||
#ifndef VOID
|
#ifndef VOID
|
||||||
|
@ -891,4 +937,8 @@ typedef struct _GROUP_AFFINITY {
|
||||||
#define LANG_YORUBA 0x6a
|
#define LANG_YORUBA 0x6a
|
||||||
#define LANG_ZULU 0x35
|
#define LANG_ZULU 0x35
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} // extern "C"
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _NTDEF_ */
|
#endif /* _NTDEF_ */
|
||||||
|
|
Loading…
Reference in a new issue