diff options
author | David E. O'Brien <obrien@FreeBSD.org> | 1999-10-12 00:47:56 +0000 |
---|---|---|
committer | David E. O'Brien <obrien@FreeBSD.org> | 1999-10-12 00:47:56 +0000 |
commit | b50366c3839724717e906b96332d2bbb1c9906de (patch) | |
tree | 32f85c75698dfaea26b19c88d15c94b6c650192e | |
parent | 04626017cb749d6f136095d08849d1d014b5fb40 (diff) | |
download | src-test2-b50366c3839724717e906b96332d2bbb1c9906de.tar.gz src-test2-b50366c3839724717e906b96332d2bbb1c9906de.zip |
Notes
-rw-r--r-- | contrib/gcc/ginclude/ppc-asm.h | 170 | ||||
-rw-r--r-- | contrib/gcc/ginclude/stdarg.h | 61 | ||||
-rw-r--r-- | contrib/gcc/ginclude/stdbool.h | 20 | ||||
-rw-r--r-- | contrib/gcc/ginclude/stddef.h | 55 | ||||
-rw-r--r-- | contrib/gcc/ginclude/va-alpha.h | 44 | ||||
-rw-r--r-- | contrib/gcc/ginclude/va-arc.h | 111 | ||||
-rw-r--r-- | contrib/gcc/ginclude/va-clipper.h | 3 | ||||
-rw-r--r-- | contrib/gcc/ginclude/va-h8300.h | 9 | ||||
-rw-r--r-- | contrib/gcc/ginclude/va-i860.h | 3 | ||||
-rw-r--r-- | contrib/gcc/ginclude/va-i960.h | 5 | ||||
-rw-r--r-- | contrib/gcc/ginclude/va-m32r.h | 86 | ||||
-rw-r--r-- | contrib/gcc/ginclude/va-m88k.h | 3 | ||||
-rw-r--r-- | contrib/gcc/ginclude/va-mips.h | 187 | ||||
-rw-r--r-- | contrib/gcc/ginclude/va-mn10200.h | 37 | ||||
-rw-r--r-- | contrib/gcc/ginclude/va-mn10300.h | 35 | ||||
-rw-r--r-- | contrib/gcc/ginclude/va-pa.h | 5 | ||||
-rw-r--r-- | contrib/gcc/ginclude/va-ppc.h | 112 | ||||
-rw-r--r-- | contrib/gcc/ginclude/va-sh.h | 199 | ||||
-rw-r--r-- | contrib/gcc/ginclude/va-sparc.h | 120 | ||||
-rw-r--r-- | contrib/gcc/ginclude/va-spur.h | 3 | ||||
-rw-r--r-- | contrib/gcc/ginclude/va-v850.h | 34 | ||||
-rw-r--r-- | contrib/gcc/ginclude/varargs.h | 64 |
22 files changed, 1207 insertions, 159 deletions
diff --git a/contrib/gcc/ginclude/ppc-asm.h b/contrib/gcc/ginclude/ppc-asm.h new file mode 100644 index 000000000000..4512d94352a3 --- /dev/null +++ b/contrib/gcc/ginclude/ppc-asm.h @@ -0,0 +1,170 @@ +/* PowerPC asm definitions for GNU C. */ +/* Under winnt, 1) gas supports the following as names and 2) in particular + defining "toc" breaks the FUNC_START macro as ".toc" becomes ".2" */ + +#if !defined(__WINNT__) +#define r0 0 +#define sp 1 +#define toc 2 +#define r3 3 +#define r4 4 +#define r5 5 +#define r6 6 +#define r7 7 +#define r8 8 +#define r9 9 +#define r10 10 +#define r11 11 +#define r12 12 +#define r13 13 +#define r14 14 +#define r15 15 +#define r16 16 +#define r17 17 +#define r18 18 +#define r19 19 +#define r20 20 +#define r21 21 +#define r22 22 +#define r23 23 +#define r24 24 +#define r25 25 +#define r26 26 +#define r27 27 +#define r28 28 +#define r29 29 +#define r30 30 +#define r31 31 + +#define cr0 0 +#define cr1 1 +#define cr2 2 +#define cr3 3 +#define cr4 4 +#define cr5 5 +#define cr6 6 +#define cr7 7 + +#define f0 0 +#define f1 1 +#define f2 2 +#define f3 3 +#define f4 4 +#define f5 5 +#define f6 6 +#define f7 7 +#define f8 8 +#define f9 9 +#define f10 10 +#define f11 11 +#define f12 12 +#define f13 13 +#define f14 14 +#define f15 15 +#define f16 16 +#define f17 17 +#define f18 18 +#define f19 19 +#define f20 20 +#define f21 21 +#define f22 22 +#define f23 23 +#define f24 24 +#define f25 25 +#define f26 26 +#define f27 27 +#define f28 28 +#define f29 29 +#define f30 30 +#define f31 31 +#endif + +/* + * Macros to glue together two tokens. + */ + +#ifdef __STDC__ +#define XGLUE(a,b) a##b +#else +#define XGLUE(a,b) a/**/b +#endif + +#define GLUE(a,b) XGLUE(a,b) + +/* + * Macros to begin and end a function written in assembler. If -mcall-aixdesc + * or -mcall-nt, create a function descriptor with the given name, and create + * the real function with one or two leading periods respectively. + */ + +#ifdef _RELOCATABLE +#define DESC_SECTION ".got2" +#else +#define DESC_SECTION ".got1" +#endif + +#if defined(_CALL_AIXDESC) +#define FUNC_NAME(name) GLUE(.,name) +#define FUNC_START(name) \ + .section DESC_SECTION,"aw"; \ +name: \ + .long GLUE(.,name); \ + .long _GLOBAL_OFFSET_TABLE_; \ + .long 0; \ + .previous; \ + .type GLUE(.,name),@function; \ + .globl name; \ + .globl GLUE(.,name); \ +GLUE(.,name): + +#define FUNC_END(name) \ +GLUE(.L,name): \ + .size GLUE(.,name),GLUE(.L,name)-GLUE(.,name) + +#elif defined(__WINNT__) +#define FUNC_NAME(name) GLUE(..,name) +#define FUNC_START(name) \ + .pdata; \ + .align 2; \ + .ualong GLUE(..,name),GLUE(name,.e),0,0,GLUE(..,name); \ + .reldata; \ +name: \ + .ualong GLUE(..,name),.toc; \ + .section .text; \ + .globl name; \ + .globl GLUE(..,name); \ +GLUE(..,name): + +#define FUNC_END(name) \ +GLUE(name,.e): ; \ +GLUE(FE_MOT_RESVD..,name): + +#elif defined(_CALL_NT) +#define FUNC_NAME(name) GLUE(..,name) +#define FUNC_START(name) \ + .section DESC_SECTION,"aw"; \ +name: \ + .long GLUE(..,name); \ + .long _GLOBAL_OFFSET_TABLE_; \ + .previous; \ + .type GLUE(..,name),@function; \ + .globl name; \ + .globl GLUE(..,name); \ +GLUE(..,name): + +#define FUNC_END(name) \ +GLUE(.L,name): \ + .size GLUE(..,name),GLUE(.L,name)-GLUE(..,name) + +#else +#define FUNC_NAME(name) name +#define FUNC_START(name) \ + .type name,@function; \ + .globl name; \ +name: + +#define FUNC_END(name) \ +GLUE(.L,name): \ + .size name,GLUE(.L,name)-name +#endif + diff --git a/contrib/gcc/ginclude/stdarg.h b/contrib/gcc/ginclude/stdarg.h index ca79a3e2d630..24f3383198d4 100644 --- a/contrib/gcc/ginclude/stdarg.h +++ b/contrib/gcc/ginclude/stdarg.h @@ -12,34 +12,52 @@ #undef __need___va_list #ifdef __clipper__ -#include <va-clipper.h> +#include "va-clipper.h" #else #ifdef __m88k__ -#include <va-m88k.h> +#include "va-m88k.h" #else #ifdef __i860__ -#include <va-i860.h> +#include "va-i860.h" #else #ifdef __hppa__ -#include <va-pa.h> +#include "va-pa.h" #else #ifdef __mips__ -#include <va-mips.h> +#include "va-mips.h" #else #ifdef __sparc__ -#include <va-sparc.h> +#include "va-sparc.h" #else #ifdef __i960__ -#include <va-i960.h> +#include "va-i960.h" #else #ifdef __alpha__ -#include <va-alpha.h> +#include "va-alpha.h" #else -#if defined (__H8300__) || defined (__H8300H__) -#include <va-h8300.h> +#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__) +#include "va-h8300.h" #else -#if defined (__PPC__) && defined (_CALL_SYSV) -#include <va-ppc.h> +#if defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32)) +#include "va-ppc.h" +#else +#ifdef __arc__ +#include "va-arc.h" +#else +#ifdef __M32R__ +#include "va-m32r.h" +#else +#ifdef __sh__ +#include "va-sh.h" +#else +#ifdef __mn10300__ +#include "va-mn10300.h" +#else +#ifdef __mn10200__ +#include "va-mn10200.h" +#else +#ifdef __v850__ +#include "va-v850.h" #else /* Define __gnuc_va_list. */ @@ -78,7 +96,7 @@ void va_end (__gnuc_va_list); /* Defined in libgcc.a */ /* We cast to void * and then to TYPE * because this avoids a warning about increasing the alignment requirement. */ -#if defined (__arm__) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__) +#if (defined (__arm__) && ! defined (__ARMEB__)) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__) /* This is for little-endian machines; small args are padded upward. */ #define va_arg(AP, TYPE) \ (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ @@ -91,8 +109,18 @@ void va_end (__gnuc_va_list); /* Defined in libgcc.a */ - ((sizeof (TYPE) < __va_rounded_size (char) \ ? sizeof (TYPE) : __va_rounded_size (TYPE)))))) #endif /* big-endian */ + +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) (dest) = (src) + #endif /* _STDARG_H */ +#endif /* not v850 */ +#endif /* not mn10200 */ +#endif /* not mn10300 */ +#endif /* not sh */ +#endif /* not m32r */ +#endif /* not arc */ #endif /* not powerpc with V.4 calling sequence */ #endif /* not h8300 */ #endif /* not alpha */ @@ -120,7 +148,7 @@ void va_end (__gnuc_va_list); /* Defined in libgcc.a */ #undef _BSD_VA_LIST #endif -#ifdef __svr4__ +#if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST)) /* SVR4.2 uses _VA_LIST for an internal alias for va_list, so we must avoid testing it and setting it here. SVR4 uses _VA_LIST as a flag in stdarg.h, but we should @@ -133,8 +161,11 @@ void va_end (__gnuc_va_list); /* Defined in libgcc.a */ #endif #endif /* __i860__ */ typedef __gnuc_va_list va_list; +#ifdef _SCO_DS +#define __VA_LIST +#endif #endif /* _VA_LIST_ */ -#else /* not __svr4__ */ +#else /* not __svr4__ || _SCO_DS */ /* The macro _VA_LIST_ is the same thing used by this file in Ultrix. But on BSD NET2 we must not test or define or undef it. diff --git a/contrib/gcc/ginclude/stdbool.h b/contrib/gcc/ginclude/stdbool.h new file mode 100644 index 000000000000..0baf9ce42bdc --- /dev/null +++ b/contrib/gcc/ginclude/stdbool.h @@ -0,0 +1,20 @@ +/* stdbool.h for GNU. */ +#ifndef __STDBOOL_H__ +#define __STDBOOL_H__ 1 + +/* The type `bool' must promote to `int' or `unsigned int'. The constants + `true' and `false' must have the value 0 and 1 respectively. */ +typedef enum + { + false = 0, + true = 1 + } bool; + +/* The names `true' and `false' must also be made available as macros. */ +#define false false +#define true true + +/* Signal that all the definitions are present. */ +#define __bool_true_false_are_defined 1 + +#endif /* stdbool.h */ diff --git a/contrib/gcc/ginclude/stddef.h b/contrib/gcc/ginclude/stddef.h index af3071fbfe7f..615052e85d4e 100644 --- a/contrib/gcc/ginclude/stddef.h +++ b/contrib/gcc/ginclude/stddef.h @@ -1,13 +1,15 @@ -#ifndef _STDDEF_H -#ifndef _STDDEF_H_ -#ifndef _ANSI_STDDEF_H -#ifndef __STDDEF_H__ +#if (!defined(_STDDEF_H) && !defined(_STDDEF_H_) && !defined(_ANSI_STDDEF_H) \ + && !defined(__STDDEF_H__)) \ + || defined(__need_wchar_t) || defined(__need_size_t) \ + || defined(__need_ptrdiff_t) || defined(__need_NULL) \ + || defined(__need_wint_t) /* Any one of these symbols __need_* means that GNU libc wants us just to define one data type. So don't define the symbols that indicate this file's entire job has been done. */ #if (!defined(__need_wchar_t) && !defined(__need_size_t) \ - && !defined(__need_ptrdiff_t) && !defined(__need_NULL)) + && !defined(__need_ptrdiff_t) && !defined(__need_NULL) \ + && !defined(__need_wint_t)) #define _STDDEF_H #define _STDDEF_H_ /* snaroff@next.com says the NeXT needs this. */ @@ -70,7 +72,7 @@ not defined, and so that defining this macro defines _GCC_SIZE_T. If we find that the macros are still defined at this point, we must invoke them so that the type is defined as expected. */ -#if defined (TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_)) +#if defined (_TYPE_ptrdiff_t) && (defined (__need_ptrdiff_t) || defined (_STDDEF_H_)) _TYPE_ptrdiff_t; #undef _TYPE_ptrdiff_t #endif @@ -133,6 +135,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; /* Define this type if we are doing the whole job, or if we want this type in particular. */ #if defined (_STDDEF_H) || defined (__need_size_t) +#ifndef __size_t__ /* BeOS */ #ifndef _SIZE_T /* in case <sys/types.h> has defined it. */ #ifndef _SYS_SIZE_T_H #ifndef _T_SIZE_ @@ -146,6 +149,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; #ifndef _GCC_SIZE_T #ifndef _SIZET_ #ifndef __size_t +#define __size_t__ /* BeOS */ #define _SIZE_T #define _SYS_SIZE_T_H #define _T_SIZE_ @@ -164,6 +168,9 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; #endif #if !(defined (__GNUG__) && defined (size_t)) typedef __SIZE_TYPE__ size_t; +#ifdef __BEOS__ +typedef long ssize_t; +#endif /* __BEOS__ */ #endif /* !(defined (__GNUG__) && defined (size_t)) */ #endif /* __size_t */ #endif /* _SIZET_ */ @@ -178,6 +185,7 @@ typedef __SIZE_TYPE__ size_t; #endif /* _T_SIZE_ */ #endif /* _SYS_SIZE_T_H */ #endif /* _SIZE_T */ +#endif /* __size_t__ */ #undef __need_size_t #endif /* _STDDEF_H or __need_size_t. */ @@ -190,6 +198,7 @@ typedef __SIZE_TYPE__ size_t; /* Define this type if we are doing the whole job, or if we want this type in particular. */ #if defined (_STDDEF_H) || defined (__need_wchar_t) +#ifndef __wchar_t__ /* BeOS */ #ifndef _WCHAR_T #ifndef _T_WCHAR_ #ifndef _T_WCHAR @@ -202,6 +211,7 @@ typedef __SIZE_TYPE__ size_t; #ifndef ___int_wchar_t_h #ifndef __INT_WCHAR_T_H #ifndef _GCC_WCHAR_T +#define __wchar_t__ /* BeOS */ #define _WCHAR_T #define _T_WCHAR_ #define _T_WCHAR @@ -235,8 +245,12 @@ typedef _BSD_RUNE_T_ rune_t; #endif #ifndef __WCHAR_TYPE__ +#ifdef __BEOS__ +#define __WCHAR_TYPE__ unsigned char +#else #define __WCHAR_TYPE__ int #endif +#endif #ifndef __cplusplus typedef __WCHAR_TYPE__ wchar_t; #endif @@ -252,12 +266,27 @@ typedef __WCHAR_TYPE__ wchar_t; #endif #endif #endif +#endif /* __wchar_t__ */ #undef __need_wchar_t #endif /* _STDDEF_H or __need_wchar_t. */ +#if defined (_STDDEF_H) || defined (__need_wint_t) +#ifndef _WINT_T +#define _WINT_T + +#ifndef __WINT_TYPE__ +#define __WINT_TYPE__ unsigned int +#endif +typedef __WINT_TYPE__ wint_t; +#endif +#undef __need_wint_t +#endif + /* In 4.3bsd-net2, leave these undefined to indicate that size_t, etc. are already defined. */ -#ifdef _ANSI_H_ +/* BSD/OS 3.1 requires the MACHINE_ANSI_H check here. FreeBSD 2.x apparently + does not, even though there is a check for MACHINE_ANSI_H above. */ +#if defined(_ANSI_H_) || (defined(__bsdi__) && defined(_MACHINE_ANSI_H_)) /* The references to _GCC_PTRDIFF_T_, _GCC_SIZE_T_, and _GCC_WCHAR_T_ are probably typos and should be removed before 2.8 is released. */ #ifdef _GCC_PTRDIFF_T_ @@ -285,7 +314,7 @@ typedef __WCHAR_TYPE__ wchar_t; #undef _WCHAR_T_ #undef _BSD_WCHAR_T_ #endif -#endif /* _ANSI_H_ */ +#endif /* _ANSI_H_ || ( __bsdi__ && _MACHINE_ANSI_H_ ) */ #endif /* __sys_stdtypes_h */ @@ -293,7 +322,11 @@ typedef __WCHAR_TYPE__ wchar_t; #if defined (_STDDEF_H) || defined (__need_NULL) #undef NULL /* in case <stdio.h> has defined it. */ +#ifdef __GNUG__ +#define NULL __null +#else /* G++ */ #define NULL ((void *)0) +#endif /* G++ */ #endif /* NULL not defined and <stddef.h> or need NULL. */ #undef __need_NULL @@ -305,7 +338,5 @@ typedef __WCHAR_TYPE__ wchar_t; #endif /* _STDDEF_H was defined this time */ -#endif /* __STDDEF_H__ was not defined before */ -#endif /* _ANSI_STDDEF_H was not defined before */ -#endif /* _STDDEF_H_ was not defined before */ -#endif /* _STDDEF_H was not defined before */ +#endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__ + || __need_XXX was not defined before */ diff --git a/contrib/gcc/ginclude/va-alpha.h b/contrib/gcc/ginclude/va-alpha.h index 33f6c2dec74c..2528a712ada2 100644 --- a/contrib/gcc/ginclude/va-alpha.h +++ b/contrib/gcc/ginclude/va-alpha.h @@ -10,26 +10,41 @@ #ifndef __GNUC_VA_LIST #define __GNUC_VA_LIST +/* In VMS, __gnuc_va_list is simply char *; on OSF, it's a structure. */ + +#ifdef __VMS__ +typedef char *__gnuc_va_list; +#else + typedef struct { char *__base; /* Pointer to first integer register. */ int __offset; /* Byte offset of args so far. */ } __gnuc_va_list; -#endif /* not __GNUC_VA_LIST */ +#endif + +#endif /* __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) -#define va_list __gnuc_va_list +#if !defined(__GNUC_VA_LIST_1) && (defined (_STDARG_H) || defined (_VARARGS_H)) +#define __GNUC_VA_LIST_1 + #define _VA_LIST #define _VA_LIST_ +typedef __gnuc_va_list va_list; + #if !defined(_STDARG_H) /* varargs support */ #define va_alist __builtin_va_alist #define va_dcl int __builtin_va_alist;... +#ifdef __VMS__ +#define va_start(pvar) ((pvar) = __builtin_saveregs ()) +#else #define va_start(pvar) ((pvar) = * (__gnuc_va_list *) __builtin_saveregs ()) +#endif #else /* STDARG.H */ @@ -37,14 +52,19 @@ typedef struct { /* Call __builtin_next_arg even though we aren't using its value, so that we can verify that firstarg is correct. */ + +#ifdef __VMS__ +#define va_start(pvar, firstarg) \ + (__builtin_next_arg (firstarg), \ + (pvar) = __builtin_saveregs ()) +#else #define va_start(pvar, firstarg) \ (__builtin_next_arg (firstarg), \ (pvar) = *(__gnuc_va_list *) __builtin_saveregs ()) +#endif #endif /* _STDARG_H */ -#ifndef va_end - #define va_end(__va) ((void) 0) /* Values returned by __builtin_classify_type. */ @@ -72,8 +92,6 @@ enum { __lang_type_class }; -#endif - /* Note that parameters are always aligned at least to a word boundary (when passed) regardless of what GCC's __alignof__ operator says. */ @@ -89,12 +107,22 @@ enum { (((sizeof (__type) + __extension__ sizeof (long long) - 1) \ / __extension__ sizeof (long long)) * __extension__ sizeof (long long)) +#ifdef __VMS__ +#define va_arg(__va, __type) \ +(*(((__va) += __va_tsize (__type)), \ + (__type *)(void *)((__va) - __va_tsize (__type)))) + +#else + #define va_arg(__va, __type) \ (*(((__va).__offset += __va_tsize (__type)), \ (__type *)(void *)((__va).__base + (__va).__offset \ - (((__builtin_classify_type (* (__type *) 0) \ == __real_type_class) && (__va).__offset <= (6 * 8)) \ ? (6 * 8) + 8 : __va_tsize (__type))))) +#endif -#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) (dest) = (src) +#endif /* __GNUC_VA_LIST_1 */ diff --git a/contrib/gcc/ginclude/va-arc.h b/contrib/gcc/ginclude/va-arc.h new file mode 100644 index 000000000000..a718ad6245d6 --- /dev/null +++ b/contrib/gcc/ginclude/va-arc.h @@ -0,0 +1,111 @@ +/* stdarg/varargs support for the ARC */ + +/* 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) + +/* In GCC version 2, we want an ellipsis at the end of the declaration + of the argument list. GCC version 1 can't parse it. */ + +#if __GNUC__ > 1 +#define __va_ellipsis ... +#else +#define __va_ellipsis +#endif + +/* See arc_setup_incoming_varargs for reasons for the oddity in va_start. */ +#ifdef _STDARG_H +#define va_start(AP, LASTARG) \ +(AP = (__gnuc_va_list) ((int *) __builtin_next_arg (LASTARG) \ + + (__builtin_args_info (0) < 8 \ + ? (__builtin_args_info (0) & 1) \ + : 0))) +#else +#define va_alist __builtin_va_alist +#define va_dcl int __builtin_va_alist; __va_ellipsis +#define va_start(AP) \ +(AP = (__gnuc_va_list) ((int *) &__builtin_va_alist \ + + (__builtin_args_info (0) < 8 \ + ? (__builtin_args_info (0) & 1) \ + : 0))) +#endif + +#ifndef va_end +void va_end (__gnuc_va_list); /* Defined in libgcc.a */ + +/* Values returned by __builtin_classify_type. */ + +enum __va_type_classes { + __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 +}; + +#endif +#define va_end(AP) ((void)0) + +/* Avoid errors if compiling GCC v2 with GCC v1. */ +#if __GNUC__ == 1 +#define __extension__ +#endif + +/* All aggregates are passed by reference. All scalar types larger than 8 + bytes are passed by reference. */ +/* We cast to void * and then to TYPE * because this avoids + a warning about increasing the alignment requirement. + The casts to char * avoid warnings about invalid pointer arithmetic. */ + +#define __va_rounded_size(TYPE) \ + (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) + +#ifdef __big_endian__ +#define va_arg(AP,TYPE) \ +__extension__ \ +(*({((__builtin_classify_type (*(TYPE*) 0) >= __record_type_class \ + || __va_rounded_size (TYPE) > 8) \ + ? ((AP) = (char *)(AP) + __va_rounded_size (TYPE *), \ + *(TYPE **) (void *) ((char *)(AP) - __va_rounded_size (TYPE *))) \ + : ((TYPE *) (void *) \ + (AP = (void *) ((__alignof__ (TYPE) > 4 \ + ? ((int) AP + 8 - 1) & -8 \ + : (int) AP) \ + + __va_rounded_size (TYPE))) - 1));})) +#else +#define va_arg(AP,TYPE) \ +__extension__ \ +(*({((__builtin_classify_type (*(TYPE*) 0) >= __record_type_class \ + || __va_rounded_size (TYPE) > 8) \ + ? ((AP) = (char *)(AP) + __va_rounded_size (TYPE *), \ + *(TYPE **) (void *) ((char *)(AP) - __va_rounded_size (TYPE *))) \ + : ((AP = (void *) ((__alignof__ (TYPE) > 4 \ + ? ((int) AP + 8 - 1) & -8 \ + : (int) AP) \ + + __va_rounded_size (TYPE))), \ + (TYPE *) (void *) (AP - __va_rounded_size (TYPE))));})) +#endif + +#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ diff --git a/contrib/gcc/ginclude/va-clipper.h b/contrib/gcc/ginclude/va-clipper.h index 21ddc5628855..38cc77f9c1a5 100644 --- a/contrib/gcc/ginclude/va-clipper.h +++ b/contrib/gcc/ginclude/va-clipper.h @@ -54,4 +54,7 @@ typedef struct #define va_end(AP) ((void) 0) +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) (dest) = (src) + #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ diff --git a/contrib/gcc/ginclude/va-h8300.h b/contrib/gcc/ginclude/va-h8300.h index 986e827f64d0..9565696e9ad6 100644 --- a/contrib/gcc/ginclude/va-h8300.h +++ b/contrib/gcc/ginclude/va-h8300.h @@ -44,10 +44,13 @@ typedef void *__gnuc_va_list; #define va_arg(AP, TYPE) \ (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ - *((TYPE *) (void *) ((char *) (AP) - ((sizeof (TYPE) < 4 \ - ? sizeof (TYPE) \ - : __va_rounded_size (TYPE)))))) + *((TYPE *) (void *) ((char *) (AP) \ + - ((sizeof (TYPE) < __va_rounded_size (int) \ + ? sizeof (TYPE) : __va_rounded_size (TYPE)))))) #define va_end(AP) ((void) 0) +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) (dest) = (src) + #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ diff --git a/contrib/gcc/ginclude/va-i860.h b/contrib/gcc/ginclude/va-i860.h index 9b9908a0aa5c..56d2c7fe1d3b 100644 --- a/contrib/gcc/ginclude/va-i860.h +++ b/contrib/gcc/ginclude/va-i860.h @@ -207,5 +207,8 @@ __extension__ \ __rv; \ })) +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) (dest) = (src) + #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ diff --git a/contrib/gcc/ginclude/va-i960.h b/contrib/gcc/ginclude/va-i960.h index a30d5f542a47..5588d4112917 100644 --- a/contrib/gcc/ginclude/va-i960.h +++ b/contrib/gcc/ginclude/va-i960.h @@ -70,7 +70,10 @@ __extension__ \ #ifndef va_end void va_end (__gnuc_va_list); /* Defined in libgcc.a */ #endif -#define va_end(AP) ((void *)0) +#define va_end(AP) ((void) 0) + +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) (dest) = (src) #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ diff --git a/contrib/gcc/ginclude/va-m32r.h b/contrib/gcc/ginclude/va-m32r.h new file mode 100644 index 000000000000..4ef0ad8267a8 --- /dev/null +++ b/contrib/gcc/ginclude/va-m32r.h @@ -0,0 +1,86 @@ +/* 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) */ diff --git a/contrib/gcc/ginclude/va-m88k.h b/contrib/gcc/ginclude/va-m88k.h index 7f8974b9c497..0a20d84501ce 100644 --- a/contrib/gcc/ginclude/va-m88k.h +++ b/contrib/gcc/ginclude/va-m88k.h @@ -81,4 +81,7 @@ typedef struct #define va_end(AP) ((void)0) +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) (dest) = (src) + #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ diff --git a/contrib/gcc/ginclude/va-mips.h b/contrib/gcc/ginclude/va-mips.h index 3cf1c920af56..96db5b466cc3 100644 --- a/contrib/gcc/ginclude/va-mips.h +++ b/contrib/gcc/ginclude/va-mips.h @@ -13,13 +13,54 @@ #ifndef __GNUC_VA_LIST #define __GNUC_VA_LIST +#if defined (__mips_eabi) && ! defined (__mips_soft_float) && ! defined (__mips_single_float) + +typedef struct { + /* Pointer to FP regs. */ + char *__fp_regs; + /* Number of FP regs remaining. */ + int __fp_left; + /* Pointer to GP regs followed by stack parameters. */ + char *__gp_regs; +} __gnuc_va_list; + +#else /* ! (defined (__mips_eabi) && ! defined (__mips_soft_float) && ! defined (__mips_single_float)) */ + typedef char * __gnuc_va_list; + +#endif /* ! (defined (__mips_eabi) && ! defined (__mips_soft_float) && ! defined (__mips_single_float)) */ #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) +#ifndef _VA_MIPS_H_ENUM +#define _VA_MIPS_H_ENUM +enum { + __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 +}; +#endif + /* In GCC version 2, we want an ellipsis at the end of the declaration of the argument list. GCC version 1 can't parse it. */ @@ -37,16 +78,49 @@ typedef char * __gnuc_va_list; (((sizeof (__TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) #endif +#ifdef __mips64 +#define __va_reg_size 8 +#else +#define __va_reg_size 4 +#endif + /* Get definitions for _MIPS_SIM_ABI64 etc. */ #ifdef _MIPS_SIM #include <sgidefs.h> #endif #ifdef _STDARG_H +#if defined (__mips_eabi) +#if ! defined (__mips_soft_float) && ! defined (__mips_single_float) +#ifdef __mips64 +#define va_start(__AP, __LASTARG) \ + (__AP.__gp_regs = ((char *) __builtin_next_arg (__LASTARG) \ + - (__builtin_args_info (2) < 8 \ + ? (8 - __builtin_args_info (2)) * __va_reg_size \ + : 0)), \ + __AP.__fp_left = 8 - __builtin_args_info (3), \ + __AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * __va_reg_size) +#else /* ! defined (__mips64) */ +#define va_start(__AP, __LASTARG) \ + (__AP.__gp_regs = ((char *) __builtin_next_arg (__LASTARG) \ + - (__builtin_args_info (2) < 8 \ + ? (8 - __builtin_args_info (2)) * __va_reg_size \ + : 0)), \ + __AP.__fp_left = (8 - __builtin_args_info (3)) / 2, \ + __AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * 8, \ + __AP.__fp_regs = (char *) ((int) __AP.__fp_regs & -8)) +#endif /* ! defined (__mips64) */ +#else /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float) ) */ +#define va_start(__AP, __LASTARG) \ + (__AP = ((__gnuc_va_list) __builtin_next_arg (__LASTARG) \ + - (__builtin_args_info (2) >= 8 ? 0 \ + : (8 - __builtin_args_info (2)) * __va_reg_size))) +#endif /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float) ) */ +#else /* ! defined (__mips_eabi) */ #define va_start(__AP, __LASTARG) \ (__AP = (__gnuc_va_list) __builtin_next_arg (__LASTARG)) - -#else +#endif /* ! (defined (__mips_eabi) && ! defined (__mips_soft_float) && ! defined (__mips_single_float)) */ +#else /* ! _STDARG_H */ #define va_alist __builtin_va_alist #ifdef __mips64 /* This assumes that `long long int' is always a 64 bit type. */ @@ -54,21 +128,109 @@ typedef char * __gnuc_va_list; #else #define va_dcl int __builtin_va_alist; __va_ellipsis #endif +#if defined (__mips_eabi) +#if ! defined (__mips_soft_float) && ! defined (__mips_single_float) +#ifdef __mips64 +#define va_start(__AP) \ + (__AP.__gp_regs = ((char *) __builtin_next_arg () \ + - (__builtin_args_info (2) < 8 \ + ? (8 - __builtin_args_info (2)) * __va_reg_size \ + : __va_reg_size)), \ + __AP.__fp_left = 8 - __builtin_args_info (3), \ + __AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * __va_reg_size) +#else /* ! defined (__mips64) */ +#define va_start(__AP) \ + (__AP.__gp_regs = ((char *) __builtin_next_arg () \ + - (__builtin_args_info (2) < 8 \ + ? (8 - __builtin_args_info (2)) * __va_reg_size \ + : __va_reg_size)), \ + __AP.__fp_left = (8 - __builtin_args_info (3)) / 2, \ + __AP.__fp_regs = __AP.__gp_regs - __AP.__fp_left * 8, \ + __AP.__fp_regs = (char *) ((int) __AP.__fp_regs & -8)) +#endif /* ! defined (__mips64) */ +#else /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float)) */ +#define va_start(__AP) \ + (__AP = ((__gnuc_va_list) __builtin_next_arg () \ + - (__builtin_args_info (2) >= 8 ? __va_reg_size \ + : (8 - __builtin_args_info (2)) * __va_reg_size))) +#endif /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float)) */ /* Need alternate code for _MIPS_SIM_ABI64. */ -#if defined(_MIPS_SIM) && (_MIPS_SIM == _MIPS_SIM_ABI64) +#elif defined(_MIPS_SIM) && (_MIPS_SIM == _MIPS_SIM_ABI64 || _MIPS_SIM == _MIPS_SIM_NABI32) #define va_start(__AP) \ (__AP = (__gnuc_va_list) __builtin_next_arg () \ + (__builtin_args_info (2) >= 8 ? -8 : 0)) #else #define va_start(__AP) __AP = (char *) &__builtin_va_alist #endif -#endif +#endif /* ! _STDARG_H */ #ifndef va_end void va_end (__gnuc_va_list); /* Defined in libgcc.a */ #endif #define va_end(__AP) ((void)0) +#if defined (__mips_eabi) + +#if ! defined (__mips_soft_float) && ! defined (__mips_single_float) +#ifdef __mips64 +#define __va_next_addr(__AP, __type) \ + ((__builtin_classify_type (*(__type *) 0) == __real_type_class \ + && __AP.__fp_left > 0) \ + ? (--__AP.__fp_left, (__AP.__fp_regs += 8) - 8) \ + : (__AP.__gp_regs += __va_reg_size) - __va_reg_size) +#else +#define __va_next_addr(__AP, __type) \ + ((__builtin_classify_type (*(__type *) 0) == __real_type_class \ + && __AP.__fp_left > 0) \ + ? (--__AP.__fp_left, (__AP.__fp_regs += 8) - 8) \ + : (((__builtin_classify_type (* (__type *) 0) < __record_type_class \ + && __alignof__ (__type) > 4) \ + ? __AP.__gp_regs = (char *) (((int) __AP.__gp_regs + 8 - 1) & -8) \ + : (char *) 0), \ + (__builtin_classify_type (* (__type *) 0) >= __record_type_class \ + ? (__AP.__gp_regs += __va_reg_size) - __va_reg_size \ + : ((__AP.__gp_regs += __va_rounded_size (__type)) \ + - __va_rounded_size (__type))))) +#endif +#else /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float)) */ +#ifdef __mips64 +#define __va_next_addr(__AP, __type) \ + ((__AP += __va_reg_size) - __va_reg_size) +#else +#define __va_next_addr(__AP, __type) \ + (((__builtin_classify_type (* (__type *) 0) < __record_type_class \ + && __alignof__ (__type) > 4) \ + ? __AP = (char *) (((__PTRDIFF_TYPE__) __AP + 8 - 1) & -8) \ + : (char *) 0), \ + (__builtin_classify_type (* (__type *) 0) >= __record_type_class \ + ? (__AP += __va_reg_size) - __va_reg_size \ + : ((__AP += __va_rounded_size (__type)) \ + - __va_rounded_size (__type)))) +#endif +#endif /* ! (! defined (__mips_soft_float) && ! defined (__mips_single_float)) */ + +#ifdef __MIPSEB__ +#define va_arg(__AP, __type) \ + ((__va_rounded_size (__type) <= __va_reg_size) \ + ? *(__type *) (void *) (__va_next_addr (__AP, __type) \ + + __va_reg_size \ + - sizeof (__type)) \ + : (__builtin_classify_type (*(__type *) 0) >= __record_type_class \ + ? **(__type **) (void *) (__va_next_addr (__AP, __type) \ + + __va_reg_size \ + - sizeof (char *)) \ + : *(__type *) (void *) __va_next_addr (__AP, __type))) +#else +#define va_arg(__AP, __type) \ + ((__va_rounded_size (__type) <= __va_reg_size) \ + ? *(__type *) (void *) __va_next_addr (__AP, __type) \ + : (__builtin_classify_type (* (__type *) 0) >= __record_type_class \ + ? **(__type **) (void *) __va_next_addr (__AP, __type) \ + : *(__type *) (void *) __va_next_addr (__AP, __type))) +#endif + +#else /* ! defined (__mips_eabi) */ + /* We cast to void * and then to TYPE * because this avoids a warning about increasing the alignment requirement. */ /* The __mips64 cases are reversed from the 32 bit cases, because the standard @@ -78,8 +240,9 @@ void va_end (__gnuc_va_list); /* Defined in libgcc.a */ #ifdef __mips64 #ifdef __MIPSEB__ #define va_arg(__AP, __type) \ - ((__type *) (void *) (__AP = (char *) ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \ - + __va_rounded_size (__type))))[-1] + ((__type *) (void *) (__AP = (char *) \ + ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \ + + __va_rounded_size (__type))))[-1] #else #define va_arg(__AP, __type) \ ((__AP = (char *) ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8) \ @@ -93,18 +256,22 @@ void va_end (__gnuc_va_list); /* Defined in libgcc.a */ /* For big-endian machines. */ #define va_arg(__AP, __type) \ ((__AP = (char *) ((__alignof__ (__type) > 4 \ - ? ((int)__AP + 8 - 1) & -8 \ - : ((int)__AP + 4 - 1) & -4) \ + ? ((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8 \ + : ((__PTRDIFF_TYPE__)__AP + 4 - 1) & -4) \ + __va_rounded_size (__type))), \ *(__type *) (void *) (__AP - __va_rounded_size (__type))) #else /* For little-endian machines. */ #define va_arg(__AP, __type) \ ((__type *) (void *) (__AP = (char *) ((__alignof__(__type) > 4 \ - ? ((int)__AP + 8 - 1) & -8 \ - : ((int)__AP + 4 - 1) & -4) \ + ? ((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8 \ + : ((__PTRDIFF_TYPE__)__AP + 4 - 1) & -4) \ + __va_rounded_size(__type))))[-1] #endif #endif +#endif /* ! defined (__mips_eabi) */ + +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) (dest) = (src) #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ diff --git a/contrib/gcc/ginclude/va-mn10200.h b/contrib/gcc/ginclude/va-mn10200.h new file mode 100644 index 000000000000..b458b56e0beb --- /dev/null +++ b/contrib/gcc/ginclude/va-mn10200.h @@ -0,0 +1,37 @@ +/* CYGNUS LOCAL entire file/law */ +/* 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) +#define __gnuc_va_start(AP) (AP = (__gnuc_va_list)__builtin_saveregs()) +#define __va_ellipsis ... + +#ifdef _STDARG_H +#define va_start(AP, LASTARG) \ + (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG))) +#else +#define va_alist __builtin_va_alist +#define va_dcl int __builtin_va_alist; __va_ellipsis +#define va_start(AP) AP=(char *) &__builtin_va_alist +#endif + +/* Now stuff common to both varargs & stdarg implementations. */ +#define __va_rounded_size(TYPE) \ + (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) +#undef va_end +void va_end (__gnuc_va_list); +#define va_end(AP) ((void)0) +#define va_arg(AP, TYPE) \ + (sizeof (TYPE) > 8 \ + ? (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (char *)),\ + **((TYPE **) (void *) ((char *) (AP) - __va_rounded_size (char *))))\ + : (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ + *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))) +#endif +/* END CYGNUS LOCAL */ diff --git a/contrib/gcc/ginclude/va-mn10300.h b/contrib/gcc/ginclude/va-mn10300.h new file mode 100644 index 000000000000..e156ccf5939b --- /dev/null +++ b/contrib/gcc/ginclude/va-mn10300.h @@ -0,0 +1,35 @@ +/* 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) +#define __gnuc_va_start(AP) (AP = (__gnuc_va_list)__builtin_saveregs()) +#define __va_ellipsis ... + +#ifdef _STDARG_H +#define va_start(AP, LASTARG) \ + (__builtin_next_arg (LASTARG), __gnuc_va_start (AP)) +#else +#define va_alist __builtin_va_alist +#define va_dcl int __builtin_va_alist; __va_ellipsis +#define va_start(AP) AP=(char *) &__builtin_va_alist +#endif + +/* Now stuff common to both varargs & stdarg implementations. */ +#define __va_rounded_size(TYPE) \ + (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) +#undef va_end +void va_end (__gnuc_va_list); +#define va_end(AP) ((void)0) +#define va_arg(AP, TYPE) \ + (sizeof (TYPE) > 8 \ + ? (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (char *)),\ + **((TYPE **) (void *) ((char *) (AP) - __va_rounded_size (char *))))\ + : (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ + *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))) +#endif diff --git a/contrib/gcc/ginclude/va-pa.h b/contrib/gcc/ginclude/va-pa.h index b6b81dd09253..4865f6bfac08 100644 --- a/contrib/gcc/ginclude/va-pa.h +++ b/contrib/gcc/ginclude/va-pa.h @@ -4,7 +4,7 @@ #ifndef __GNUC_VA_LIST #define __GNUC_VA_LIST -typedef double *__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 @@ -46,4 +46,7 @@ void va_end (__gnuc_va_list); /* Defined in libgcc.a */ #endif #define va_end(AP) ((void)0) +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) (dest) = (src) + #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ diff --git a/contrib/gcc/ginclude/va-ppc.h b/contrib/gcc/ginclude/va-ppc.h index 09f11e0d2981..736369dbe7de 100644 --- a/contrib/gcc/ginclude/va-ppc.h +++ b/contrib/gcc/ginclude/va-ppc.h @@ -1,13 +1,22 @@ -/* GNU C varargs support for the PowerPC with V.4 calling sequence */ +/* GNU C varargs support for the PowerPC with either the V.4 or Windows NT calling sequences */ +#ifndef _WIN32 +/* System V.4 support */ /* Define __gnuc_va_list. */ #ifndef __GNUC_VA_LIST #define __GNUC_VA_LIST +#ifndef _SYS_VA_LIST_H +#define _SYS_VA_LIST_H /* Solaris sys/va_list.h */ + +/* Solaris decided to rename overflow_arg_area to input_arg_area, + so handle it via a macro. */ +#define __va_overflow(AP) (AP)->overflow_arg_area + /* Note that the names in this structure are in the user's namespace, but that the V.4 abi explicitly states that these names should be used. */ -typedef struct { +typedef struct __va_list_tag { char gpr; /* index into the array of 8 GPRs stored in the register save area gpr=0 corresponds to r3, gpr=1 to r4, etc. */ @@ -17,7 +26,14 @@ typedef struct { char *overflow_arg_area; /* location on stack that holds the next overflow argument */ char *reg_save_area; /* where r3:r10 and f1:f8, if saved are stored */ -} __gnuc_va_list[1]; +} __va_list[1], __gnuc_va_list[1]; + +#else /* _SYS_VA_LIST */ + +typedef __va_list __gnuc_va_list; +#define __va_overflow(AP) (AP)->input_arg_area + +#endif /* not _SYS_VA_LIST */ #endif /* not __GNUC_VA_LIST */ /* If this is for internal libc use, don't define anything but @@ -25,6 +41,8 @@ typedef struct { #if defined (_STDARG_H) || defined (_VARARGS_H) /* Register save area located below the frame pointer */ +#ifndef __VA_PPC_H__ +#define __VA_PPC_H__ typedef struct { long __gp_save[8]; /* save area for GP registers */ double __fp_save[8]; /* save area for FP registers */ @@ -64,9 +82,9 @@ __extension__ ({ \ (AP)->fpr = __va_fregno - 33; \ (AP)->reg_save_area = (((char *) __builtin_frame_address (0)) \ + __va_varargs_offset); \ - (AP)->overflow_arg_area = ((char *)__builtin_saveregs () \ - + (((__words >= 8) ? __words - 8 : 0) \ - * sizeof (long))); \ + __va_overflow(AP) = ((char *)__builtin_saveregs () \ + + (((__words >= 8) ? __words - 8 : 0) \ + * sizeof (long))); \ (void)0; \ }) @@ -91,6 +109,9 @@ __extension__ ({ \ #define __va_float_p(TYPE) (__builtin_classify_type(*(TYPE *)0) == 8) #endif +#define __va_longlong_p(TYPE) \ + ((__builtin_classify_type(*(TYPE *)0) == 1) && (sizeof(TYPE) == 8)) + #define __va_aggregate_p(TYPE) (__builtin_classify_type(*(TYPE *)0) >= 12) #define __va_size(TYPE) ((sizeof(TYPE) + sizeof (long) - 1) / sizeof (long)) @@ -111,8 +132,13 @@ __extension__ (*({ \ } \ \ else if (!__va_float_p (TYPE) && !__va_aggregate_p (TYPE) \ - && (AP)->gpr + __va_size(TYPE) <= 8) \ + && (AP)->gpr + __va_size(TYPE) <= 8 \ + && (!__va_longlong_p(TYPE) \ + || (AP)->gpr + __va_size(TYPE) <= 8)) \ { \ + if (__va_longlong_p(TYPE) && ((AP)->gpr & 1) != 0) \ + (AP)->gpr++; \ + \ __ptr = __VA_GP_REGSAVE (AP, TYPE); \ (AP)->gpr += __va_size (TYPE); \ } \ @@ -121,19 +147,19 @@ __extension__ (*({ \ && (AP)->gpr < 8) \ { \ (AP)->gpr = 8; \ - __ptr = (TYPE *) (void *) ((AP)->overflow_arg_area); \ - (AP)->overflow_arg_area += __va_size (TYPE) * sizeof (long); \ + __ptr = (TYPE *) (void *) (__va_overflow(AP)); \ + __va_overflow(AP) += __va_size (TYPE) * sizeof (long); \ } \ \ else if (__va_aggregate_p (TYPE)) \ { \ - __ptr = * (TYPE **) (void *) ((AP)->overflow_arg_area); \ - (AP)->overflow_arg_area += sizeof (TYPE *); \ + __ptr = * (TYPE **) (void *) (__va_overflow(AP)); \ + __va_overflow(AP) += sizeof (TYPE *); \ } \ else \ { \ - __ptr = (TYPE *) (void *) ((AP)->overflow_arg_area); \ - (AP)->overflow_arg_area += __va_size (TYPE) * sizeof (long); \ + __ptr = (TYPE *) (void *) (__va_overflow(AP)); \ + __va_overflow(AP) += __va_size (TYPE) * sizeof (long); \ } \ \ __ptr; \ @@ -141,4 +167,64 @@ __extension__ (*({ \ #define va_end(AP) ((void)0) +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) *(dest) = *(src) + +#endif /* __VA_PPC_H__ */ +#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ + + +#else +/* Windows NT */ +/* Define __gnuc_va_list. */ + +#ifndef __GNUC_VA_LIST +#define __GNUC_VA_LIST +typedef char *__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) + +#define __va_start_common(AP, LASTARG, FAKE) \ + ((__builtin_saveregs ()), ((AP) = ((char *) &LASTARG) + __va_rounded_size (AP)), 0) + +#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) \ + (__builtin_saveregs (), \ + (AP) = __builtin_next_arg (LASTARG), \ + 0) + +#else /* varargs.h support */ + +#define va_start(AP) \ + (__builtin_saveregs (), \ + (AP) = __builtin_next_arg (__va_1st_arg) - sizeof (int), \ + 0) + +#define va_alist __va_1st_arg +#define va_dcl register int __va_1st_arg; ... + +#endif /* _STDARG_H */ + +#define __va_rounded_size(TYPE) ((sizeof (TYPE) + 3) & ~3) +#define __va_align(AP, TYPE) \ + ((((unsigned long)(AP)) + ((sizeof (TYPE) >= 8) ? 7 : 3)) \ + & ~((sizeof (TYPE) >= 8) ? 7 : 3)) + +#define va_arg(AP,TYPE) \ +( *(TYPE *)((AP = (char *) (__va_align(AP, TYPE) \ + + __va_rounded_size(TYPE))) \ + - __va_rounded_size(TYPE))) + +#define va_end(AP) ((void)0) + +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) (dest) = (src) + #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ +#endif /* Windows NT */ diff --git a/contrib/gcc/ginclude/va-sh.h b/contrib/gcc/ginclude/va-sh.h new file mode 100644 index 000000000000..b4a4f43e32e5 --- /dev/null +++ b/contrib/gcc/ginclude/va-sh.h @@ -0,0 +1,199 @@ +/* This is just like the default gvarargs.h + except for differences described below. */ + +/* Define __gnuc_va_list. */ + +#ifndef __GNUC_VA_LIST +#define __GNUC_VA_LIST + +#ifdef __SH3E__ + +typedef long __va_greg; +typedef double __va_freg; + +typedef struct { + __va_greg * __va_next_o; /* next available register */ + __va_greg * __va_next_o_limit; /* past last available register */ + __va_freg * __va_next_fp; /* next available fp register */ + __va_freg * __va_next_fp_limit; /* last available fp register */ + __va_greg * __va_next_stack; /* next extended word on stack */ +} __gnuc_va_list; + +#else /* ! SH3E */ + +typedef void *__gnuc_va_list; + +#endif /* ! SH3E */ + +#endif /* __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) + +#ifdef _STDARG_H + +#ifdef __SH3E__ + +#define va_start(AP, LASTARG) \ +__extension__ \ + ({ \ + AP.__va_next_fp = (__va_freg *) __builtin_saveregs (); \ + AP.__va_next_fp_limit = (AP.__va_next_fp + \ + (__builtin_args_info (1) < 8 ? 8 - __builtin_args_info (1) : 0)); \ + AP.__va_next_o = (__va_greg *) AP.__va_next_fp_limit; \ + AP.__va_next_o_limit = (AP.__va_next_o + \ + (__builtin_args_info (0) < 4 ? 4 - __builtin_args_info (0) : 0)); \ + AP.__va_next_stack = (__va_greg *) __builtin_next_arg (LASTARG); \ + }) + +#else /* ! SH3E */ + +#define va_start(AP, LASTARG) \ + (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG))) + +#endif /* ! SH3E */ + +#else /* _VARARGS_H */ + +#define va_alist __builtin_va_alist +#define va_dcl int __builtin_va_alist;... + +#ifdef __SH3E__ + +#define va_start(AP) \ +__extension__ \ + ({ \ + AP.__va_next_fp = (__va_freg *) __builtin_saveregs (); \ + AP.__va_next_fp_limit = (AP.__va_next_fp + \ + (__builtin_args_info (1) < 8 ? 8 - __builtin_args_info (1) : 0)); \ + AP.__va_next_o = (__va_greg *) AP.__va_next_fp_limit; \ + AP.__va_next_o_limit = (AP.__va_next_o + \ + (__builtin_args_info (0) < 4 ? 4 - __builtin_args_info (0) : 0)); \ + AP.__va_next_stack = (__va_greg *) __builtin_next_arg (__builtin_va_alist) \ + - (__builtin_args_info (0) >= 4 || __builtin_args_info (1) >= 8 ? 1 : 0); \ + }) + +#else /* ! SH3E */ + +#define va_start(AP) AP=(char *) &__builtin_va_alist + +#endif /* ! SH3E */ + +#endif /* _STDARG */ + +#ifndef va_end +void va_end (__gnuc_va_list); /* Defined in libgcc.a */ + +/* Values returned by __builtin_classify_type. */ + +enum __va_type_classes { + __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 +}; + +#endif +#define va_end(pvar) ((void)0) + +#ifdef __LITTLE_ENDIAN__ +#define __LITTLE_ENDIAN_P 1 +#else +#define __LITTLE_ENDIAN_P 0 +#endif + +#define __SCALAR_TYPE(TYPE) \ + ((TYPE) == __integer_type_class \ + || (TYPE) == __char_type_class \ + || (TYPE) == __enumeral_type_class) + +/* RECORD_TYPE args passed using the C calling convention are + passed by invisible reference. ??? RECORD_TYPE args passed + in the stack are made to be word-aligned; for an aggregate that is + not word-aligned, we advance the pointer to the first non-reg slot. */ + + /* When this is a smaller-than-int integer, using + auto-increment in the promoted (SImode) is fastest; + however, there is no way to express that is C. Therefore, + we use an asm. + We want the MEM_IN_STRUCT_P bit set in the emitted RTL, therefore we + use unions even when it would otherwise be unnecessary. */ + +#define __va_arg_sh1(AP, TYPE) __extension__ \ +__extension__ \ +({(sizeof (TYPE) == 1 \ + ? ({union {TYPE t; char c;} __t; \ + __asm("" \ + : "=r" (__t.c) \ + : "0" ((((union { int i, j; } *) (AP))++)->i)); \ + __t.t;}) \ + : sizeof (TYPE) == 2 \ + ? ({union {TYPE t; short s;} __t; \ + __asm("" \ + : "=r" (__t.s) \ + : "0" ((((union { int i, j; } *) (AP))++)->i)); \ + __t.t;}) \ + : sizeof (TYPE) >= 4 || __LITTLE_ENDIAN_P \ + ? (((union { TYPE t; int i;} *) (AP))++)->t \ + : ((union {TYPE t;TYPE u;}*) ((char *)++(int *)(AP) - sizeof (TYPE)))->t);}) + +#ifdef __SH3E__ + +#define __PASS_AS_FLOAT(TYPE_CLASS,SIZE) \ + (TYPE_CLASS == __real_type_class && SIZE == 4) + +#define va_arg(pvar,TYPE) \ +__extension__ \ +({int __type = __builtin_classify_type (* (TYPE *) 0); \ + void * __result_p; \ + if (__PASS_AS_FLOAT (__type, sizeof(TYPE))) \ + { \ + if (pvar.__va_next_fp < pvar.__va_next_fp_limit) \ + { \ + __result_p = &pvar.__va_next_fp; \ + } \ + else \ + __result_p = &pvar.__va_next_stack; \ + } \ + else \ + { \ + if (pvar.__va_next_o + ((sizeof (TYPE) + 3) / 4) \ + <= pvar.__va_next_o_limit) \ + __result_p = &pvar.__va_next_o; \ + else \ + { \ + if (sizeof (TYPE) > 4) \ + pvar.__va_next_o = pvar.__va_next_o_limit; \ + \ + __result_p = &pvar.__va_next_stack; \ + } \ + } \ + __va_arg_sh1(*(void **)__result_p, TYPE);}) + +#else /* ! SH3E */ + +#define va_arg(AP, TYPE) __va_arg_sh1((AP), TYPE) + +#endif /* SH3E */ + +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) (dest) = (src) + +#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ diff --git a/contrib/gcc/ginclude/va-sparc.h b/contrib/gcc/ginclude/va-sparc.h index 40a240440339..73c9de1cd9a0 100644 --- a/contrib/gcc/ginclude/va-sparc.h +++ b/contrib/gcc/ginclude/va-sparc.h @@ -5,19 +5,7 @@ #ifndef __GNUC_VA_LIST #define __GNUC_VA_LIST - -#ifdef __sparc_v9__ -typedef long long __va_greg; -typedef double __va_freg; -typedef struct { - __va_greg * __va_next_o; /* next available %o* register */ - __va_greg * __va_next_o_limit; /* past last available %o* register */ - __va_freg * __va_next_fp; /* next available %f* register */ - __va_freg * __va_next_fp_limit; /* last available %f* register */ - __va_greg * __va_next_stack; /* next extended word on stack */ -} __gnuc_va_list; -#else -#ifndef __svr4__ +#if ! defined (__svr4__) && ! defined (__linux__) && ! defined (__arch64__) /* This has to be a char * to be compatible with Sun. i.e., we have to pass a `va_list' to vsprintf. */ typedef char * __gnuc_va_list; @@ -26,7 +14,6 @@ typedef char * __gnuc_va_list; i.e., we have to pass a `va_list' to vsprintf. */ typedef void * __gnuc_va_list; #endif -#endif /* not __sparc_v9__ */ #endif /* not __GNUC_VA_LIST */ /* If this is for internal libc use, don't define anything but @@ -35,56 +22,27 @@ typedef void * __gnuc_va_list; #ifdef _STDARG_H -#ifdef __sparc_v9__ -#define va_start(AP, LASTARG) \ -__extension__ \ - ({ \ - AP.__va_next_o = (__va_greg *) __builtin_saveregs (); \ - AP.__va_next_o_limit = (AP.__va_next_o + \ - (__builtin_args_info (0) < 6 ? 6 - __builtin_args_info (0) : 0)); \ - AP.__va_next_fp = (__va_freg *) AP.__va_next_o_limit; \ - AP.__va_next_fp_limit = (AP.__va_next_fp + \ - (__builtin_args_info (1) < 16 ? (16 - __builtin_args_info (1) + 1) / 2 : 0)); \ - AP.__va_next_stack = (__va_greg *) __builtin_next_arg (LASTARG); \ - }) -#else /* Call __builtin_next_arg even though we aren't using its value, so that we can verify that LASTARG is correct. */ -#ifdef __GCC_NEW_VARARGS__ +#if defined (__GCC_NEW_VARARGS__) || defined (__arch64__) #define va_start(AP, LASTARG) \ (__builtin_next_arg (LASTARG), AP = (char *) __builtin_saveregs ()) #else #define va_start(AP, LASTARG) \ (__builtin_saveregs (), AP = ((char *) __builtin_next_arg (LASTARG))) #endif -#endif /* not __sparc_v9__ */ #else #define va_alist __builtin_va_alist #define va_dcl int __builtin_va_alist;... -#ifdef __sparc_v9__ -#define va_start(AP) \ -__extension__ \ - ({ \ - AP.__va_next_o = (__va_greg *) __builtin_saveregs (); \ - AP.__va_next_o_limit = (AP.__va_next_o + \ - (__builtin_args_info (0) < 6 ? 6 - __builtin_args_info (0) : 0)); \ - AP.__va_next_fp = (__va_freg *) AP.__va_next_o_limit; \ - AP.__va_next_fp_limit = (AP.__va_next_fp + \ - (__builtin_args_info (1) < 16 ? (16 - __builtin_args_info (1) + 1) / 2 : 0)); \ - AP.__va_next_stack = (__va_greg *) __builtin_next_arg (__builtin_va_alist) \ - - (__builtin_args_info (0) >= 6 || __builtin_args_info (1) >= 16 ? 1 : 0); \ - }) -#else -#ifdef __GCC_NEW_VARARGS__ -#define va_start(AP) ((AP) = (char *) __builtin_saveregs ()) +#if defined (__GCC_NEW_VARARGS__) || defined (__arch64__) +#define va_start(AP) ((AP) = (char *) __builtin_saveregs ()) #else -#define va_start(AP) \ - (__builtin_saveregs (), (AP) = ((char *) &__builtin_va_alist)) +#define va_start(AP) \ + (__builtin_saveregs (), (AP) = ((char *) &__builtin_va_alist)) #endif -#endif /* not __sparc_v9__ */ #endif @@ -129,51 +87,51 @@ enum __va_type_classes { in the stack are made to be word-aligned; for an aggregate that is not word-aligned, we advance the pointer to the first non-reg slot. */ -#ifdef __sparc_v9__ +#ifdef __arch64__ -#define va_arg(pvar,TYPE) \ +typedef unsigned int __ptrint __attribute__ ((__mode__ (__DI__))); + +/* ??? TODO: little endian support */ + +#define va_arg(pvar, TYPE) \ __extension__ \ (*({int __type = __builtin_classify_type (* (TYPE *) 0); \ - void * __result; \ + char * __result; \ if (__type == __real_type_class) /* float? */ \ { \ - __va_freg *__r; \ - /* see PASS_IN_REG_P in gcc's sparc.h */ \ - if (pvar.__va_next_fp < pvar.__va_next_fp_limit \ - && ((__r = (__va_freg *) (((__va_greg) pvar.__va_next_fp + sizeof (TYPE) - 1) & ~(__va_greg) (sizeof (TYPE) - 1))) \ - < pvar.__va_next_fp_limit)) \ - { \ - pvar.__va_next_fp = __r + (sizeof (TYPE) + 7) / 8; \ - } \ - else \ - { \ - __r = (__va_freg *) pvar.__va_next_stack; \ - pvar.__va_next_stack += (sizeof (TYPE) + 7) / 8; \ - } \ - __result = __r; \ + if (__alignof__ (TYPE) == 16) \ + (pvar) = (void *) (((__ptrint) (pvar) + 15) & -16); \ + __result = (pvar); \ + (pvar) = (char *) (pvar) + sizeof (TYPE); \ } \ else if (__type < __record_type_class) /* integer? */ \ { \ - __va_greg *__r; \ - if (pvar.__va_next_o < pvar.__va_next_o_limit) \ - __r = pvar.__va_next_o++; \ - else \ - __r = pvar.__va_next_stack++; \ - /* adjust for 4 byte ints */ \ - __result = (char *) __r + 8 - sizeof (TYPE); \ + (pvar) = (char *) (pvar) + 8; \ + __result = (char *) (pvar) - sizeof (TYPE); \ } \ else /* aggregate object */ \ { \ - void **__r; \ - if (pvar.__va_next_o < pvar.__va_next_o_limit) \ - __r = (void **) pvar.__va_next_o++; \ + if (sizeof (TYPE) <= 8) \ + { \ + __result = (pvar); \ + (pvar) = (char *) (pvar) + 8; \ + } \ + else if (sizeof (TYPE) <= 16) \ + { \ + if (__alignof__ (TYPE) == 16) \ + (pvar) = (void *) (((__ptrint) (pvar) + 15) & -16); \ + __result = (pvar); \ + (pvar) = (char *) (pvar) + 16; \ + } \ else \ - __r = (void **) pvar.__va_next_stack++; \ - __result = *__r; \ + { \ + __result = * (void **) (pvar); \ + (pvar) = (char *) (pvar) + 8; \ + } \ } \ (TYPE *) __result;})) -#else /* not __sparc_v9__ */ +#else /* not __arch64__ */ #define __va_rounded_size(TYPE) \ (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) @@ -198,6 +156,10 @@ __extension__ \ (TYPE *) (void *) __u.__d; }) \ : ((pvar) = (char *)(pvar) + __va_rounded_size (TYPE), \ ((TYPE *) (void *) ((char *)(pvar) - __va_rounded_size (TYPE)))));})) -#endif /* not __sparc_v9__ */ + +#endif /* not __arch64__ */ + +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) (dest) = (src) #endif /* defined (_STDARG_H) || defined (_VARARGS_H) */ diff --git a/contrib/gcc/ginclude/va-spur.h b/contrib/gcc/ginclude/va-spur.h index 68cbc5ced64c..7457ceb9fcdb 100644 --- a/contrib/gcc/ginclude/va-spur.h +++ b/contrib/gcc/ginclude/va-spur.h @@ -59,3 +59,6 @@ __extension__ \ (pvar).__pnt += (sizeof(type) + 3) & ~3; \ } \ __va_result; })) + +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) (dest) = (src) diff --git a/contrib/gcc/ginclude/va-v850.h b/contrib/gcc/ginclude/va-v850.h new file mode 100644 index 000000000000..96da6d5a3dea --- /dev/null +++ b/contrib/gcc/ginclude/va-v850.h @@ -0,0 +1,34 @@ +/* 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) + +#ifdef _STDARG_H +#define va_start(AP, LASTARG) \ + (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG))) +#else +#define __va_ellipsis ... +#define va_alist __builtin_va_alist +#define va_dcl int __builtin_va_alist; __va_ellipsis +#define va_start(AP) AP=(char *) &__builtin_va_alist +#endif + +/* Now stuff common to both varargs & stdarg implementations. */ +#define __va_rounded_size(TYPE) \ + (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) +#undef va_end +void va_end (__gnuc_va_list); +#define va_end(AP) ((void)0) +#define va_arg(AP, TYPE) \ + (sizeof (TYPE) > 8 \ + ? (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (char *)),\ + **((TYPE **) (void *) ((char *) (AP) - __va_rounded_size (char *))))\ + : (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ + *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))) +#endif diff --git a/contrib/gcc/ginclude/varargs.h b/contrib/gcc/ginclude/varargs.h index 691759e99ac3..410d06aac69b 100644 --- a/contrib/gcc/ginclude/varargs.h +++ b/contrib/gcc/ginclude/varargs.h @@ -4,40 +4,58 @@ #define _VARARGS_H #ifdef __sparc__ -#include <va-sparc.h> +#include "va-sparc.h" #else #ifdef __spur__ -#include <va-spur.h> +#include "va-spur.h" #else #ifdef __mips__ -#include <va-mips.h> +#include "va-mips.h" #else #ifdef __i860__ -#include <va-i860.h> +#include "va-i860.h" #else #ifdef __pyr__ -#include <va-pyr.h> +#include "va-pyr.h" #else #ifdef __clipper__ -#include <va-clipper.h> +#include "va-clipper.h" #else #ifdef __m88k__ -#include <va-m88k.h> +#include "va-m88k.h" #else #if defined(__hppa__) || defined(hp800) -#include <va-pa.h> +#include "va-pa.h" #else #ifdef __i960__ -#include <va-i960.h> +#include "va-i960.h" #else #ifdef __alpha__ -#include <va-alpha.h> +#include "va-alpha.h" #else -#if defined (__H8300__) || defined (__H8300H__) -#include <va-h8300.h> +#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__) +#include "va-h8300.h" #else -#if defined (__PPC__) && defined (_CALL_SYSV) -#include <va-ppc.h> +#if defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32)) +#include "va-ppc.h" +#else +#ifdef __arc__ +#include "va-arc.h" +#else +#ifdef __M32R__ +#include "va-m32r.h" +#else +#ifdef __sh__ +#include "va-sh.h" +#else +#ifdef __mn10300__ +#include "va-mn10300.h" +#else +#ifdef __mn10200__ +#include "va-mn10200.h" +#else +#ifdef __v850__ +#include "va-v850.h" #else #ifdef __NeXT__ @@ -97,7 +115,7 @@ typedef void *__gnuc_va_list; (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) #endif -#if defined (__arm__) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__) +#if (defined (__arm__) && ! defined (__ARMEB__)) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__) /* This is for little-endian machines; small args are padded upward. */ #define va_arg(AP, TYPE) \ (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \ @@ -111,6 +129,15 @@ typedef void *__gnuc_va_list; ? sizeof (TYPE) : __va_rounded_size (TYPE)))))) #endif /* big-endian */ +/* Copy __gnuc_va_list into another variable of this type. */ +#define __va_copy(dest, src) (dest) = (src) + +#endif /* not v850 */ +#endif /* not mn10200 */ +#endif /* not mn10300 */ +#endif /* not sh */ +#endif /* not m32r */ +#endif /* not arc */ #endif /* not powerpc with V.4 calling sequence */ #endif /* not h8300 */ #endif /* not alpha */ @@ -131,7 +158,7 @@ typedef void *__gnuc_va_list; #undef _VA_LIST #endif -#ifdef __svr4__ +#if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST)) /* SVR4.2 uses _VA_LIST for an internal alias for va_list, so we must avoid testing it and setting it here. SVR4 uses _VA_LIST as a flag in stdarg.h, but we should @@ -144,9 +171,12 @@ typedef void *__gnuc_va_list; #endif #endif /* __i860__ */ typedef __gnuc_va_list va_list; +#ifdef _SCO_DS +#define __VA_LIST +#endif #endif /* _VA_LIST_ */ -#else /* not __svr4__ */ +#else /* not __svr4__ || _SCO_DS */ /* The macro _VA_LIST_ is the same thing used by this file in Ultrix. But on BSD NET2 we must not test or define or undef it. |