]>
git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/ginclude/va-arc.h
1 /* stdarg/varargs support for the ARC */
3 /* Define __gnuc_va_list. */
7 typedef void * __gnuc_va_list
;
8 #endif /* not __GNUC_VA_LIST */
10 /* If this is for internal libc use, don't define anything but
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. */
18 #define __va_ellipsis ...
23 /* See arc_setup_incoming_varargs for reasons for the oddity in va_start. */
25 #define va_start(AP, LASTARG) \
26 (AP = (__gnuc_va_list) ((int *) __builtin_next_arg (LASTARG) \
27 + (__builtin_args_info (0) < 8 \
28 ? (__builtin_args_info (0) & 1) \
31 #define va_alist __builtin_va_alist
32 #define va_dcl int __builtin_va_alist; __va_ellipsis
33 #define va_start(AP) \
34 (AP = (__gnuc_va_list) ((int *) &__builtin_va_alist \
35 + (__builtin_args_info (0) < 8 \
36 ? (__builtin_args_info (0) & 1) \
41 void va_end (__gnuc_va_list
); /* Defined in libgcc.a */
43 /* Values returned by __builtin_classify_type. */
45 enum __va_type_classes
{
50 __enumeral_type_class
,
53 __reference_type_class
,
57 __function_type_class
,
69 #define va_end(AP) ((void)0)
71 /* Avoid errors if compiling GCC v2 with GCC v1. */
76 /* All aggregates are passed by reference. All scalar types larger than 8
77 bytes are passed by reference. */
78 /* We cast to void * and then to TYPE * because this avoids
79 a warning about increasing the alignment requirement.
80 The casts to char * avoid warnings about invalid pointer arithmetic. */
82 #define __va_rounded_size(TYPE) \
83 (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
86 #define va_arg(AP,TYPE) \
88 (*({((__builtin_classify_type (*(TYPE*) 0) >= __record_type_class \
89 || __va_rounded_size (TYPE) > 8) \
90 ? ((AP) = (char *)(AP) + __va_rounded_size (TYPE *), \
91 *(TYPE **) (void *) ((char *)(AP) - __va_rounded_size (TYPE *))) \
92 : ((TYPE *) (void *) \
93 (AP = (void *) ((__alignof__ (TYPE) > 4 \
94 ? ((int) AP + 8 - 1) & -8 \
96 + __va_rounded_size (TYPE))) - 1));}))
98 #define va_arg(AP,TYPE) \
100 (*({((__builtin_classify_type (*(TYPE*) 0) >= __record_type_class \
101 || __va_rounded_size (TYPE) > 8) \
102 ? ((AP) = (char *)(AP) + __va_rounded_size (TYPE *), \
103 *(TYPE **) (void *) ((char *)(AP) - __va_rounded_size (TYPE *))) \
104 : ((AP = (void *) ((__alignof__ (TYPE) > 4 \
105 ? ((int) AP + 8 - 1) & -8 \
107 + __va_rounded_size (TYPE))), \
108 (TYPE *) (void *) (AP - __va_rounded_size (TYPE))));}))
111 #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */