|
|
1.1 root 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
32: #define va_start(pvar) ((pvar) = * (__gnuc_va_list *) __builtin_saveregs ())
33:
34: #else /* STDARG.H */
35:
36: /* ANSI alternative. */
37:
38: #define va_start(pvar, firstarg) \
39: ((pvar) = *(__gnuc_va_list *) __builtin_saveregs ())
40:
41: #endif /* _STDARG_H */
42:
43: #ifndef va_end
44:
45: #define va_end(__va)
46:
47: /* Values returned by __builtin_classify_type. */
48:
49: enum {
50: __no_type_class = -1,
51: __void_type_class,
52: __integer_type_class,
53: __char_type_class,
54: __enumeral_type_class,
55: __boolean_type_class,
56: __pointer_type_class,
57: __reference_type_class,
58: __offset_type_class,
59: __real_type_class,
60: __complex_type_class,
61: __function_type_class,
62: __method_type_class,
63: __record_type_class,
64: __union_type_class,
65: __array_type_class,
66: __string_type_class,
67: __set_type_class,
68: __file_type_class,
69: __lang_type_class
70: };
71:
72: #endif
73:
74: /* Note that parameters are always aligned at least to a word boundary
75: (when passed) regardless of what GCC's __alignof__ operator says. */
76:
77: /* Avoid errors if compiling GCC v2 with GCC v1. */
78: #if __GNUC__ == 1
79: #define __extension__
80: #endif
81:
82: /* Get the size of a type in bytes, rounded up to an integral number
83: of words. */
84:
85: #define __va_tsize(__type) \
86: (((sizeof (__type) + sizeof (long) - 1) / sizeof (long)) * sizeof (long))
87:
88: #define va_arg(__va, __type) \
89: (*(((__va).__offset += __va_tsize (__type)), \
90: (__type *)((__va).__base + (__va).__offset \
91: - (((__builtin_classify_type (* (__type *) 0) \
92: == __real_type_class) && (__va).__offset <= (6 * 8)) \
93: ? (6 * 8) + 8 : __va_tsize (__type)))))
94:
95: #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
96:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.