Annotation of sys/arch/sparc64/include/stdarg.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: stdarg.h,v 1.6 2006/04/09 03:07:53 deraadt Exp $ */
! 2: /* $NetBSD: stdarg.h,v 1.11 2000/07/23 21:36:56 mycroft Exp $ */
! 3:
! 4: /*
! 5: * Copyright (c) 1992, 1993
! 6: * The Regents of the University of California. All rights reserved.
! 7: *
! 8: * This software was developed by the Computer Systems Engineering group
! 9: * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
! 10: * contributed to Berkeley.
! 11: *
! 12: * All advertising materials mentioning features or use of this software
! 13: * must display the following acknowledgement:
! 14: * This product includes software developed by the University of
! 15: * California, Lawrence Berkeley Laboratory.
! 16: *
! 17: * Redistribution and use in source and binary forms, with or without
! 18: * modification, are permitted provided that the following conditions
! 19: * are met:
! 20: * 1. Redistributions of source code must retain the above copyright
! 21: * notice, this list of conditions and the following disclaimer.
! 22: * 2. Redistributions in binary form must reproduce the above copyright
! 23: * notice, this list of conditions and the following disclaimer in the
! 24: * documentation and/or other materials provided with the distribution.
! 25: * 3. Neither the name of the University nor the names of its contributors
! 26: * may be used to endorse or promote products derived from this software
! 27: * without specific prior written permission.
! 28: *
! 29: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
! 30: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! 31: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! 32: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
! 33: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
! 34: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
! 35: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 36: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
! 37: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
! 38: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
! 39: * SUCH DAMAGE.
! 40: *
! 41: * from: @(#)stdarg.h 8.2 (Berkeley) 9/27/93
! 42: */
! 43:
! 44: #ifndef _SPARC64_STDARG_H_
! 45: #define _SPARC64_STDARG_H_
! 46:
! 47: #include <sys/cdefs.h>
! 48: #include <machine/_types.h>
! 49:
! 50: #ifdef __lint__
! 51: #define __builtin_saveregs(t) (0)
! 52: #define __builtin_classify_type(t) (0)
! 53: #define __builtin_next_arg(t) ((t) ? 0 : 0)
! 54: #endif
! 55:
! 56: typedef __va_list va_list;
! 57:
! 58: #ifdef lint
! 59: #define va_start(ap,lastarg) ((ap) = (ap))
! 60: #else
! 61: #define va_start(ap, last) \
! 62: (__builtin_next_arg(last), (ap) = (va_list)__builtin_saveregs())
! 63: #endif /* lint */
! 64:
! 65: #if __BSD_VISIBLE
! 66: #define va_copy(dest, src) \
! 67: ((dest) = (src))
! 68: #endif
! 69:
! 70: #define va_end(ap)
! 71:
! 72: /*
! 73: * For sparcv9 code.
! 74: */
! 75: #define __va_arg8(ap, type) \
! 76: (*(type *)(void *)((ap) += 8, (ap) - 8))
! 77: #define __va_arg16(ap, type) \
! 78: (*(type *)(void *)((ap) = (va_list)(((unsigned long)(ap) + 31) & -16),\
! 79: (ap) - 16))
! 80: #define __va_int(ap, type) \
! 81: (*(type *)(void *)((ap) += 8, (ap) - sizeof(type)))
! 82:
! 83: #define __REAL_TYPE_CLASS 8
! 84: #define __RECORD_TYPE_CLASS 12
! 85: #define va_arg(ap, type) \
! 86: (__builtin_classify_type(*(type *)0) == __REAL_TYPE_CLASS ? \
! 87: (__alignof__(type) == 16 ? __va_arg16(ap, type) : \
! 88: __va_arg8(ap, type)) : \
! 89: (__builtin_classify_type(*(type *)0) < __RECORD_TYPE_CLASS ? \
! 90: __va_int(ap, type) : \
! 91: (sizeof(type) <= 8 ? __va_arg8(ap, type) : \
! 92: (sizeof(type) <= 16 ? __va_arg16(ap, type) : \
! 93: *__va_arg8(ap, type *)))))
! 94:
! 95: #endif /* !_SPARC64_STDARG_H_ */
CVSweb