extensive header cleanup for standards conformance & correctness
[musl] / include / stdarg.h
1 #ifndef _STDARG_H
2 #define _STDARG_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #define __NEED_va_list
9
10 #include <bits/alltypes.h>
11
12 #define __VA_ALIGNED_SIZE(x) ((sizeof(x) + sizeof(int) - 1) & ~(sizeof(int) - 1))
13
14 #define va_start(ap, last) ((ap) = (void *)(((char *)&(last)) + __VA_ALIGNED_SIZE(last)))
15 #define va_end(ap) ((void)0)
16 #define va_copy(dest, src) ((dest) = (src))
17
18 #if 0
19 #define va_arg(ap, type) \
20         ( ((ap) = (va_list)((char *)(ap) + sizeof(type))), \
21         *(type *)(void *)((char *)(ap) - sizeof(type)) )
22 #endif
23
24 #define va_arg(ap, type) \
25         ( ((ap) = (va_list)((char *)(ap) + __VA_ALIGNED_SIZE(type))), \
26         *(type *)(void *)((char *)(ap) - __VA_ALIGNED_SIZE(type)) )
27
28 #ifdef __cplusplus
29 }
30 #endif
31
32 #endif