stdarg.h (d9cb97ff9d0fac18582a28939b3ed4a429e4eba0) | stdarg.h (eca69d62e72cc0decefa4bce9b5b259ac077cf4f) |
---|---|
1/*- 2 * Copyright (c) 2002 David E. O'Brien. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 17 unchanged lines hidden (view full) --- 26 * SUCH DAMAGE. 27 * 28 * $FreeBSD$ 29 */ 30 31#ifndef _MACHINE_STDARG_H_ 32#define _MACHINE_STDARG_H_ 33 | 1/*- 2 * Copyright (c) 2002 David E. O'Brien. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. --- 17 unchanged lines hidden (view full) --- 26 * SUCH DAMAGE. 27 * 28 * $FreeBSD$ 29 */ 30 31#ifndef _MACHINE_STDARG_H_ 32#define _MACHINE_STDARG_H_ 33 |
34#include <sys/cdefs.h> 35#include <sys/_types.h> | 34#include <machine/ansi.h> |
36 | 35 |
37#ifndef _VA_LIST_DECLARED 38#define _VA_LIST_DECLARED 39typedef __va_list va_list; 40#endif | 36typedef _BSD_VA_LIST_ va_list; |
41 | 37 |
42#ifdef __GNUCLIKE_BUILTIN_STDARG 43 | |
44#define va_start(ap, last) \ | 38#define va_start(ap, last) \ |
45 __builtin_va_start((ap), (last)) | 39 __builtin_stdarg_start((ap), (last)) |
46 47#define va_arg(ap, type) \ 48 __builtin_va_arg((ap), type) 49 | 40 41#define va_arg(ap, type) \ 42 __builtin_va_arg((ap), type) 43 |
50#define __va_copy(dest, src) \ 51 __builtin_va_copy((dest), (src)) 52 53#if __ISO_C_VISIBLE >= 1999 54#define va_copy(dest, src) \ 55 __va_copy(dest, src) 56#endif 57 | |
58#define va_end(ap) \ 59 __builtin_va_end(ap) 60 | 44#define va_end(ap) \ 45 __builtin_va_end(ap) 46 |
61#elif defined(lint) 62/* Provide a fake implementation for lint's benefit */ 63#define __va_size(type) \ 64 (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long)) 65#define va_start(ap, last) \ 66 ((ap) = (va_list)&(last) + __va_size(last)) 67#define va_arg(ap, type) \ 68 (*(type *)((ap) += __va_size(type), (ap) - __va_size(type))) 69#define va_end(ap) 70 71#else 72#error this file needs to be ported to your compiler 73#endif 74 | |
75#endif /* !_MACHINE_STDARG_H_ */ | 47#endif /* !_MACHINE_STDARG_H_ */ |