Rev 974 | Rev 1113 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 974 | Rev 1010 | ||
---|---|---|---|
Line 27... | Line 27... | ||
27 | */ |
27 | */ |
28 | 28 | ||
29 | #ifndef __LIBC__STDARG_H__ |
29 | #ifndef __LIBC__STDARG_H__ |
30 | #define __LIBC__STDARG_H__ |
30 | #define __LIBC__STDARG_H__ |
31 | 31 | ||
32 | #ifndef __VARARGS_DEFINED |
- | |
33 | #define __VARARGS_DEFINED |
32 | #include<types.h> |
34 | - | ||
35 | /* |
- | |
36 | * Variable argument list manipulation macros |
- | |
37 | * for architectures using stack to pass arguments. |
- | |
38 | */ |
- | |
39 | - | ||
40 | #include <types.h> |
33 | #include<stackarg.h> |
41 | 34 | ||
42 | typedef struct va_list { |
35 | #ifndef __VARARGS_DEFINED |
43 | int pos; |
- | |
44 | uint8_t *last; |
- | |
45 | } va_list; |
- | |
46 | - | ||
47 | #define va_start(ap, lst) \ |
- | |
48 | (ap).pos = sizeof(lst); \ |
- | |
49 | (ap).last = (uint8_t *) &(lst) |
- | |
50 | - | ||
51 | #define va_arg(ap, type) \ |
36 | # define __VARARGS_DEFINED |
52 | (*((type *)((ap).last + ((ap).pos += sizeof(type) ) - sizeof(type)))) |
- | |
53 | 37 | ||
54 | #define va_end(ap) |
38 | typedef __builtin_va_list va_list; |
55 | 39 | ||
- | 40 | # define va_start(ap, last) __builtin_va_start(ap, last) |
|
- | 41 | # define va_arg(ap, type) __builtin_va_arg(ap, type) |
|
56 | #endif |
42 | # define va_end(ap) __builtin_va_end(ap) |
57 | 43 | ||
- | 44 | # endif |
|
58 | 45 | ||
59 | #endif |
46 | #endif |