xref: /haiku/headers/build/gcc-2.95.3/va-mn10300.h (revision 1e60bdeab63fa7a57bc9a55b032052e95a18bd2c)
1 /* Define __gnuc_va_list. */
2 
3 #ifndef __GNUC_VA_LIST
4 #define __GNUC_VA_LIST
5 typedef void *__gnuc_va_list;
6 #endif /* not __GNUC_VA_LIST */
7 
8 /* If this is for internal libc use, don't define anything but
9    __gnuc_va_list.  */
10 #if defined (_STDARG_H) || defined (_VARARGS_H)
11 #define __gnuc_va_start(AP) (AP = (__gnuc_va_list)__builtin_saveregs())
12 #define __va_ellipsis ...
13 
14 #ifdef _STDARG_H
15 #define va_start(AP, LASTARG) \
16   (__builtin_next_arg (LASTARG), __gnuc_va_start (AP))
17 #else
18 #define va_alist __builtin_va_alist
19 #define va_dcl int __builtin_va_alist; __va_ellipsis
20 #define va_start(AP)  AP=(char *) &__builtin_va_alist
21 #endif
22 
23 /* Now stuff common to both varargs & stdarg implementations.  */
24 #define __va_rounded_size(TYPE)						\
25   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
26 #undef va_end
27 void va_end (__gnuc_va_list);
28 #define va_end(AP) ((void)0)
29 #define va_arg(AP, TYPE)						\
30  (sizeof (TYPE) > 8							\
31   ? (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (char *)),\
32     **((TYPE **) (void *) ((char *) (AP) - __va_rounded_size (char *))))\
33   : (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),	\
34     *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE)))))
35 #endif
36