ReactOS 0.4.16-dev-340-g0540c21
vcruntime.h
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS SDK
3 * LICENSE: MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE: Common definitions
5 * COPYRIGHT: Copyright 2024 Timo Kreuzer (timo.kreuzer@reactos.org)
6 */
7
8#pragma once
9
10#define _VCRUNTIME_H
11
12#include <_mingw.h>
13#include <sal.h>
14#include <vadefs.h>
15
16#define _CRT_STRINGIZE_(_Value) #_Value
17#define _CRT_STRINGIZE(_Value) _CRT_STRINGIZE_(_Value)
18
19#define _CRT_WIDE_(_String) L ## _String
20#define _CRT_WIDE(_String) _CRT_WIDE_(_String)
21
22#define _CRT_CONCATENATE_(a, b) a ## b
23#define _CRT_CONCATENATE(a, b) _CRT_CONCATENATE_(a, b)
24
25#define _CRT_UNPARENTHESIZE_(...) __VA_ARGS__
26#define _CRT_UNPARENTHESIZE(...) _CRT_UNPARENTHESIZE_ __VA_ARGS__
27
28#ifndef _MSC_VER
29#define __pragma(x) _Pragma(_CRT_STRINGIZE(x))
30#endif
31
32#ifdef __cplusplus
33 #define _CRT_BEGIN_C_HEADER \
34 __pragma(pack(push, _CRT_PACKING_IDENTIFIER, _CRT_PACKING)) \
35 extern "C" {
36 #define _CRT_END_C_HEADER \
37 } \
38 __pragma(pack(pop, _CRT_PACKING_IDENTIFIER))
39#else
40 #define _CRT_BEGIN_C_HEADER \
41 __pragma(pack(push, _CRT_PACKING_IDENTIFIER, _CRT_PACKING))
42 #define _CRT_END_C_HEADER \
43 __pragma(pack(pop, _CRT_PACKING_IDENTIFIER))
44#endif
45
47
48#ifndef _CRTIMP
49 #ifdef CRTDLL /* Defined for ntdll, crtdll, msvcrt, etc */
50 #define _CRTIMP
51 #elif defined(_DLL)
52 #define _CRTIMP __declspec(dllimport)
53 #else /* !CRTDLL && !_DLL */
54 #define _CRTIMP
55 #endif /* CRTDLL || _DLL */
56#endif /* !_CRTIMP */
57
58#ifndef _VCRTIMP
59 #ifndef _VCRT_DEFINED_CRTIMP
60 #define _VCRTIMP _CRTIMP
61 #elif defined(_VCRT_BUILD) && defined(CRTDLL) && !defined(_VCRT_SAT_1)
62 #define _VCRTIMP __declspec(dllexport)
63 #else
64 #define _VCRTIMP
65 #endif
66#endif
67
68#ifndef __CRTDECL
69#define __CRTDECL __cdecl
70#endif
71
72#ifndef _CONST_RETURN
73#ifdef __cplusplus
74#define _CONST_RETURN const
75#define _CRT_CONST_CORRECT_OVERLOADS
76#else
77#define _CONST_RETURN
78#endif
79#endif
80
81#ifdef _BUILD_STD_MODULE
82 #define _VCRT_EXPORT_STD export
83#else
84 #define _VCRT_EXPORT_STD
85#endif
86
87#ifdef __GNUC__
88#define _CRT_DEPRECATE_TEXT(_Text) __attribute__ ((deprecated))
89#elif defined(_MSC_VER)
90#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
91#else
92#define _CRT_DEPRECATE_TEXT(_Text)
93#endif
94
95#ifndef _CRT_INSECURE_DEPRECATE
96# ifdef _CRT_SECURE_NO_DEPRECATE
97# define _CRT_INSECURE_DEPRECATE(_Replacement)
98# else
99# define _CRT_INSECURE_DEPRECATE(_Replacement) \
100 _CRT_DEPRECATE_TEXT("This may be unsafe, Try " #_Replacement " instead!")
101# endif
102#endif
103
104#ifndef _CRT_INSECURE_DEPRECATE_MEMORY
105#define _CRT_INSECURE_DEPRECATE_MEMORY(_Replacement)
106#endif
107
108#ifndef _SIZE_T_DEFINED
109#define _SIZE_T_DEFINED
110#undef size_t
111#ifdef _WIN64
112#if defined(__GNUC__) && defined(__STRICT_ANSI__)
113 typedef unsigned int size_t __attribute__ ((mode (DI)));
114#else
115 typedef unsigned __int64 size_t;
116#endif
117#else
118 typedef unsigned int size_t;
119#endif
120#endif
121
122#ifndef _INTPTR_T_DEFINED
123#define _INTPTR_T_DEFINED
124#ifndef __intptr_t_defined
125#define __intptr_t_defined
126#undef intptr_t
127#ifdef _WIN64
128#if defined(__GNUC__) && defined(__STRICT_ANSI__)
129 typedef int intptr_t __attribute__ ((mode (DI)));
130#else
131 typedef __int64 intptr_t;
132#endif
133#else
134 typedef int intptr_t;
135#endif
136#endif
137#endif
138
139#ifndef _PTRDIFF_T_DEFINED
140#define _PTRDIFF_T_DEFINED
141#ifndef _PTRDIFF_T_
142#undef ptrdiff_t
143#ifdef _WIN64
144#if defined(__GNUC__) && defined(__STRICT_ANSI__)
145 typedef int ptrdiff_t __attribute__ ((mode (DI)));
146#else
148#endif
149#else
150 typedef int ptrdiff_t;
151#endif
152#endif
153#endif
154
155#ifndef _WCHAR_T_DEFINED
156#define _WCHAR_T_DEFINED
157#if defined(_MSC_VER) || !defined(__cplusplus)
158 typedef unsigned short wchar_t;
159#endif
160#endif
161
162#ifndef _CRT_ALIGN
163 #if defined (__midl) || defined(__WIDL__)
164 #define _CRT_ALIGN(x)
165 #elif defined(_MSC_VER)
166 #define _CRT_ALIGN(x) __declspec(align(x))
167 #else
168 #define _CRT_ALIGN(x) __attribute__ ((aligned(x)))
169 #endif
170#endif
171
172#if defined (__midl) || defined(__WIDL__)
173 #define _VCRT_ALIGN(x)
174#elif defined(_MSC_VER)
175 #define _CRT_ALIGN(x) __declspec(align(x))
176#else
177 #define _VCRT_ALIGN(x) __attribute__ ((aligned(x)))
178#endif
179
180#if defined __cplusplus
181 typedef bool __vcrt_bool;
182#elif defined __midl
183 typedef char __vcrt_bool;
184#else
185 typedef _Bool __vcrt_bool;
186#endif
187
188#ifndef _HAS_NODISCARD
189 #ifndef __has_cpp_attribute
190 #define _HAS_NODISCARD 0
191 #elif __has_cpp_attribute(nodiscard) >= 201603L
192 #define _HAS_NODISCARD 1
193 #else
194 #define _HAS_NODISCARD 0
195 #endif
196#endif // _HAS_NODISCARD
197
198#if _HAS_NODISCARD
199 #define _NODISCARD [[nodiscard]]
200#else
201 #define _NODISCARD
202#endif // _HAS_NODISCARD
203
204#if defined _M_X64 || defined _M_ARM || defined _M_ARM64
205 #define _UNALIGNED __unaligned
206#else
207 #define _UNALIGNED
208#endif
209
210#ifdef __cplusplus
211 // Safer than the C definition, as it ensures that the argument is not a pointer
212 extern "C++" template<typename _T, size_t _Size>
213 char (*__crt_countof_helper(_UNALIGNED _T(&_Array)[_Size]))[_Size];
214 #define __crt_countof(_Array) sizeof(*__crt_countof_helper(_Array))
215#else
216 #define __crt_countof(_Array) (sizeof(_Array) / sizeof(_Array[0]))
217#endif
218
221
#define __MINGW_EXTENSION
Definition: _mingw.h:166
#define __cdecl
Definition: accygwin.h:79
#define __int64
Definition: basetyps.h:16
#define __attribute__(x)
Definition: wpp_private.h:207
unsigned char
Definition: typeof.h:29
__kernel_ptrdiff_t ptrdiff_t
Definition: linux.h:247
GLenum mode
Definition: glext.h:6217
_Check_return_ _Ret_maybenull_ _In_ size_t _In_ size_t _Size
Definition: malloc.h:109
unsigned int uintptr_t
Definition: intrin.h:47
_Bool __vcrt_bool
Definition: vcruntime.h:185
int intptr_t
Definition: vcruntime.h:134
uintptr_t __security_cookie
Definition: gs_support.c:49
#define _UNALIGNED
Definition: vcruntime.h:207
#define _CRT_END_C_HEADER
Definition: vcruntime.h:42
unsigned int size_t
Definition: vcruntime.h:118
#define _CRT_BEGIN_C_HEADER
Definition: vcruntime.h:40
unsigned short wchar_t
Definition: vcruntime.h:158
void __cdecl __security_init_cookie(void)
Definition: gs_support.c:55
int ptrdiff_t
Definition: vcruntime.h:150
#define _T(x)
Definition: vfdio.h:22