From ad355938a5aaccbe0a13d06d048ebdc13abbfad2 Mon Sep 17 00:00:00 2001 From: Max Wash Date: Thu, 4 Mar 2021 16:52:31 +0000 Subject: [PATCH] Added stdarg.h --- photon/libc/include/stdarg.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 photon/libc/include/stdarg.h diff --git a/photon/libc/include/stdarg.h b/photon/libc/include/stdarg.h new file mode 100644 index 0000000..32ab4b1 --- /dev/null +++ b/photon/libc/include/stdarg.h @@ -0,0 +1,20 @@ +#ifndef STDARG_H +#define STDARG_H + +//typedef struct __va_list_tag *va_list; +typedef __builtin_va_list va_list; + +# if defined(__GNUC__) && __GNUC__ >= 3 +#define va_start(ap, arg) __builtin_va_start((ap), (arg)) +#define va_arg __builtin_va_arg +#define va_copy __builtin_va_copy +#define va_end(ap) __builtin_va_end((ap)) +#else +#error Unsupported compiler +#define va_start(ap, arg) ((ap) = ((va_list)&(arg)) + ((sizeof(long) > sizeof(arg)) ? sizeof(long) : sizeof(arg))) +#define va_arg(ap, type) *(type *)(ap), ((ap) += ((sizeof(long) > sizeof(type)) ? sizeof(long) : sizeof(type))) +#define va_copy(copy, arg) ((copy) = (arg)) +#define va_end(ap) +#endif + +#endif \ No newline at end of file