|
|
1.1 root 1: /* GNU C varargs and stdargs support for Clipper. */
2:
3: /* Define __gnuc_va_list. */
4:
5: #ifndef __GNUC_VA_LIST
6: #define __GNUC_VA_LIST
7:
8: typedef struct
9: {
10: int __va_ap; /* pointer to stack args */
11: void *__va_reg[4]; /* pointer to r0,f0,r1,f1 */
12: int __va_num; /* number of args processed */
13: } __gnuc_va_list;
14: #endif /* not __GNUC_VA_LIST */
15:
16:
17: #if defined (_STDARG_H) || defined (_VARARGS_H)
18: #define va_list __gnuc_va_list
19: #define __va_list __gnuc_va_list /* acc compatibility */
20:
21: #define _VA_LIST
22: #define _VA_LIST_
23: #define _SYS_INT_STDARG_H /* acc compatibility */
24:
25: /* Call __builtin_next_arg even though we aren't using its value, so that
26: we can verify that LASTARG is correct. */
27: #ifdef _STDARG_H
28: #define va_start(AP,LASTARG) \
29: (__builtin_next_arg (LASTARG), \
30: (AP) = *(va_list *)__builtin_saveregs(), \
31: (AP).__va_num = __builtin_args_info (0), \
32: (AP).__va_ap += __builtin_args_info (1))
33: #else
34: #define va_alist __builtin_va_alist
35: /* The ... causes current_function_varargs to be set in cc1. */
36: #define va_dcl va_list __builtin_va_alist; ...
37: #define va_start(AP) \
38: ((AP) = *(va_list *)__builtin_saveregs(), \
39: (AP).__va_num = __builtin_args_info (0))
40: #endif /* _STDARG_H */
41:
1.1.1.2 ! root 42: /* round to alignment of `type' but keep a least integer alignment */
1.1 root 43: #define __va_round(AP,TYPE) \
44: ((AP).__va_ap = ((AP).__va_ap + __alignof__ (TYPE) - 1 ) & \
1.1.1.2 ! root 45: ~(__alignof__ (TYPE) - 1), \
! 46: ((AP).__va_ap = ((AP).__va_ap + sizeof (int) - 1) & ~(sizeof (int) - 1)))
1.1 root 47:
48: #define va_arg(AP, TYPE) \
1.1.1.2 ! root 49: (*((AP).__va_num < 2 && __builtin_classify_type (* (TYPE *)0) < 12 \
1.1 root 50: ? (__builtin_classify_type (* (TYPE *)0) == 8 \
1.1.1.2 ! root 51: ? ((TYPE *)(AP).__va_reg[2 * (AP).__va_num++ + 1]) \
! 52: : ((TYPE *)(AP).__va_reg[2 * (AP).__va_num++ ])) \
! 53: : ((AP).__va_num++, __va_round (AP,TYPE), ((TYPE *)((AP).__va_ap))++)))
1.1 root 54:
1.1.1.2 ! root 55: #define va_end(AP) ((void) 0)
1.1 root 56:
57: #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.