|
|
1.1 root 1: /* stdarg/vararg support for the Hitachi h8/300 and h8/300h */
2:
3: /* Define __gnuc_va_list. */
4:
5: #ifndef __GNUC_VA_LIST
6: #define __GNUC_VA_LIST
7: typedef void *__gnuc_va_list;
8: #endif
9:
10: /* If this is for internal libc use, don't define anything but
11: __gnuc_va_list. */
12: #if defined (_STDARG_H) || defined (_VARARGS_H)
13:
14: /* In GCC version 2, we want an ellipsis at the end of the declaration
15: of the argument list. GCC version 1 can't parse it. */
16:
17: #if __GNUC__ > 1
18: #define __va_ellipsis ...
19: #else
20: #define __va_ellipsis
21: #endif
22:
23: #ifdef __H8300__
24: #define __va_rounded_size(TYPE) \
25: (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
26: #else
27: #define __va_rounded_size(TYPE) \
28: (((sizeof (TYPE) + sizeof (long) - 1) / sizeof (long)) * sizeof (long))
29: #endif
30:
31: #ifdef _STDARG_H
32:
33: #define va_start(AP,LASTARG) (AP = ((__gnuc_va_list) __builtin_next_arg ()))
34:
35: #else /* _VARARGS_H */
36:
37: #define va_alist __builtin_va_alist
38: /* The ... causes current_function_varargs to be set in cc1. */
39: #define va_dcl int __builtin_va_alist; __va_ellipsis
40: #define va_start(AP) AP = (void *) &__builtin_va_alist
41:
42: #endif /* _VARARGS_H */
43:
44: #define va_arg(AP, TYPE) \
45: (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
46: *((TYPE *) (void *) ((char *) (AP) - ((sizeof (TYPE) < 4 \
47: ? sizeof (TYPE) \
48: : __va_rounded_size (TYPE))))))
49:
50: #define va_end(AP)
51:
52: #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.