Commit | Line | Data |
---|---|---|
7c61b3bd KB |
1 | /*- |
2 | * Copyright (c) 1992 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * %sccs.include.redist.c% | |
6 | * | |
3ffaadf7 | 7 | * @(#)stdarg.h 7.3 (Berkeley) %G% |
7c61b3bd KB |
8 | */ |
9 | ||
3ffaadf7 KB |
10 | #ifndef _STDARG_H_ |
11 | #define _STDARG_H_ | |
12 | ||
7c61b3bd KB |
13 | typedef char *va_list; |
14 | ||
15 | #define __va_promote(type) \ | |
16 | (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) | |
17 | ||
18 | #define va_start(ap, last) \ | |
19 | (ap = ((char *)&(last) + __va_promote(last))) | |
20 | ||
21 | #ifdef KERNEL | |
22 | #define va_arg(ap, type) \ | |
23 | ((type *)(ap += sizeof(type)))[-1] | |
24 | #else | |
25 | #define va_arg(ap, type) \ | |
26 | ((type *)(ap += sizeof(type) == sizeof(int) ? sizeof(type) : \ | |
27 | sizeof(type) > sizeof(int) ? \ | |
0090f59b | 28 | (-(int)(ap) & (sizeof(type) - 1)) + sizeof(type) : \ |
7c61b3bd KB |
29 | (abort(), 0)))[-1] |
30 | #endif | |
31 | ||
32 | #define va_end(ap) | |
3ffaadf7 KB |
33 | |
34 | #endif /* !_STDARG_H_ */ |