source: trunk/third/gcc/ginclude/va-m88k.h @ 8834

Revision 8834, 2.7 KB checked in by ghudson, 28 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r8833, which included commits to RCS files with non-trunk default branches.
Line 
1/* GNU C varargs support for the Motorola 88100  */
2
3/* Define __gnuc_va_list.  */
4
5#ifndef __GNUC_VA_LIST
6#define __GNUC_VA_LIST
7
8typedef struct
9{
10  int  __va_arg;                /* argument number */
11  int *__va_stk;                /* start of args passed on stack */
12  int *__va_reg;                /* start of args passed in regs */
13} __gnuc_va_list;
14#endif /* not __GNUC_VA_LIST */
15
16/* If this is for internal libc use, don't define anything but
17   __gnuc_va_list.  */
18#if defined (_STDARG_H) || defined (_VARARGS_H)
19
20#ifdef _STDARG_H /* stdarg.h support */
21
22/* Call __builtin_next_arg even though we aren't using its value, so that
23   we can verify that LASTARG is correct.  */
24#if __GNUC__ > 1 /* GCC 2.0 and beyond */
25#define va_start(AP,LASTARG)                            \
26 (__builtin_next_arg (LASTARG),                         \
27  (AP) = *(__gnuc_va_list *)__builtin_saveregs())
28#else
29#define va_start(AP,LASTARG) \
30  ( (AP).__va_reg = (int *) __builtin_saveregs2(0), \
31    (AP).__va_stk = (int *) __builtin_argptr(), \
32    (AP).__va_arg = (int) (__builtin_argsize() + 3) / 4 )
33#endif
34
35#else /* varargs.h support */
36
37#if __GNUC__ > 1 /* GCC 2.0 and beyond */
38#define va_start(AP) ((AP) = *(__gnuc_va_list *)__builtin_saveregs())
39#else
40#define va_start(AP) \
41  ( (AP).__va_reg = (int *) __builtin_saveregs2(1), \
42    (AP).__va_stk = (int *) __builtin_argptr(), \
43    (AP).__va_arg = (int) (__builtin_argsize() - 4 + 3) / 4 )
44#endif
45#define va_alist __va_1st_arg
46#define va_dcl register int va_alist;...
47
48#endif /* _STDARG_H */
49
50/* Avoid trouble between this file and _int_varargs.h under DG/UX.  This file
51   can be included by <stdio.h> and others and provides definitions of
52   __va_size and __va_reg_p and  a va_list typedef.  Avoid defining va_list
53   again with _VA_LIST.  */
54#ifdef __INT_VARARGS_H
55#undef __va_size
56#undef __va_reg_p
57#define __gnuc_va_list va_list
58#define _VA_LIST
59#define _VA_LIST_
60#else
61/* Similarly, if this gets included first, do nothing in _int_varargs.h.  */
62#define __INT_VARARGS_H
63#endif
64
65#define __va_reg_p(TYPE) \
66  (__builtin_classify_type(*(TYPE *)0) < 12 \
67   ? sizeof(TYPE) <= 8 : sizeof(TYPE) == 4 && __alignof__(TYPE) == 4)
68
69#define __va_size(TYPE) ((sizeof(TYPE) + 3) >> 2)
70
71/* We cast to void * and then to TYPE * because this avoids
72   a warning about increasing the alignment requirement.  */
73#define va_arg(AP,TYPE)                                                    \
74  ( (AP).__va_arg = (((AP).__va_arg + (1 << (__alignof__(TYPE) >> 3)) - 1) \
75                     & ~((1 << (__alignof__(TYPE) >> 3)) - 1))             \
76    + __va_size(TYPE),                                                     \
77    *((TYPE *) (void *) ((__va_reg_p(TYPE)                                 \
78                          && (AP).__va_arg < 8 + __va_size(TYPE)           \
79                          ? (AP).__va_reg : (AP).__va_stk)                 \
80                         + ((AP).__va_arg - __va_size(TYPE)))))
81
82#define va_end(AP)      ((void)0)
83
84#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
Note: See TracBrowser for help on using the repository browser.