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