diff options
Diffstat (limited to 'src/include/stdarg.h')
-rw-r--r-- | src/include/stdarg.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/include/stdarg.h b/src/include/stdarg.h new file mode 100644 index 0000000..fd79ec0 --- /dev/null +++ b/src/include/stdarg.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #ifndef _STDARG_H | ||
2 | #define _STDARG_H | ||
3 | |||
4 | typedef char *va_list; | ||
5 | |||
6 | /* Amount of space required in an argument list for an arg of type TYPE. | ||
7 | TYPE may alternatively be an expression whose type is used. */ | ||
8 | |||
9 | #define __va_rounded_size(TYPE) \ | ||
10 | (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) | ||
11 | |||
12 | #ifndef __sparc__ | ||
13 | #define va_start(AP, LASTARG) \ | ||
14 | (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG))) | ||
15 | #else | ||
16 | #define va_start(AP, LASTARG) \ | ||
17 | (__builtin_saveregs (), \ | ||
18 | AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG))) | ||
19 | #endif | ||
20 | |||
21 | void va_end (va_list); /* Defined in gnulib */ | ||
22 | #define va_end(AP) | ||
23 | |||
24 | #define va_arg(AP, TYPE) \ | ||
25 | (AP += __va_rounded_size (TYPE), \ | ||
26 | *((TYPE *) (AP - __va_rounded_size (TYPE)))) | ||
27 | |||
28 | #endif /* _STDARG_H */ | ||