404a0fea46
builds on Linux with gcc 2 and 4, but the images do even run. :-) Not tested on BeOS. * Removed stddef.h and stdarg.h. They are provided by the compiler. * Adjusted size_t.h, wchar_t.h, and wchar.h accordingly. * Made stdio.h avoid gcc 2.95.3's fixincludes hack stdio_va_list * Added gcc 2.95.3 headers to the repository. They are used instead of the headers of the gcc 2.95.3's we use to compile Haiku with. Should avoid build problems with the BeOS native compiler. For sake of personal recreation you can rebuild the cross gcc 2.95.3, but the only thing that changed is its header directory (lib/gcc-lib/.../include), which isn't used anymore. Replacing it with headers/build/gcc-2.95.3 should have the same effect as rebuilding, BTW. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24413 a95241bf-73f2-0310-859d-f6bbb57e9c96
87 lines
2.4 KiB
C
87 lines
2.4 KiB
C
/* GNU C stdarg/varargs support for the M32R */
|
|
|
|
/* Define __gnuc_va_list. */
|
|
#ifndef __GNUC_VA_LIST
|
|
#define __GNUC_VA_LIST
|
|
typedef void *__gnuc_va_list;
|
|
#endif /* not __GNUC_VA_LIST */
|
|
|
|
/* If this is for internal libc use, don't define anything but
|
|
__gnuc_va_list. */
|
|
#if defined (_STDARG_H) || defined (_VARARGS_H)
|
|
|
|
/* Common code for va_start for both varargs and stdarg. */
|
|
|
|
#define __va_rounded_size(TYPE) \
|
|
(((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
|
|
|
|
#ifdef _STDARG_H /* stdarg.h support */
|
|
|
|
/* Calling __builtin_next_arg gives the proper error message if LASTARG is
|
|
not indeed the last argument. */
|
|
#define va_start(AP, LASTARG) \
|
|
(AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
|
|
|
|
#else /* varargs.h support */
|
|
|
|
#define va_alist __builtin_va_alist
|
|
/* The ... causes current_function_varargs to be set in cc1. */
|
|
#define va_dcl int __builtin_va_alist; ...
|
|
#define va_start(AP) AP=(char *) &__builtin_va_alist
|
|
|
|
#endif /* _STDARG_H */
|
|
|
|
/* Nothing needs to be done to end varargs/stdarg processing */
|
|
#define va_end(AP) ((void) 0)
|
|
|
|
/* Values returned by __builtin_classify_type. */
|
|
enum __type_class
|
|
{
|
|
__no_type_class = -1,
|
|
__void_type_class,
|
|
__integer_type_class,
|
|
__char_type_class,
|
|
__enumeral_type_class,
|
|
__boolean_type_class,
|
|
__pointer_type_class,
|
|
__reference_type_class,
|
|
__offset_type_class,
|
|
__real_type_class,
|
|
__complex_type_class,
|
|
__function_type_class,
|
|
__method_type_class,
|
|
__record_type_class,
|
|
__union_type_class,
|
|
__array_type_class,
|
|
__string_type_class,
|
|
__set_type_class,
|
|
__file_type_class,
|
|
__lang_type_class
|
|
};
|
|
|
|
/* Return whether a type is passed by reference. */
|
|
#define __va_by_reference_p(TYPE) (sizeof (TYPE) > 8)
|
|
|
|
#define va_arg(AP,TYPE) \
|
|
__extension__ (*({ \
|
|
register TYPE *__ptr; \
|
|
\
|
|
if (__va_by_reference_p (TYPE)) \
|
|
{ \
|
|
__ptr = *(TYPE **)(void *) (AP); \
|
|
(AP) = (__gnuc_va_list) ((char *) (AP) + sizeof (void *)); \
|
|
} \
|
|
else \
|
|
{ \
|
|
__ptr = (TYPE *)(void *) \
|
|
((char *) (AP) + (sizeof (TYPE) < __va_rounded_size (char) \
|
|
? __va_rounded_size (TYPE) - sizeof (TYPE) \
|
|
: 0)); \
|
|
(AP) = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)); \
|
|
} \
|
|
\
|
|
__ptr; \
|
|
}))
|
|
|
|
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
|