|
|
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
1.1.1.2 ! root 39: /* Call __builtin_next_arg even though we aren't using its value, so that
! 40: we can verify that firstarg is correct. */
1.1 root 41: #define va_start(AP, LASTARG) \
42: __extension__ \
1.1.1.2 ! root 43: ({ __builtin_next_arg (LASTARG); \
! 44: __asm__ ("st g14,%0" : "=m" (*(AP))); \
1.1 root 45: (AP)[1] = (__builtin_args_info (0) + __builtin_args_info (1)) * 4; })
46:
47: #else
48:
49: #define va_alist __builtin_va_alist
50: #define va_dcl char *__builtin_va_alist; __va_ellipsis
1.1.1.2 ! root 51: #define va_start(AP) \
! 52: __extension__ \
! 53: ({ __asm__ ("st g14,%0" : "=m" (*(AP))); \
! 54: (AP)[1] = (__builtin_args_info (0) + __builtin_args_info (1)) * 4; })
1.1 root 55: #endif
56:
57: /* We cast to void * and then to TYPE * because this avoids
58: a warning about increasing the alignment requirement. */
59: #define va_arg(AP, T) \
60: ( \
61: ( \
62: ((AP)[1] <= 48 && (__vpad ((AP)[1], T) > 48 || __vsiz (T) > 16)) \
63: ? ((AP)[1] = 48 + __vsiz (T)) \
64: : ((AP)[1] = __vpad ((AP)[1], T)) \
65: ), \
66: \
67: *((T *) (void *) ((char *) *(AP) + (AP)[1] - __vsiz (T))) \
68: )
69:
70: #ifndef va_end
71: void va_end (__gnuc_va_list); /* Defined in libgcc.a */
72: #endif
1.1.1.2 ! root 73: #define va_end(AP) ((void *)0)
1.1 root 74:
75: #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
76:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.