OSDN Git Service

Use <...> to include va-*.h.
[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 #ifndef __need___va_list
8 #define _STDARG_H
9 #endif
10 #undef __need___va_list
11
12 #ifndef __GNUC__
13 /* Use the system's macros with the system's compiler.
14    This is relevant only when building GCC with some other compiler.  */
15 #include <stdarg.h>
16 #else
17 #ifdef __m88k__
18 #include <va-m88k.h>
19 #else
20 #ifdef __i860__
21 #include <va-i860.h>
22 #else
23 #ifdef __hppa__
24 #include <va-pa.h>
25 #else
26 #ifdef __mips__
27 #include <va-mips.h>
28 #else
29 #ifdef __sparc__
30 #include <va-sparc.h>
31 #else
32 #ifdef __i960__
33 #include <va-i960.h>
34 #else
35 #ifdef __alpha__
36 #include <va-alpha.h>
37 #else
38
39 /* Define __gnuc_va_list.  */
40
41 #ifndef __GNUC_VA_LIST
42 #define __GNUC_VA_LIST
43 #ifdef __svr4__
44 typedef char *__gnuc_va_list;
45 #else
46 typedef void *__gnuc_va_list;
47 #endif
48 #endif
49
50 /* Define the standard macros for the user,
51    if this invocation was from the user program.  */
52 #ifdef _STDARG_H
53
54 /* Amount of space required in an argument list for an arg of type TYPE.
55    TYPE may alternatively be an expression whose type is used.  */
56
57 #define __va_rounded_size(TYPE)  \
58   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
59
60 #define va_start(AP, LASTARG)                                           \
61  (AP = ((__gnuc_va_list) __builtin_next_arg ()))
62
63 void va_end (__gnuc_va_list);           /* Defined in libgcc.a */
64 #define va_end(AP)
65
66 /* We cast to void * and then to TYPE * because this avoids
67    a warning about increasing the alignment requirement.  */
68 #define va_arg(AP, TYPE)                                                \
69  (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),     \
70   *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
71 #endif /* _STDARG_H */
72
73 #endif /* not alpha */
74 #endif /* not i960 */
75 #endif /* not sparc */
76 #endif /* not mips */
77 #endif /* not hppa */
78 #endif /* not i860 */
79 #endif /* not m88k */
80
81 #ifdef _STDARG_H
82 /* Define va_list, if desired, from __gnuc_va_list. */
83 /* We deliberately do not define va_list when called from
84    stdio.h, because ANSI C says that stdio.h is not supposed to define
85    va_list.  stdio.h needs to have access to that data type, 
86    but must not use that name.  It should use the name __gnuc_va_list,
87    which is safe because it is reserved for the implementation.  */
88
89 #ifdef _HIDDEN_VA_LIST  /* On OSF1, this means varargs.h is "half-loaded".  */
90 #undef _VA_LIST
91 #endif
92
93 #ifdef _BSD_VA_LIST
94 #undef _BSD_VA_LIST
95 #endif
96
97 /* The macro _VA_LIST_ is the same thing used by this file in Ultrix.  */
98 #ifndef _VA_LIST_
99 /* The macro _VA_LIST is used in SCO Unix 3.2.  */
100 #ifndef _VA_LIST
101 #define _VA_LIST_
102 #define _VA_LIST
103 typedef __gnuc_va_list va_list;
104 #endif /* _VA_LIST */
105 #endif /* _VA_LIST_ */
106 #endif /* _STDARG_H */
107
108 #endif /* __GNUC__ */
109 #endif /* not _STDARG_H */