[INCLUDE]

- Move definition of va_list to crtdefs.h
- Remove useless definitions from vadefs.h
- Cleanup the mess in stdarg.h
- Add memmove prototype to intrin_x86.h, since it's used there
- basetyps.h: guard STDMETHODCALLTYPE & friends from redefinition
- guiddef.h: define FAR, include string.h
- ntdef.h: don't include stdarg.h and string anymore, enable STRICT, remove FAR, add STDMETHODCALLTYPE & friends

svn path=/trunk/; revision=63530
This commit is contained in:
Timo Kreuzer 2014-06-01 21:47:51 +00:00
parent 1591c79743
commit ac7d530c44
7 changed files with 68 additions and 165 deletions

View file

@ -20,6 +20,10 @@
#endif
#endif
#undef _CRT_PACKING
#define _CRT_PACKING 8
#pragma pack(push,_CRT_PACKING)
/* Disable non-ANSI C definitions if compiling with __STDC__ */
//HACK: Disabled
//#if __STDC__
@ -29,10 +33,6 @@
/** Properties ***************************************************************/
#undef _CRT_PACKING
#define _CRT_PACKING 8
#pragma pack(push,_CRT_PACKING)
#ifndef _CRT_STRINGIZE
#define __CRT_STRINGIZE(_Value) #_Value
#define _CRT_STRINGIZE(_Value) __CRT_STRINGIZE(_Value)
@ -327,6 +327,22 @@ extern "C" {
typedef unsigned short wctype_t;
#endif
#ifdef __GNUC__
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
typedef __builtin_va_list __gnuc_va_list;
#endif
#endif
#ifndef _VA_LIST_DEFINED
#define _VA_LIST_DEFINED
#if defined(__GNUC__)
typedef __gnuc_va_list va_list;
#elif defined(_MSC_VER)
typedef _Writable_bytes_(_Inexpressible_("length varies")) char * va_list;
#endif
#endif
#ifndef _ERRCODE_DEFINED
#define _ERRCODE_DEFINED
typedef int errcode;

View file

@ -70,6 +70,7 @@ extern "C" {
#endif
/*** memcopy must be memmove ***/
void* memmove(void*, const void*, size_t);
__INTRIN_INLINE void* memcpy(void* dest, const void* source, size_t num)
{
return memmove(dest, source, num);

View file

@ -28,124 +28,18 @@ Boston, MA 02110-1301, USA. */
* ISO C Standard: 7.15 Variable arguments <stdarg.h>
*/
#pragma once
#ifndef _INC_STDARG
#define _INC_STDARG
#include <crtdefs.h>
#include <vadefs.h>
#ifndef _WIN32
#error Only Win32 target is supported!
#endif
#ifndef _STDARG_H
#ifndef _ANSI_STDARG_H_
#ifndef __need___va_list
#define _STDARG_H
#define _ANSI_STDARG_H_
#endif /* not __need___va_list */
#undef __need___va_list
/* Define __gnuc_va_list. */
#ifdef __GNUC__
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
typedef __builtin_va_list __gnuc_va_list;
#endif
#endif
/* Define the standard macros for the user,
if this invocation was from the user program. */
#ifdef _STDARG_H
#ifdef __GNUC__
#define va_start(v,l) __builtin_va_start(v,l)
#define va_end(v) __builtin_va_end(v)
#define va_arg(v,l) __builtin_va_arg(v,l)
#if !defined(__STRICT_ANSI__) || __STDC_VERSION__ + 0 >= 199900L
#define va_copy(d,s) __builtin_va_copy(d,s)
#endif
#define __va_copy(d,s) __builtin_va_copy(d,s)
#endif
/* Define va_list, if desired, from __gnuc_va_list. */
/* We deliberately do not define va_list when called from
stdio.h, because ANSI C says that stdio.h is not supposed to define
va_list. stdio.h needs to have access to that data type,
but must not use that name. It should use the name __gnuc_va_list,
which is safe because it is reserved for the implementation. */
#ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
#undef _VA_LIST
#endif
#ifdef _BSD_VA_LIST
#undef _BSD_VA_LIST
#endif
#ifdef __GNUC__
#if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST))
/* SVR4.2 uses _VA_LIST for an internal alias for va_list,
so we must avoid testing it and setting it here.
SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
have no conflict with that. */
#ifndef _VA_LIST_
#define _VA_LIST_
#ifdef __i860__
#ifndef _VA_LIST
#define _VA_LIST va_list
#endif
#endif /* __i860__ */
typedef __gnuc_va_list va_list;
#ifdef _SCO_DS
#define __VA_LIST
#endif
#endif /* _VA_LIST_ */
#else /* not __svr4__ || _SCO_DS */
/* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
But on BSD NET2 we must not test or define or undef it.
(Note that the comments in NET 2's ansi.h
are incorrect for _VA_LIST_--see stdio.h!) */
#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
/* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
#ifndef _VA_LIST_DEFINED
/* The macro _VA_LIST is used in SCO Unix 3.2. */
#ifndef _VA_LIST
/* The macro _VA_LIST_T_H is used in the Bull dpx2 */
#ifndef _VA_LIST_T_H
/* The macro __va_list__ is used by BeOS. */
#ifndef __va_list__
typedef __gnuc_va_list va_list;
#endif /* not __va_list__ */
#endif /* not _VA_LIST_T_H */
#endif /* not _VA_LIST */
#endif /* not _VA_LIST_DEFINED */
#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
#define _VA_LIST_
#endif
#ifndef _VA_LIST
#define _VA_LIST
#endif
#ifndef _VA_LIST_DEFINED
#define _VA_LIST_DEFINED
#endif
#ifndef _VA_LIST_T_H
#define _VA_LIST_T_H
#endif
#ifndef __va_list__
#define __va_list__
#endif
#endif /* not _VA_LIST_, except on certain systems */
#endif /* not __svr4__ */
#endif /* __GNUC__ */
#endif /* _STDARG_H */
#endif /* not _ANSI_STDARG_H_ */
#endif /* not _STDARG_H */
#include <vadefs.h>
#ifndef va_start
#define va_start _crt_va_start
#endif

View file

@ -20,39 +20,6 @@
extern "C" {
#endif
#ifndef _UINTPTR_T_DEFINED
#define _UINTPTR_T_DEFINED
#ifndef __uintptr_t_defined
#define __uintptr_t_defined
#undef uintptr_t
#ifdef _WIN64
#if defined(__GNUC__) && defined(__STRICT_ANSI__)
typedef unsigned int uintptr_t __attribute__ ((mode (DI)));
#else
__MINGW_EXTENSION typedef unsigned __int64 uintptr_t;
#endif
#else
typedef unsigned long uintptr_t;
#endif
#endif
#endif
#ifdef __GNUC__
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
typedef __builtin_va_list __gnuc_va_list;
#endif
#endif
#ifndef _VA_LIST_DEFINED
#define _VA_LIST_DEFINED
#if defined(__GNUC__)
typedef __gnuc_va_list va_list;
#elif defined(_MSC_VER)
typedef char * va_list;
#endif
#endif
#ifdef __cplusplus
#define _ADDRESSOF(v) (&reinterpret_cast<const char &>(v))
#else

View file

@ -33,6 +33,7 @@
# endif
#endif
#ifndef STDMETHODCALLTYPE
#define STDMETHODCALLTYPE __stdcall
#define STDMETHODVCALLTYPE __cdecl
#define STDAPICALLTYPE __stdcall
@ -45,6 +46,7 @@
#define STDAPIV_(t) EXTERN_C t STDAPIVCALLTYPE
#define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
#define STDMETHODIMPV_(t) t STDMETHODVCALLTYPE
#endif /* !STDMETHODCALLTYPE */
#if defined(__cplusplus) && !defined(CINTERFACE)
# define interface struct

View file

@ -18,6 +18,7 @@
#ifndef GUID_DEFINED
#define GUID_DEFINED
typedef struct _GUID
{
#ifdef _MSC_VER
@ -31,6 +32,10 @@ typedef struct _GUID
} GUID;
#endif
#ifndef FAR
#define FAR
#endif
#ifndef DECLSPEC_SELECTANY
#define DECLSPEC_SELECTANY __declspec(selectany)
#endif
@ -109,6 +114,8 @@ typedef GUID FMTID,*LPFMTID;
#define REFFMTID const FMTID* __MIDL_CONST
#endif /* !defined(__cplusplus) && !defined(CINTERFACE) */
#if !defined(__midl) && !defined(__WIDL__)
#include <string.h>
#if defined(__cplusplus) && !defined(CINTERFACE)
__inline int InlineIsEqualGUID(REFGUID rguid1, REFGUID rguid2)
@ -131,6 +138,7 @@ __inline int InlineIsEqualGUID(REFGUID rguid1, REFGUID rguid2)
#define IsEqualGUID(rguid1, rguid2) (!memcmp(rguid1, rguid2, sizeof(GUID)))
#endif /* defined(__cplusplus) && !defined(CINTERFACE) */
#endif /* __midl && __WIDL__ */
#if defined(__cplusplus) && !defined(CINTERFACE)
#include <string.h>

View file

@ -31,10 +31,6 @@
#include <specstrings.h>
#include <kernelspecs.h>
// FIXME: Shouldn't be included!
#include <stdarg.h>
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
@ -42,7 +38,7 @@ extern "C" {
/* Default to strict */
#ifndef NO_STRICT
#ifndef STRICT
//#define STRICT 1 // FIXME: disabled for now
#define STRICT 1
#endif
#endif
@ -68,11 +64,6 @@ extern "C" {
#define CRITICAL
#endif
// FIXME: deprecated
#ifndef FAR
#define FAR
#endif
/* Constant modifier */
#ifndef CONST
#define CONST const
@ -98,12 +89,6 @@ extern "C" {
#define ANYSIZE_ARRAY 1
#endif
#ifdef __cplusplus
#define EXTERN_C extern "C"
#else
#define EXTERN_C extern
#endif
/* Helper macro to enable gcc's extension. */
#ifndef __GNU_EXTENSION
#ifdef __GNUC__
@ -232,6 +217,12 @@ extern "C" {
#define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(ULONG)
#endif
#ifdef __cplusplus
#define EXTERN_C extern "C"
#else
#define EXTERN_C extern
#endif
/* Calling Conventions */
#if defined(_MANAGED)
#define FASTCALL __stdcall
@ -243,6 +234,30 @@ extern "C" {
#define NTAPI __stdcall
#ifndef STDMETHODCALLTYPE
#define STDMETHODCALLTYPE __stdcall
#define STDMETHODVCALLTYPE __cdecl
#define STDAPICALLTYPE __stdcall
#define STDAPIVCALLTYPE __cdecl
#define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
#define STDAPI_(t) EXTERN_C t STDAPICALLTYPE
#define STDMETHODIMP HRESULT STDMETHODCALLTYPE
#define STDMETHODIMP_(t) t STDMETHODCALLTYPE
#define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
#define STDAPIV_(t) EXTERN_C t STDAPIVCALLTYPE
#define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
#define STDMETHODIMPV_(t) t STDMETHODVCALLTYPE
#endif /* !STDMETHODCALLTYPE */
#define STDOVERRIDEMETHODIMP __override STDMETHODIMP
#define STDOVERRIDEMETHODIMP_(t) __override STDMETHODIMP_(t)
#define IFACEMETHODIMP __override STDMETHODIMP
#define IFACEMETHODIMP_(t) __override STDMETHODIMP_(t)
#define STDOVERRIDEMETHODIMPV __override STDMETHODIMPV
#define STDOVERRIDEMETHODIMPV_(t) __override STDMETHODIMPV_(t)
#define IFACEMETHODIMPV __override STDMETHODIMPV
#define IFACEMETHODIMPV_(t) __override STDMETHODIMPV_(t)
/* Import and Export Specifiers */