[BACK]Return to va-m88k.h CVS log [TXT][DIR] Up to [local] / sys / arch / m88k / include

Annotation of sys/arch/m88k/include/va-m88k.h, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: va-m88k.h,v 1.9 2006/04/09 03:07:53 deraadt Exp $     */
                      2:
                      3: /* Define __gnuc_va_list.  */
                      4:
                      5: #ifndef __GNUC_VA_LIST
                      6: #define __GNUC_VA_LIST
                      7:
                      8: #include <sys/cdefs.h>
                      9:
                     10: typedef struct __va_list_tag {
                     11:        unsigned int  __va_arg;         /* argument number */
                     12:        unsigned int *__va_stk;         /* start of args passed on stack */
                     13:        unsigned int *__va_reg;         /* start of args passed in regs */
                     14: } __gnuc_va_list[1];
                     15:
                     16: #endif /* not __GNUC_VA_LIST */
                     17:
                     18: /* If this is for internal libc use, don't define anything but
                     19:    __gnuc_va_list.  */
                     20: #if defined (_STDARG_H) || defined (_VARARGS_H)
                     21:
                     22: #define __va_start_common(AP,FAKE) \
                     23: __extension__ ({                                                       \
                     24:    (AP) = (struct __va_list_tag *)__builtin_alloca(sizeof(__gnuc_va_list)); \
                     25:   __builtin_memcpy ((AP), __builtin_saveregs (), sizeof(__gnuc_va_list)); \
                     26:   })
                     27:
                     28: #ifdef _STDARG_H /* stdarg.h support */
                     29:
                     30: /* Calling __builtin_next_arg gives the proper error message if LASTARG is
                     31:    not indeed the last argument.  */
                     32: #ifdef lint
                     33: #define va_start(AP,LASGARG) ((AP) = (AP))
                     34: #else
                     35: #define va_start(AP,LASTARG) \
                     36:   (__builtin_next_arg (LASTARG), __va_start_common (AP, 0))
                     37: #endif /* lint */
                     38:
                     39: #else /* varargs.h support */
                     40:
                     41: #ifdef lint
                     42: #define va_start(AP) ((AP) = (AP))
                     43: #else
                     44: #define va_start(AP) __va_start_common (AP, 1)
                     45: #endif /* lint */
                     46:
                     47: #define va_alist __va_1st_arg
                     48: #define va_dcl register int va_alist; ...
                     49:
                     50: #endif /* _STDARG_H */
                     51:
                     52: #define __va_reg_p(TYPE)                                               \
                     53: __extension__({                                                                \
                     54:     __builtin_classify_type(*(TYPE *)0) < 12 ? /* record, union */     \
                     55:        sizeof(TYPE) <= 8 :                                             \
                     56:        sizeof(TYPE) == 4 && __alignof__(*(TYPE *)0) == 4;              \
                     57: })
                     58:
                     59: #define        __va_size(TYPE) ((sizeof(TYPE) + 3) >> 2)
                     60:
                     61: /* We cast to void * and then to TYPE * because this avoids
                     62:    a warning about increasing the alignment requirement.  */
                     63: #define va_arg(AP,TYPE)                                                        \
                     64: __extension__(*({                                                      \
                     65:     register TYPE *__ptr;                                              \
                     66:                                                                        \
                     67:     if ((AP)->__va_arg <= 8 && __va_reg_p(TYPE)) {                     \
                     68:        /* might be in registers */                                     \
                     69:        if (((AP)->__va_arg & 1) != 0 && __alignof__(*(TYPE *)0) > 4)   \
                     70:            (AP)->__va_arg++;                                           \
                     71:        (AP)->__va_arg += __va_size(TYPE);                              \
                     72:     }                                                                  \
                     73:                                                                        \
                     74:     if ((AP)->__va_arg <= 8 && __va_reg_p(TYPE)) {                     \
                     75:        __ptr = (TYPE *) (void *) ((AP)->__va_reg +                     \
                     76:            (AP)->__va_arg - __va_size(TYPE));                          \
                     77:     } else {                                                           \
                     78:        if (((unsigned int)((AP)->__va_stk) & 4) != 0 &&                \
                     79:            __alignof__(*(TYPE *)0) > 4) {                              \
                     80:            (AP)->__va_stk++;                                           \
                     81:        } \
                     82:        __ptr = (TYPE *) (AP)->__va_stk;                                \
                     83:        (AP)->__va_stk += __va_size(TYPE);                              \
                     84:     }                                                                  \
                     85:     __ptr;                                                             \
                     86: }))
                     87:
                     88: #define va_end(AP)     ((void)0)
                     89:
                     90: /* Copy __gnuc_va_list into another variable of this type.  */
                     91: #define __va_copy(dest, src) \
                     92: __extension__ ({ \
                     93:        (dest) =  \
                     94:           (struct __va_list_tag *)__builtin_alloca(sizeof(__gnuc_va_list)); \
                     95:        *(dest) = *(src);\
                     96:   })
                     97:
                     98: #if __ISO_C_VISIBLE >= 1999
                     99: #define va_copy(dest, src) __va_copy(dest, src)
                    100: #endif
                    101:
                    102: #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */

CVSweb