|
|
1.1 ! root 1: /* ---------------------------------------- */ ! 2: /* VARARGS for MIPS/GNU CC */ ! 3: /* */ ! 4: /* */ ! 5: /* */ ! 6: /* */ ! 7: /* ---------------------------------------- */ ! 8: ! 9: ! 10: /* These macros implement varargs for GNU C--either traditional or ANSU. */ ! 11: ! 12: /* Define __gnuc_va_list. */ ! 13: ! 14: #ifndef __GNUC_VA_LIST ! 15: #define __GNUC_VA_LIST ! 16: typedef char * __gnuc_va_list; ! 17: #endif /* not __GNUC_VA_LIST */ ! 18: ! 19: /* If this is for internal libc use, don't define anything but ! 20: __gnuc_va_list. */ ! 21: #if defined (_STDARG_H) || defined (_VARARGS_H) ! 22: ! 23: /* In GCC version 2, we want an ellipsis at the end of the declaration ! 24: of the argument list. GCC version 1 can't parse it. */ ! 25: ! 26: #if __GNUC__ > 1 ! 27: #define __va_ellipsis ... ! 28: #else ! 29: #define __va_ellipsis ! 30: #endif ! 31: ! 32: #if __mips==3 ! 33: #define __va_rounded_size(__TYPE) \ ! 34: (((sizeof (__TYPE) + 8 - 1) / 8) * 8) ! 35: #else ! 36: #define __va_rounded_size(__TYPE) \ ! 37: (((sizeof (__TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) ! 38: #endif ! 39: ! 40: #ifdef _STDARG_H ! 41: #define va_start(__AP, __LASTARG) \ ! 42: (__AP = (__gnuc_va_list) __builtin_next_arg (__LASTARG)) ! 43: ! 44: #else ! 45: #define va_alist __builtin_va_alist ! 46: #if __mips==3 ! 47: /* This assumes that `long long int' is always a 64 bit type. */ ! 48: #define va_dcl long long int __builtin_va_alist; __va_ellipsis ! 49: #else ! 50: #define va_dcl int __builtin_va_alist; __va_ellipsis ! 51: #endif ! 52: #define va_start(__AP) __AP = (char *) &__builtin_va_alist ! 53: #endif ! 54: ! 55: #ifndef va_end ! 56: void va_end (__gnuc_va_list); /* Defined in libgcc.a */ ! 57: #endif ! 58: #define va_end(__AP) ! 59: ! 60: /* We cast to void * and then to TYPE * because this avoids ! 61: a warning about increasing the alignment requirement. */ ! 62: /* The __mips==3 cases are reversed from the 32 bit cases, because the standard ! 63: 32 bit calling convention left-aligns all parameters smaller than a word, ! 64: whereas the __mips==3 calling convention does not (and hence they are ! 65: right aligned). */ ! 66: #if __mips==3 ! 67: #ifdef __MIPSEB__ ! 68: #define va_arg(__AP, __type) \ ! 69: ((__type *) (void *) (__AP = (char *) ((((int)__AP + 8 - 1) & -8) \ ! 70: + __va_rounded_size (__type))))[-1] ! 71: #else ! 72: #define va_arg(__AP, __type) \ ! 73: ((__AP = (char *) ((((int)__AP + 8 - 1) & -8) \ ! 74: + __va_rounded_size (__type))), \ ! 75: *(__type *) (void *) (__AP - __va_rounded_size (__type))) ! 76: #endif ! 77: ! 78: #else /* not __mips==3 */ ! 79: ! 80: #ifdef __MIPSEB__ ! 81: /* For big-endian machines. */ ! 82: #define va_arg(__AP, __type) \ ! 83: ((__AP = (char *) ((__alignof__ (__type) > 4 \ ! 84: ? ((int)__AP + 8 - 1) & -8 \ ! 85: : ((int)__AP + 4 - 1) & -4) \ ! 86: + __va_rounded_size (__type))), \ ! 87: *(__type *) (void *) (__AP - __va_rounded_size (__type))) ! 88: #else ! 89: /* For little-endian machines. */ ! 90: #define va_arg(__AP, __type) \ ! 91: ((__type *) (void *) (__AP = (char *) ((__alignof__(__type) > 4 \ ! 92: ? ((int)__AP + 8 - 1) & -8 \ ! 93: : ((int)__AP + 4 - 1) & -4) \ ! 94: + __va_rounded_size(__type))))[-1] ! 95: #endif ! 96: #endif ! 97: ! 98: #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.