OSDN Git Service

*** empty log message ***
[pf3gnuchains/gcc-fork.git] / gcc / ginclude / stdarg.h
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 #ifndef _STDARG_H
7 #define _STDARG_H
8
9 #ifdef __m88k__
10 #include "va-m88k.h"
11 #else
12 #ifdef __i860__
13 #include "va-i860.h"
14 #else
15
16 /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.  */
17 #ifndef _VA_LIST_
18 /* The macro _VA_LIST is used in SCO Unix 3.2.  */
19 #ifndef _VA_LIST
20 #define _VA_LIST_
21 #define _VA_LIST
22 typedef char *va_list;
23 #endif /* _VA_LIST */
24 #endif /* _VA_LIST_ */
25
26 /* Amount of space required in an argument list for an arg of type TYPE.
27    TYPE may alternatively be an expression whose type is used.  */
28
29 #define __va_rounded_size(TYPE)  \
30   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
31
32 #ifndef __sparc__
33 #define va_start(AP, LASTARG)                                           \
34  (AP = ((char *) __builtin_next_arg ()))
35 #else
36 #define va_start(AP, LASTARG)                                           \
37  (__builtin_saveregs (),                                                \
38   AP = ((char *) __builtin_next_arg ()))
39 #endif
40
41 void va_end (va_list);          /* Defined in libgcc.a */
42 #define va_end(AP)
43
44 #define va_arg(AP, TYPE)                                                \
45  (AP += __va_rounded_size (TYPE),                                       \
46   *((TYPE *) (AP - __va_rounded_size (TYPE))))
47
48 #endif /* not i860 */
49 #endif /* not m88k */
50 #endif /* _STDARG_H */