stdarg.h revision 52289
1/* stdarg.h for GNU. 2 Note that the type used in va_arg is supposed to match the 3 actual type **after default promotions**. 4 Thus, va_arg (..., short) is not valid. */ 5 6/* $FreeBSD: head/contrib/gcc/ginclude/stdarg.h 52289 1999-10-16 07:12:34Z obrien $ */ 7 8#ifndef _STDARG_H 9#ifndef _ANSI_STDARG_H_ 10#ifndef __need___va_list 11#define _STDARG_H 12#define _ANSI_STDARG_H_ 13#endif /* not __need___va_list */ 14#undef __need___va_list 15 16#ifdef __clipper__ 17#include "va-clipper.h" 18#else 19#ifdef __m88k__ 20#include "va-m88k.h" 21#else 22#ifdef __i860__ 23#include "va-i860.h" 24#else 25#ifdef __hppa__ 26#include "va-pa.h" 27#else 28#ifdef __mips__ 29#include "va-mips.h" 30#else 31#ifdef __sparc__ 32#include "va-sparc.h" 33#else 34#ifdef __i960__ 35#include "va-i960.h" 36#else 37#ifdef __alpha__ 38#include "va-alpha.h" 39#else 40#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__) 41#include "va-h8300.h" 42#else 43#if defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32)) 44#include "va-ppc.h" 45#else 46#ifdef __arc__ 47#include "va-arc.h" 48#else 49#ifdef __M32R__ 50#include "va-m32r.h" 51#else 52#ifdef __sh__ 53#include "va-sh.h" 54#else 55#ifdef __mn10300__ 56#include "va-mn10300.h" 57#else 58#ifdef __mn10200__ 59#include "va-mn10200.h" 60#else 61#ifdef __v850__ 62#include "va-v850.h" 63#else 64#if defined (_TMS320C4x) || defined (_TMS320C3x) 65#include <va-c4x.h> 66#else 67 68/* Define __gnuc_va_list. */ 69 70#ifndef __GNUC_VA_LIST 71#define __GNUC_VA_LIST 72#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__) 73typedef char *__gnuc_va_list; 74#else 75typedef void *__gnuc_va_list; 76#endif 77#endif 78 79/* Define the standard macros for the user, 80 if this invocation was from the user program. */ 81#ifdef _STDARG_H 82 83/* Amount of space required in an argument list for an arg of type TYPE. 84 TYPE may alternatively be an expression whose type is used. */ 85 86#if defined(sysV68) 87#define __va_rounded_size(TYPE) \ 88 (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short)) 89#elif defined(_AIX) 90#define __va_rounded_size(TYPE) \ 91 (((sizeof (TYPE) + sizeof (long) - 1) / sizeof (long)) * sizeof (long)) 92#else 93#define __va_rounded_size(TYPE) \ 94 (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) 95#endif 96 97#define va_start(AP, LASTARG) \ 98 (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG))) 99 100#undef va_end 101void va_end (__gnuc_va_list); /* Defined in libgcc.a */ 102#define va_end(AP) ((void)0) 103 104/* We cast to void * and then to TYPE * because this avoids 105 a warning about increasing the alignment requirement. */ 106 107#if (defined (__arm__) && ! defined (__ARMEB__)) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__) 108/* This is for little-endian machines; small args are padded upward. */ 109#define va_arg(AP, TYPE) \ 110 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ 111 *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE)))) 112#else /* big-endian */ 113/* This is for big-endian machines; small args are padded downward. */ 114#define va_arg(AP, TYPE) \ 115 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ 116 *((TYPE *) (void *) ((char *) (AP) \ 117 - ((sizeof (TYPE) < __va_rounded_size (char) \ 118 ? sizeof (TYPE) : __va_rounded_size (TYPE)))))) 119#endif /* big-endian */ 120 121/* Copy __gnuc_va_list into another variable of this type. */ 122#define __va_copy(dest, src) (dest) = (src) 123 124#endif /* _STDARG_H */ 125 126#endif /* not TMS320C3x or TMS320C4x */ 127#endif /* not v850 */ 128#endif /* not mn10200 */ 129#endif /* not mn10300 */ 130#endif /* not sh */ 131#endif /* not m32r */ 132#endif /* not arc */ 133#endif /* not powerpc with V.4 calling sequence */ 134#endif /* not h8300 */ 135#endif /* not alpha */ 136#endif /* not i960 */ 137#endif /* not sparc */ 138#endif /* not mips */ 139#endif /* not hppa */ 140#endif /* not i860 */ 141#endif /* not m88k */ 142#endif /* not clipper */ 143 144#ifdef _STDARG_H 145/* Define va_list, if desired, from __gnuc_va_list. */ 146/* We deliberately do not define va_list when called from 147 stdio.h, because ANSI C says that stdio.h is not supposed to define 148 va_list. stdio.h needs to have access to that data type, 149 but must not use that name. It should use the name __gnuc_va_list, 150 which is safe because it is reserved for the implementation. */ 151 152#ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */ 153#undef _VA_LIST 154#endif 155 156#ifdef _BSD_VA_LIST 157#undef _BSD_VA_LIST 158#endif 159 160#if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST)) 161/* SVR4.2 uses _VA_LIST for an internal alias for va_list, 162 so we must avoid testing it and setting it here. 163 SVR4 uses _VA_LIST as a flag in stdarg.h, but we should 164 have no conflict with that. */ 165#ifndef _VA_LIST_ 166#define _VA_LIST_ 167#ifdef __i860__ 168#ifndef _VA_LIST 169#define _VA_LIST va_list 170#endif 171#endif /* __i860__ */ 172typedef __gnuc_va_list va_list; 173#ifdef _SCO_DS 174#define __VA_LIST 175#endif 176#endif /* _VA_LIST_ */ 177#else /* not __svr4__ || _SCO_DS */ 178 179/* The macro _VA_LIST_ is the same thing used by this file in Ultrix. 180 But on BSD NET2 we must not test or define or undef it. 181 (Note that the comments in NET 2's ansi.h 182 are incorrect for _VA_LIST_--see stdio.h!) */ 183#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT) 184/* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */ 185#ifndef _VA_LIST_DEFINED 186/* The macro _VA_LIST is used in SCO Unix 3.2. */ 187#ifndef _VA_LIST 188/* The macro _VA_LIST_T_H is used in the Bull dpx2 */ 189#ifndef _VA_LIST_T_H 190typedef __gnuc_va_list va_list; 191#endif /* not _VA_LIST_T_H */ 192#endif /* not _VA_LIST */ 193#endif /* not _VA_LIST_DEFINED */ 194#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__)) 195#define _VA_LIST_ 196#endif 197#ifndef _VA_LIST 198#define _VA_LIST 199#endif 200#ifndef _VA_LIST_DEFINED 201#define _VA_LIST_DEFINED 202#endif 203#ifndef _VA_LIST_T_H 204#define _VA_LIST_T_H 205#endif 206 207#endif /* not _VA_LIST_, except on certain systems */ 208 209#endif /* not __svr4__ */ 210 211#endif /* _STDARG_H */ 212 213#endif /* not _ANSI_STDARG_H_ */ 214#endif /* not _STDARG_H */ 215