Commit 536bb15b by Charles Hannum

entered into RCS

From-SVN: r1299
parent f32fd778
/* This file contains changes made by Data General, December 1989. */
/* GNU C varargs support for the Motorola 88100 */ /* GNU C varargs support for the Motorola 88100 */
#ifndef __INT_VARARGS_H /* Prevent multiple inclusions of this file */ /* Define __gnuc_va_list. */
#define __INT_VARARGS_H /* and _int_varargs.h under DG/UX */
#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
typedef struct typedef struct
{ {
int __va_arg; /* argument number */ int __va_arg; /* argument number */
int *__va_stk; /* start of args passed on stack */ int *__va_stk; /* start of args passed on stack */
int *__va_reg; /* start of args passed in regs */ int *__va_reg; /* start of args passed in regs */
} va_list; } __gnuc_va_list;
#endif /* not __GNUC_VA_LIST */
#else /* If this is for internal libc use, don't define anything but
#undef __va_size __gnuc_va_list. */
#undef __va_reg_p #if defined (_STDARG_H) || defined (_VARARGS_H)
#endif /* __INT_VARARGS_H */
#ifdef _STDARG_H /* stdarg.h support */ #ifdef _STDARG_H /* stdarg.h support */
#if __GNUC__ > 1 /* GCC 2.0 and beyond */ #if __GNUC__ > 1 /* GCC 2.0 and beyond */
#define va_start(AP,LASTARG) ((AP) = *(va_list *)__builtin_saveregs()) #define va_start(AP,LASTARG) ((AP) = *(__gnuc_va_list *)__builtin_saveregs())
#else #else
#define va_start(AP,LASTARG) \ #define va_start(AP,LASTARG) \
( (AP).__va_reg = (int *) __builtin_saveregs2(0), \ ( (AP).__va_reg = (int *) __builtin_saveregs2(0), \
...@@ -30,7 +31,7 @@ typedef struct ...@@ -30,7 +31,7 @@ typedef struct
#else /* varargs.h support */ #else /* varargs.h support */
#if __GNUC__ > 1 /* GCC 2.0 and beyond */ #if __GNUC__ > 1 /* GCC 2.0 and beyond */
#define va_start(AP) ((AP) = *(va_list *)__builtin_saveregs()) #define va_start(AP) ((AP) = *(__gnuc_va_list *)__builtin_saveregs())
#else #else
#define va_start(AP) \ #define va_start(AP) \
( (AP).__va_reg = (int *) __builtin_saveregs2(1), \ ( (AP).__va_reg = (int *) __builtin_saveregs2(1), \
...@@ -42,6 +43,17 @@ typedef struct ...@@ -42,6 +43,17 @@ typedef struct
#endif /* _STDARG_H */ #endif /* _STDARG_H */
/* Avoid trouble between this file and _int_varargs.h under DG/UX. This file
can be included by <stdio.h> and others and provides definitions of
__va_size and __va_reg_p and a va_list typedef. Avoid defining va_list
again with _VA_LIST. */
#ifdef __INT_VARARGS_H
#undef __va_size
#undef __va_reg_p
#define __gnuc_va_list va_list
#define _VA_LIST
#endif
#define __va_reg_p(TYPE) \ #define __va_reg_p(TYPE) \
(__builtin_classify_type(*(TYPE *)0) < 12 \ (__builtin_classify_type(*(TYPE *)0) < 12 \
? sizeof(TYPE) <= 8 : sizeof(TYPE) == 4 && __alignof__(TYPE) == 4) ? sizeof(TYPE) <= 8 : sizeof(TYPE) == 4 && __alignof__(TYPE) == 4)
...@@ -57,3 +69,5 @@ typedef struct ...@@ -57,3 +69,5 @@ typedef struct
+ ((AP).__va_arg - __va_size(TYPE))))) + ((AP).__va_arg - __va_size(TYPE)))))
#define va_end(AP) #define va_end(AP)
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment