OSDN Git Service

(__va_tsize): Use __extension__ to avoid warning on use of `long
[pf3gnuchains/gcc-fork.git] / gcc / ginclude / va-alpha.h
1 /* GNU C varargs and stdargs support for the DEC Alpha.  */
2
3 /* Note:  We must use the name __builtin_savregs.  GCC attaches special
4    significance to that name.  In particular, regardless of where in a
5    function __builtin_saveregs is called, GCC moves the call up to the
6    very start of the function.  */
7
8 /* Define __gnuc_va_list.  */
9
10 #ifndef __GNUC_VA_LIST
11 #define __GNUC_VA_LIST
12
13 typedef struct {
14   char *__base;                 /* Pointer to first integer register. */
15   long __offset;                /* Byte offset of args so far. */
16 } __gnuc_va_list;
17 #endif /* not __GNUC_VA_LIST */
18
19 /* If this is for internal libc use, don't define anything but
20    __gnuc_va_list.  */
21 #if defined (_STDARG_H) || defined (_VARARGS_H)
22
23 #define va_list __gnuc_va_list
24 #define _VA_LIST
25 #define _VA_LIST_
26
27 #if !defined(_STDARG_H)
28
29 /* varargs support */
30 #define va_alist __builtin_va_alist
31 #define va_dcl   int __builtin_va_alist;...
32 #define va_start(pvar) ((pvar) = * (__gnuc_va_list *) __builtin_saveregs ())
33
34 #else /* STDARG.H */
35
36 /* ANSI alternative.  */
37
38 /* Call __builtin_next_arg even though we aren't using its value, so that
39    we can verify that firstarg is correct.  */
40 #define va_start(pvar, firstarg)                                \
41   (__builtin_next_arg (firstarg),                               \
42    (pvar) = *(__gnuc_va_list *) __builtin_saveregs ())
43
44 #endif /* _STDARG_H */
45
46 #ifndef va_end
47
48 #define va_end(__va)    ((void) 0)
49
50 /* Values returned by __builtin_classify_type.  */
51
52 enum {
53   __no_type_class = -1,
54   __void_type_class,
55   __integer_type_class,
56   __char_type_class,
57   __enumeral_type_class,
58   __boolean_type_class,
59   __pointer_type_class,
60   __reference_type_class,
61   __offset_type_class,
62   __real_type_class,
63   __complex_type_class,
64   __function_type_class,
65   __method_type_class,
66   __record_type_class,
67   __union_type_class,
68   __array_type_class,
69   __string_type_class,
70   __set_type_class,
71   __file_type_class,
72   __lang_type_class
73 };
74
75 #endif
76
77 /* Note that parameters are always aligned at least to a word boundary
78    (when passed) regardless of what GCC's __alignof__ operator says.  */
79
80 /* Avoid errors if compiling GCC v2 with GCC v1.  */
81 #if __GNUC__ == 1
82 #define __extension__
83 #endif
84
85 /* Get the size of a type in bytes, rounded up to an integral number
86    of words.  */
87
88 #define __va_tsize(__type)  \
89   (((sizeof (__type) + __extension__ sizeof (long long) - 1)   \
90     / __extension__ sizeof (long long)) * __extension__ sizeof (long long))
91
92 #define va_arg(__va, __type)                                            \
93 (*(((__va).__offset += __va_tsize (__type)),                            \
94    (__type *)(void *)((__va).__base + (__va).__offset                   \
95               - (((__builtin_classify_type (* (__type *) 0)             \
96                    == __real_type_class) && (__va).__offset <= (6 * 8)) \
97                  ? (6 * 8) + 8 : __va_tsize (__type)))))
98
99 #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
100