28 lines
649 B
C
28 lines
649 B
C
|
#ifndef _FAKELIBC_STDARG_H
|
||
|
#define _FAKELIBC_STDARG_H
|
||
|
|
||
|
// TODO: This will basically not work except for the simplest printf-like cases
|
||
|
|
||
|
typedef long long** va_list;
|
||
|
|
||
|
#define _VA_CHECK() \
|
||
|
if (__builtin_func_callconv != 101) {\
|
||
|
printf("ERROR: Unpacking varargs currently only works with __classic_call (#101). Function %s uses convention %d instead.\n", __func__, __builtin_func_callconv);\
|
||
|
}
|
||
|
|
||
|
#define va_start(list,lastarg) \
|
||
|
do {\
|
||
|
_VA_CHECK();\
|
||
|
list = &lastarg;\
|
||
|
list++;\
|
||
|
} while(0)
|
||
|
|
||
|
#define va_arg(list,T) \
|
||
|
(T)(list++)
|
||
|
|
||
|
#define va_end(list) \
|
||
|
do {list = (void*)0;} while(0)
|
||
|
|
||
|
/* From ifndef at top of file: */
|
||
|
#endif
|