Source to include/stdarg.h
0001 /*
0002 Copyright (C) 1988 Free Software Foundation
0003
0004 This file is part of GNU CC.
0005
0006 GNU CC is distributed in the hope that it will be useful,
0007 but WITHOUT ANY WARRANTY. No author or distributor
0008 accepts responsibility to anyone for the consequences of using it
0009 or for whether it serves any particular purpose or works at all,
0010 unless he says so in writing. Refer to the GNU CC General Public
0011 License for full details.
0012
0013 Everyone is granted permission to copy, modify and redistribute
0014 GNU CC, but only under the conditions described in the
0015 GNU CC General Public License. A copy of this license is
0016 supposed to have been given to you along with GNU CC so you
0017 can know your rights and responsibilities. It should be in a
0018 file named COPYING. Among other things, the copyright notice
0019 and this notice must be preserved on all copies.
0020 */
0021
0022 #ifndef __stdarg_h
0023 #define __stdarg_h
0024
0025 typedef char *va_list;
0026
0027 /* Amount of space required in an argument list for an arg of type TYPE.
0028 TYPE may alternatively be an expression whose type is used. */
0029
0030 #define __va_rounded_size(TYPE) \
0031 (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
0032
0033 #define va_start(AP, LASTARG) \
0034 (AP = ((char *) &(LASTARG) + __va_rounded_size(LASTARG)))
0035
0036 extern void va_end (va_list);
0037 #define va_end(AP) /* Nothing */
0038
0039 #define va_arg(AP, TYPE) (AP += __va_rounded_size (TYPE), \
0040 *((TYPE *) (AP - __va_rounded_size (TYPE))))
0041
0042 #endif /* __stdarg_h */