source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/vadefs.h@ 1180

Last change on this file since 1180 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 2.7 KB
Line 
1/**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the mingw-w64 runtime package.
4 * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5 */
6#ifndef _INC_VADEFS
7#define _INC_VADEFS
8
9#include <_mingw.h>
10
11#ifndef __WIDL__
12#undef _CRT_PACKING
13#define _CRT_PACKING 8
14#pragma pack(push,_CRT_PACKING)
15#endif
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21#if defined (__GNUC__)
22#ifndef __GNUC_VA_LIST
23#define __GNUC_VA_LIST
24 typedef __builtin_va_list __gnuc_va_list;
25#endif
26#endif /* __GNUC__ */
27
28#ifndef _VA_LIST_DEFINED /* if stdargs.h didn't define it */
29#define _VA_LIST_DEFINED
30#if defined(__GNUC__)
31 typedef __gnuc_va_list va_list;
32#elif defined(_MSC_VER)
33 typedef char * va_list;
34#elif !defined(__WIDL__)
35#error VARARGS not implemented for this compiler
36#endif
37#endif /* _VA_LIST_DEFINED */
38
39#ifdef __cplusplus
40#define _ADDRESSOF(v) (&reinterpret_cast<const char &>(v))
41#else
42#define _ADDRESSOF(v) (&(v))
43#endif
44
45#if defined (__GNUC__)
46/* Use GCC builtins */
47
48#define _crt_va_start(v,l) __builtin_va_start(v,l)
49#define _crt_va_arg(v,l) __builtin_va_arg(v,l)
50#define _crt_va_end(v) __builtin_va_end(v)
51#define _crt_va_copy(d,s) __builtin_va_copy(d,s)
52
53#elif defined(_MSC_VER)
54/* MSVC specific */
55
56#if defined(_M_IA64)
57#define _VA_ALIGN 8
58#define _SLOTSIZEOF(t) ((sizeof(t) + _VA_ALIGN - 1) & ~(_VA_ALIGN - 1))
59#define _VA_STRUCT_ALIGN 16
60#define _ALIGNOF(ap) ((((ap)+_VA_STRUCT_ALIGN - 1) & ~(_VA_STRUCT_ALIGN -1)) - (ap))
61#define _APALIGN(t,ap) (__alignof(t) > 8 ? _ALIGNOF((uintptr_t) ap) : 0)
62#else
63#define _SLOTSIZEOF(t) (sizeof(t))
64#define _APALIGN(t,ap) (__alignof(t))
65#endif
66
67#if defined(_M_IX86)
68
69#define _INTSIZEOF(n) ((sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1))
70#define _crt_va_start(v,l) ((v) = (va_list)_ADDRESSOF(l) + _INTSIZEOF(l))
71#define _crt_va_arg(v,l) (*(l *)(((v) += _INTSIZEOF(l)) - _INTSIZEOF(l)))
72#define _crt_va_end(v) ((v) = (va_list)0)
73#define _crt_va_copy(d,s) ((d) = (s))
74
75#elif defined(_M_AMD64)
76
77#define _PTRSIZEOF(n) ((sizeof(n) + sizeof(void*) - 1) & ~(sizeof(void*) - 1))
78#define _ISSTRUCT(t) ((sizeof(t) > sizeof(void*)) || (sizeof(t) & (sizeof(t) - 1)) != 0)
79#define _crt_va_start(v,l) ((v) = (va_list)_ADDRESSOF(l) + _PTRSIZEOF(l))
80#define _crt_va_arg(v,t) _ISSTRUCT(t) ? \
81 (**(t**)(((v) += sizeof(void*)) - sizeof(void*))) : \
82 ( *(t *)(((v) += sizeof(void*)) - sizeof(void*)))
83#define _crt_va_end(v) ((v) = (va_list)0)
84#define _crt_va_copy(d,s) ((d) = (s))
85
86#elif defined(_M_IA64)
87
88#error VARARGS not implemented for IA64
89
90#else
91
92#error VARARGS not implemented for this TARGET
93
94#endif /* cpu ifdefs */
95
96#endif /* compiler ifdefs */
97
98#ifdef __cplusplus
99}
100#endif
101
102#ifndef __WIDL__
103#pragma pack(pop)
104#endif
105
106#endif /* _INC_VADEFS */
107
Note: See TracBrowser for help on using the repository browser.