[VCRUNTIME] Move some definitions from crtdefs.h to vcruntime.h

This reflects what native headers do.
TODO: Move _CRT_ALIGN to corecrt.h
This commit is contained in:
Timo Kreuzer 2024-05-11 10:03:43 +03:00
parent ff2c7c8720
commit 1d01b8c6f0
2 changed files with 114 additions and 119 deletions

View file

@ -28,8 +28,6 @@
#endif
#endif
#undef _CRT_PACKING
#define _CRT_PACKING 8
#pragma pack(push,_CRT_PACKING)
/* Disable non-ANSI C definitions if compiling with __STDC__ */
@ -50,20 +48,11 @@
/** Properties ***************************************************************/
#ifndef _CRT_STRINGIZE
#define __CRT_STRINGIZE(_Value) #_Value
#define _CRT_STRINGIZE(_Value) __CRT_STRINGIZE(_Value)
#endif
#ifndef _CRT_DEFER_MACRO
#define _CRT_DEFER_MACRO(M,...) M(__VA_ARGS__)
#endif
#ifndef _CRT_WIDE
#define __CRT_WIDE(_String) L ## _String
#define _CRT_WIDE(_String) __CRT_WIDE(_String)
#endif
#ifndef _W64
#if !defined(_midl) && defined(_X86_) && _MSC_VER >= 1300
#define _W64 __w64
@ -72,16 +61,6 @@
#endif
#endif
#ifndef _CRTIMP
#ifdef CRTDLL /* Defined for ntdll, crtdll, msvcrt, etc */
#define _CRTIMP
#elif defined(_DLL)
#define _CRTIMP __declspec(dllimport)
#else /* !CRTDLL && !_DLL */
#define _CRTIMP
#endif /* CRTDLL || _DLL */
#endif /* !_CRTIMP */
//#define _CRT_ALTERNATIVE_INLINES
#ifndef _CRTIMP_ALT
@ -150,37 +129,14 @@
#endif
#endif
#ifndef _CRT_ALIGN
#if defined (__midl) || defined(__WIDL__)
#define _CRT_ALIGN(x)
#elif defined(_MSC_VER)
#define _CRT_ALIGN(x) __declspec(align(x))
#else
#define _CRT_ALIGN(x) __attribute__ ((aligned(x)))
#endif
#endif
#ifndef _CRTNOALIAS
#define _CRTNOALIAS
#endif
#ifndef __CRTDECL
#define __CRTDECL __cdecl
#endif
#ifndef _CRT_UNUSED
#define _CRT_UNUSED(x) (void)x
#endif
#ifndef _CONST_RETURN
#ifdef __cplusplus
#define _CONST_RETURN const
#define _CRT_CONST_CORRECT_OVERLOADS
#else
#define _CONST_RETURN
#endif
#endif
#define __crt_typefix(ctype)
#ifndef _STATIC_ASSERT
@ -195,27 +151,10 @@
/** Deprecated ***************************************************************/
#ifdef __GNUC__
#define _CRT_DEPRECATE_TEXT(_Text) __attribute__ ((deprecated))
#elif defined(_MSC_VER)
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
#else
#define _CRT_DEPRECATE_TEXT(_Text)
#endif
#ifndef __STDC_WANT_SECURE_LIB__
#define __STDC_WANT_SECURE_LIB__ 1
#endif
#ifndef _CRT_INSECURE_DEPRECATE
# ifdef _CRT_SECURE_NO_DEPRECATE
# define _CRT_INSECURE_DEPRECATE(_Replacement)
# else
# define _CRT_INSECURE_DEPRECATE(_Replacement) \
_CRT_DEPRECATE_TEXT("This may be unsafe, Try " #_Replacement " instead!")
# endif
#endif
#ifndef _CRT_INSECURE_DEPRECATE_CORE
# ifdef _CRT_SECURE_NO_DEPRECATE_CORE
# define _CRT_INSECURE_DEPRECATE_CORE(_Replacement)
@ -234,10 +173,6 @@
# endif
#endif
#ifndef _CRT_INSECURE_DEPRECATE_MEMORY
#define _CRT_INSECURE_DEPRECATE_MEMORY(_Replacement)
#endif
#ifndef _CRT_INSECURE_DEPRECATE_GLOBALS
#define _CRT_INSECURE_DEPRECATE_GLOBALS(_Replacement)
#endif
@ -276,37 +211,6 @@
extern "C" {
#endif
#ifndef _SIZE_T_DEFINED
#define _SIZE_T_DEFINED
#undef size_t
#ifdef _WIN64
#if defined(__GNUC__) && defined(__STRICT_ANSI__)
typedef unsigned int size_t __attribute__ ((mode (DI)));
#else
__MINGW_EXTENSION typedef unsigned __int64 size_t;
#endif
#else
typedef unsigned int size_t;
#endif
#endif
#ifndef _INTPTR_T_DEFINED
#define _INTPTR_T_DEFINED
#ifndef __intptr_t_defined
#define __intptr_t_defined
#undef intptr_t
#ifdef _WIN64
#if defined(__GNUC__) && defined(__STRICT_ANSI__)
typedef int intptr_t __attribute__ ((mode (DI)));
#else
__MINGW_EXTENSION typedef __int64 intptr_t;
#endif
#else
typedef int intptr_t;
#endif
#endif
#endif
#ifndef _UINTPTR_T_DEFINED
#define _UINTPTR_T_DEFINED
#ifndef __uintptr_t_defined
@ -324,29 +228,6 @@ extern "C" {
#endif
#endif
#ifndef _PTRDIFF_T_DEFINED
#define _PTRDIFF_T_DEFINED
#ifndef _PTRDIFF_T_
#undef ptrdiff_t
#ifdef _WIN64
#if defined(__GNUC__) && defined(__STRICT_ANSI__)
typedef int ptrdiff_t __attribute__ ((mode (DI)));
#else
__MINGW_EXTENSION typedef __int64 ptrdiff_t;
#endif
#else
typedef int ptrdiff_t;
#endif
#endif
#endif
#ifndef _WCHAR_T_DEFINED
#define _WCHAR_T_DEFINED
#if defined(_MSC_VER) || !defined(__cplusplus)
typedef unsigned short wchar_t;
#endif
#endif
#ifndef _WCTYPE_T_DEFINED
#define _WCTYPE_T_DEFINED
typedef unsigned short wint_t;

View file

@ -4,3 +4,117 @@
#include <_mingw.h>
#include <sal.h>
#include <vadefs.h>
#define _CRT_STRINGIZE_(_Value) #_Value
#define _CRT_STRINGIZE(_Value) _CRT_STRINGIZE_(_Value)
#define _CRT_WIDE_(_String) L ## _String
#define _CRT_WIDE(_String) _CRT_WIDE_(_String)
#ifndef _CRTIMP
#ifdef CRTDLL /* Defined for ntdll, crtdll, msvcrt, etc */
#define _CRTIMP
#elif defined(_DLL)
#define _CRTIMP __declspec(dllimport)
#else /* !CRTDLL && !_DLL */
#define _CRTIMP
#endif /* CRTDLL || _DLL */
#endif /* !_CRTIMP */
#ifndef __CRTDECL
#define __CRTDECL __cdecl
#endif
#ifndef _CONST_RETURN
#ifdef __cplusplus
#define _CONST_RETURN const
#define _CRT_CONST_CORRECT_OVERLOADS
#else
#define _CONST_RETURN
#endif
#endif
#ifdef __GNUC__
#define _CRT_DEPRECATE_TEXT(_Text) __attribute__ ((deprecated))
#elif defined(_MSC_VER)
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
#else
#define _CRT_DEPRECATE_TEXT(_Text)
#endif
#ifndef _CRT_INSECURE_DEPRECATE
# ifdef _CRT_SECURE_NO_DEPRECATE
# define _CRT_INSECURE_DEPRECATE(_Replacement)
# else
# define _CRT_INSECURE_DEPRECATE(_Replacement) \
_CRT_DEPRECATE_TEXT("This may be unsafe, Try " #_Replacement " instead!")
# endif
#endif
#ifndef _CRT_INSECURE_DEPRECATE_MEMORY
#define _CRT_INSECURE_DEPRECATE_MEMORY(_Replacement)
#endif
#ifndef _SIZE_T_DEFINED
#define _SIZE_T_DEFINED
#undef size_t
#ifdef _WIN64
#if defined(__GNUC__) && defined(__STRICT_ANSI__)
typedef unsigned int size_t __attribute__ ((mode (DI)));
#else
typedef unsigned __int64 size_t;
#endif
#else
typedef unsigned int size_t;
#endif
#endif
#ifndef _INTPTR_T_DEFINED
#define _INTPTR_T_DEFINED
#ifndef __intptr_t_defined
#define __intptr_t_defined
#undef intptr_t
#ifdef _WIN64
#if defined(__GNUC__) && defined(__STRICT_ANSI__)
typedef int intptr_t __attribute__ ((mode (DI)));
#else
typedef __int64 intptr_t;
#endif
#else
typedef int intptr_t;
#endif
#endif
#endif
#ifndef _PTRDIFF_T_DEFINED
#define _PTRDIFF_T_DEFINED
#ifndef _PTRDIFF_T_
#undef ptrdiff_t
#ifdef _WIN64
#if defined(__GNUC__) && defined(__STRICT_ANSI__)
typedef int ptrdiff_t __attribute__ ((mode (DI)));
#else
__MINGW_EXTENSION typedef __int64 ptrdiff_t;
#endif
#else
typedef int ptrdiff_t;
#endif
#endif
#endif
#ifndef _WCHAR_T_DEFINED
#define _WCHAR_T_DEFINED
#if defined(_MSC_VER) || !defined(__cplusplus)
typedef unsigned short wchar_t;
#endif
#endif
#ifndef _CRT_ALIGN
#if defined (__midl) || defined(__WIDL__)
#define _CRT_ALIGN(x)
#elif defined(_MSC_VER)
#define _CRT_ALIGN(x) __declspec(align(x))
#else
#define _CRT_ALIGN(x) __attribute__ ((aligned(x)))
#endif
#endif