ReactOS
0.4.16-dev-2104-gb84fa49
vadefs.h
Go to the documentation of this file.
1
/*
2
* Variable argument definitions
3
*
4
* Copyright 2022 Jacek Caban
5
*
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2.1 of the License, or (at your option) any later version.
10
*
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this library; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19
*/
20
21
#ifndef _INC_VADEFS
22
#define _INC_VADEFS
23
24
#include <
corecrt.h
>
25
26
#ifdef __cplusplus
27
#define _ADDRESSOF(v) (&reinterpret_cast<const char &>(v))
28
#else
29
#define _ADDRESSOF(v) (&(v))
30
#endif
31
32
#if defined (__GNUC__) && defined(__x86_64__)
33
34
typedef
__builtin_ms_va_list
va_list
;
35
#define _crt_va_start(v,l) __builtin_ms_va_start(v,l)
36
#define _crt_va_arg(v,l) __builtin_va_arg(v,l)
37
#define _crt_va_end(v) __builtin_ms_va_end(v)
38
#define _crt_va_copy(d,s) __builtin_ms_va_copy(d,s)
39
40
#elif defined(__GNUC__) || defined(__clang__)
41
42
typedef
__builtin_va_list
va_list
;
43
#define _crt_va_start(v,l) __builtin_va_start(v,l)
44
#define _crt_va_arg(v,l) __builtin_va_arg(v,l)
45
#define _crt_va_end(v) __builtin_va_end(v)
46
#define _crt_va_copy(d,s) __builtin_va_copy(d,s)
47
48
#else
49
50
typedef
char
*
va_list
;
51
52
#if defined(__i386__)
53
#define _INTSIZEOF(n) ((sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1))
54
#define _crt_va_start(v,l) ((v) = (va_list)_ADDRESSOF(l) + _INTSIZEOF(l))
55
#define _crt_va_arg(v,l) (*(l *)(((v) += _INTSIZEOF(l)) - _INTSIZEOF(l)))
56
#define _crt_va_end(v) ((v) = (va_list)0)
57
#define _crt_va_copy(d,s) ((d) = (s))
58
#endif
59
60
#endif
61
62
#endif
/* _INC_VADEFS */
va_list
char * va_list
Definition:
vadefs.h:50
corecrt.h
dll
win32
msvcrt
include
vadefs.h
Generated on Tue Jan 6 2026 06:18:16 for ReactOS by
1.9.6