stdarg.h (88107) | stdarg.h (96317) |
---|---|
1/*- | 1/*- |
2 * Copyright (c) 2002 David E. O'Brien. All rights reserved. |
|
2 * Copyright (c) 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. --- 16 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)stdarg.h 8.1 (Berkeley) 6/10/93 | 3 * Copyright (c) 1991, 1993 4 * The Regents of the University of California. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. --- 16 unchanged lines hidden (view full) --- 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)stdarg.h 8.1 (Berkeley) 6/10/93 |
34 * $FreeBSD: head/sys/i386/include/stdarg.h 88107 2001-12-18 03:28:08Z obrien $ | 35 * $FreeBSD: head/sys/i386/include/stdarg.h 96317 2002-05-10 02:02:54Z obrien $ |
35 */ 36 37#ifndef _STDARG_H_ 38#define _STDARG_H_ 39 | 36 */ 37 38#ifndef _STDARG_H_ 39#define _STDARG_H_ 40 |
40#if defined __GNUC__ && ((__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || __GNUC__ > 2) 41#include <machine/gcc_stdarg.h> 42#else /* __GNUC__ */ 43 | |
44#include <machine/ansi.h> 45 46typedef _BSD_VA_LIST_ va_list; 47 | 41#include <machine/ansi.h> 42 43typedef _BSD_VA_LIST_ va_list; 44 |
48#define __va_size(type) \ 49 (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) | 45#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3) |
50 | 46 |
47#define va_start(ap, last) \ 48 __builtin_stdarg_start((ap), (last)) 49 50#define va_arg(ap, type) \ 51 __builtin_va_arg((ap), type) 52 53#define va_end(ap) \ 54 __builtin_va_end(ap) 55 56#else /* ! __GNUC__ post GCC 2.95 */ 57 |
|
51#ifdef __GNUC__ 52#define va_start(ap, last) \ 53 ((ap) = (va_list)__builtin_next_arg(last)) 54#else | 58#ifdef __GNUC__ 59#define va_start(ap, last) \ 60 ((ap) = (va_list)__builtin_next_arg(last)) 61#else |
62#define __va_size(type) \ 63 (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) |
|
55#define va_start(ap, last) \ 56 ((ap) = (va_list)&(last) + __va_size(last)) 57#endif 58 59#define va_arg(ap, type) \ 60 (*(type *)((ap) += __va_size(type), (ap) - __va_size(type))) 61 62#define va_end(ap) 63 | 64#define va_start(ap, last) \ 65 ((ap) = (va_list)&(last) + __va_size(last)) 66#endif 67 68#define va_arg(ap, type) \ 69 (*(type *)((ap) += __va_size(type), (ap) - __va_size(type))) 70 71#define va_end(ap) 72 |
64#endif /* __GNUC__ */ | 73#endif /* __GNUC__ post GCC 2.95 */ |
65 66#endif /* !_STDARG_H_ */ | 74 75#endif /* !_STDARG_H_ */ |