|
|
1.1 root 1: /* GNU C varargs support for the Intel 80960. */
2:
3: /* Define __gnuc_va_list. */
4:
5: #ifndef __GNUC_VA_LIST
6: #define __GNUC_VA_LIST
7: /* The first element is the address of the first argument.
8: The second element is the number of bytes skipped past so far. */
9: typedef unsigned __gnuc_va_list[2];
10: #endif /* not __GNUC_VA_LIST */
11:
12: /* If this is for internal libc use, don't define anything but
13: __gnuc_va_list. */
14: #if defined (_STDARG_H) || defined (_VARARGS_H)
15:
16: /* In GCC version 2, we want an ellipsis at the end of the declaration
17: of the argument list. GCC version 1 can't parse it. */
18:
19: #if __GNUC__ > 1
20: #define __va_ellipsis ...
21: #else
22: #define __va_ellipsis
23: #endif
24:
25: /* The stack size of the type t. */
26: #define __vsiz(T) (((sizeof (T) + 3) / 4) * 4)
27: /* The stack alignment of the type t. */
28: #define __vali(T) (__alignof__ (T) >= 4 ? __alignof__ (T) : 4)
29: /* The offset of the next stack argument after one of type t at offset i. */
30: #define __vpad(I, T) ((((I) + __vali (T) - 1) / __vali (T)) \
31: * __vali (T) + __vsiz (T))
32:
33: /* Avoid errors if compiling GCC v2 with GCC v1. */
34: #if __GNUC__ == 1
35: #define __extension__
36: #endif
37:
38: #ifdef _STDARG_H
39: #define va_start(AP, LASTARG) \
40: __extension__ \
41: ({ __asm__ ("st g14,%0" : "=m" (*(AP))); \
42: (AP)[1] = (unsigned) __builtin_next_arg () - *AP; })
43: #else
44:
45: #define va_alist __builtin_va_alist
46: #define va_dcl char *__builtin_va_alist; __va_ellipsis
47: #define va_start(AP) ((AP)[1] = 0, *(AP) = (unsigned) &va_alist)
48: #endif
49:
50: /* We cast to void * and then to TYPE * because this avoids
51: a warning about increasing the alignment requirement. */
52: #define va_arg(AP, T) \
53: ( \
54: ( \
55: ((AP)[1] <= 48 && (__vpad ((AP)[1], T) > 48 || __vsiz (T) > 16)) \
56: ? ((AP)[1] = 48 + __vsiz (T)) \
57: : ((AP)[1] = __vpad ((AP)[1], T)) \
58: ), \
59: \
60: *((T *) (void *) ((char *) *(AP) + (AP)[1] - __vsiz (T))) \
61: )
62:
63: #ifndef va_end
64: void va_end (__gnuc_va_list); /* Defined in libgcc.a */
65: #endif
66: #define va_end(AP)
67:
68: #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
69:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.