Initial revision
[official-gcc.git] / gcc / ginclude / va-h8300.h
blob9565696e9ad66a40a409560d9b933d74d8f02a37
1 /* stdarg/vararg support for the Hitachi h8/300 and h8/300h */
3 /* Define __gnuc_va_list. */
5 #ifndef __GNUC_VA_LIST
6 #define __GNUC_VA_LIST
7 typedef void *__gnuc_va_list;
8 #endif
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)
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. */
17 #if __GNUC__ > 1
18 #define __va_ellipsis ...
19 #else
20 #define __va_ellipsis
21 #endif
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
31 #ifdef _STDARG_H
33 #define va_start(AP,LASTARG) \
34 (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
36 #else /* _VARARGS_H */
38 #define va_alist __builtin_va_alist
39 /* The ... causes current_function_varargs to be set in cc1. */
40 #define va_dcl int __builtin_va_alist; __va_ellipsis
41 #define va_start(AP) AP = (void *) &__builtin_va_alist
43 #endif /* _VARARGS_H */
45 #define va_arg(AP, TYPE) \
46 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
47 *((TYPE *) (void *) ((char *) (AP) \
48 - ((sizeof (TYPE) < __va_rounded_size (int) \
49 ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
51 #define va_end(AP) ((void) 0)
53 /* Copy __gnuc_va_list into another variable of this type. */
54 #define __va_copy(dest, src) (dest) = (src)
56 #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */