Commit | Line | Data |
---|---|---|
887c375f KB |
1 | /*- |
2 | * Copyright (c) 1991 The Regents of the University of California. | |
3 | * All rights reserved. | |
4 | * | |
5 | * %sccs.include.redist.c% | |
6 | * | |
3b179b9b | 7 | * @(#)stdarg.h 7.2 (Berkeley) %G% |
887c375f KB |
8 | */ |
9 | ||
10 | typedef char *va_list; | |
11 | ||
3b179b9b KB |
12 | #ifdef KERNEL |
13 | #define va_arg(ap, type) \ | |
14 | ((type *)(ap += sizeof(type)))[-1] | |
15 | #else | |
887c375f KB |
16 | #define va_arg(ap, type) \ |
17 | ((type *)(ap += sizeof(type) < sizeof(int) ? \ | |
18 | (abort(), 0) : sizeof(type)))[-1] | |
3b179b9b | 19 | #endif |
887c375f KB |
20 | |
21 | #define va_end(ap) | |
22 | ||
23 | #define __va_promote(type) \ | |
24 | (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) | |
25 | ||
26 | #define va_start(ap, last) \ | |
27 | (ap = ((char *)&(last) + __va_promote(last))) |