| 1 | /*- |
| 2 | * Copyright (c) 1991 The Regents of the University of California. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * %sccs.include.redist.c% |
| 6 | * |
| 7 | * @(#)stdarg.h 7.2 (Berkeley) %G% |
| 8 | */ |
| 9 | |
| 10 | typedef char *va_list; |
| 11 | |
| 12 | #ifdef KERNEL |
| 13 | #define va_arg(ap, type) \ |
| 14 | ((type *)(ap += sizeof(type)))[-1] |
| 15 | #else |
| 16 | #define va_arg(ap, type) \ |
| 17 | ((type *)(ap += sizeof(type) < sizeof(int) ? \ |
| 18 | (abort(), 0) : sizeof(type)))[-1] |
| 19 | #endif |
| 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))) |