The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/EXTERNAL_HEADERS/stdarg.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
    3  *
    4  * @APPLE_LICENSE_HEADER_START@
    5  * 
    6  * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
    7  * 
    8  * This file contains Original Code and/or Modifications of Original Code
    9  * as defined in and that are subject to the Apple Public Source License
   10  * Version 2.0 (the 'License'). You may not use this file except in
   11  * compliance with the License. Please obtain a copy of the License at
   12  * http://www.opensource.apple.com/apsl/ and read it before using this
   13  * file.
   14  * 
   15  * The Original Code and all software distributed under the License are
   16  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
   17  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
   18  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
   19  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
   20  * Please see the License for the specific language governing rights and
   21  * limitations under the License.
   22  * 
   23  * @APPLE_LICENSE_HEADER_END@
   24  */
   25 /* stdarg.h for GNU.
   26    Note that the type used in va_arg is supposed to match the
   27    actual type **after default promotions**.
   28    Thus, va_arg (..., short) is not valid.  */
   29 
   30 #ifndef _STDARG_H
   31 #ifndef _ANSI_STDARG_H_
   32 #ifndef __need___va_list
   33 #define _STDARG_H
   34 #define _ANSI_STDARG_H_
   35 #endif /* not __need___va_list */
   36 #undef __need___va_list
   37 
   38 #ifdef __clipper__
   39 #include <va-clipper.h>
   40 #else
   41 #ifdef __m88k__
   42 #include <va-m88k.h>
   43 #else
   44 #ifdef __i860__
   45 #include <va-i860.h>
   46 #else
   47 #ifdef __hppa__
   48 #include <va-pa.h>
   49 #else
   50 #ifdef __mips__
   51 #include <va-mips.h>
   52 #else
   53 #ifdef __sparc__
   54 #include <va-sparc.h>
   55 #else
   56 #ifdef __i960__
   57 #include <va-i960.h>
   58 #else
   59 #ifdef __alpha__
   60 #include <va-alpha.h>
   61 #else
   62 #if defined (__H8300__) || defined (__H8300H__)
   63 #include <va-h8300.h>
   64 #else
   65 #if defined (__PPC__) && defined (_CALL_SYSV)
   66 #include <va-ppc.h>
   67 #else
   68 
   69 /* Define __gnuc_va_list.  */
   70 
   71 #ifndef __GNUC_VA_LIST
   72 #define __GNUC_VA_LIST
   73 #if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__) || (defined(__APPLE__) && defined(__ppc__))
   74 typedef char *__gnuc_va_list;
   75 #else
   76 typedef void *__gnuc_va_list;
   77 #endif
   78 #endif
   79 
   80 /* Define the standard macros for the user,
   81    if this invocation was from the user program.  */
   82 #ifdef _STDARG_H
   83 
   84 /* Amount of space required in an argument list for an arg of type TYPE.
   85    TYPE may alternatively be an expression whose type is used.  */
   86 
   87 #if defined(sysV68)
   88 #define __va_rounded_size(TYPE)  \
   89   (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
   90 #else
   91 #define __va_rounded_size(TYPE)  \
   92   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
   93 #endif
   94 
   95 #define va_start(AP, LASTARG)                                           \
   96  (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
   97 
   98 #undef va_end
   99 void va_end (__gnuc_va_list);           /* Defined in libgcc.a */
  100 #define va_end(AP)      ((void)0)
  101 
  102 /* We cast to void * and then to TYPE * because this avoids
  103    a warning about increasing the alignment requirement.  */
  104 
  105 #if defined (__arm__) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
  106 /* This is for little-endian machines; small args are padded upward.  */
  107 #define va_arg(AP, TYPE)                                                \
  108  (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),     \
  109   *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
  110 #else /* big-endian */
  111 /* This is for big-endian machines; small args are padded downward.  */
  112 #define va_arg(AP, TYPE)                                                \
  113  (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),     \
  114   *((TYPE *) (void *) ((char *) (AP)                                    \
  115                        - ((sizeof (TYPE) < __va_rounded_size (char)     \
  116                            ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
  117 #endif /* big-endian */
  118 #endif /* _STDARG_H */
  119 
  120 #endif /* not powerpc with V.4 calling sequence */
  121 #endif /* not h8300 */
  122 #endif /* not alpha */
  123 #endif /* not i960 */
  124 #endif /* not sparc */
  125 #endif /* not mips */
  126 #endif /* not hppa */
  127 #endif /* not i860 */
  128 #endif /* not m88k */
  129 #endif /* not clipper */
  130 
  131 #ifdef _STDARG_H
  132 /* Define va_list, if desired, from __gnuc_va_list. */
  133 /* We deliberately do not define va_list when called from
  134    stdio.h, because ANSI C says that stdio.h is not supposed to define
  135    va_list.  stdio.h needs to have access to that data type, 
  136    but must not use that name.  It should use the name __gnuc_va_list,
  137    which is safe because it is reserved for the implementation.  */
  138 
  139 #ifdef _HIDDEN_VA_LIST  /* On OSF1, this means varargs.h is "half-loaded".  */
  140 #undef _VA_LIST
  141 #endif
  142 
  143 #ifdef _BSD_VA_LIST
  144 #undef _BSD_VA_LIST
  145 #endif
  146 
  147 #ifdef __svr4__
  148 /* SVR4.2 uses _VA_LIST for an internal alias for va_list,
  149    so we must avoid testing it and setting it here.
  150    SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
  151    have no conflict with that.  */
  152 #ifndef _VA_LIST_
  153 #define _VA_LIST_
  154 #ifdef __i860__
  155 #ifndef _VA_LIST
  156 #define _VA_LIST va_list
  157 #endif
  158 #endif /* __i860__ */
  159 typedef __gnuc_va_list va_list;
  160 #endif /* _VA_LIST_ */
  161 #else /* not __svr4__ */
  162 
  163 /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
  164    But on BSD NET2 we must not test or define or undef it.
  165    (Note that the comments in NET 2's ansi.h
  166    are incorrect for _VA_LIST_--see stdio.h!)  */
  167 #if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
  168 /* The macro _VA_LIST_DEFINED is used in Windows NT 3.5  */
  169 #ifndef _VA_LIST_DEFINED
  170 /* The macro _VA_LIST is used in SCO Unix 3.2.  */
  171 #ifndef _VA_LIST
  172 /* The macro _VA_LIST_T_H is used in the Bull dpx2  */
  173 #ifndef _VA_LIST_T_H
  174 typedef __gnuc_va_list va_list;
  175 #endif /* not _VA_LIST_T_H */
  176 #endif /* not _VA_LIST */
  177 #endif /* not _VA_LIST_DEFINED */
  178 #if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
  179 #define _VA_LIST_
  180 #endif
  181 #ifndef _VA_LIST
  182 #define _VA_LIST
  183 #endif
  184 #ifndef _VA_LIST_DEFINED
  185 #define _VA_LIST_DEFINED
  186 #endif
  187 #ifndef _VA_LIST_T_H
  188 #define _VA_LIST_T_H
  189 #endif
  190 
  191 #endif /* not _VA_LIST_, except on certain systems */
  192 
  193 #endif /* not __svr4__ */
  194 
  195 #endif /* _STDARG_H */
  196 
  197 #endif /* not _ANSI_STDARG_H_ */
  198 #endif /* not _STDARG_H */

Cache object: a4756f6a3e922a45caa3a9b6dca21c76


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.