Second stab at reorganizing standard/gcc headers. This time it not only
builds on Linux with gcc 2 and 4, but the images do even run. :-) Not tested on BeOS. * Removed stddef.h and stdarg.h. They are provided by the compiler. * Adjusted size_t.h, wchar_t.h, and wchar.h accordingly. * Made stdio.h avoid gcc 2.95.3's fixincludes hack stdio_va_list * Added gcc 2.95.3 headers to the repository. They are used instead of the headers of the gcc 2.95.3's we use to compile Haiku with. Should avoid build problems with the BeOS native compiler. For sake of personal recreation you can rebuild the cross gcc 2.95.3, but the only thing that changed is its header directory (lib/gcc-lib/.../include), which isn't used anymore. Replacing it with headers/build/gcc-2.95.3 should have the same effect as rebuilding, BTW. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24413 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
This README file is copied into the directory for GCC-only header files
|
||||
when fixincludes is run by the makefile for GCC.
|
||||
|
||||
Many of the files in this directory were made from the standard system
|
||||
header files of this system by the shell script `fixincludes'.
|
||||
They are system-specific, and will not work on any other kind of system.
|
||||
They are also not part of GCC. The reason for making the files here
|
||||
is to fix the places in the header files which use constructs
|
||||
that are incompatible with ANSI C.
|
||||
@@ -0,0 +1,39 @@
|
||||
// Exception Handling support header for -*- C++ -*-
|
||||
// Copyright (C) 1995, 96-97, 1998 Free Software Foundation
|
||||
|
||||
#ifndef __EXCEPTION__
|
||||
#define __EXCEPTION__
|
||||
|
||||
#pragma interface "exception"
|
||||
|
||||
extern "C++" {
|
||||
|
||||
namespace std {
|
||||
|
||||
class exception {
|
||||
public:
|
||||
exception () { }
|
||||
virtual ~exception () { }
|
||||
virtual const char* what () const;
|
||||
};
|
||||
|
||||
class bad_exception : public exception {
|
||||
public:
|
||||
bad_exception () { }
|
||||
virtual ~bad_exception () { }
|
||||
};
|
||||
|
||||
typedef void (*terminate_handler) ();
|
||||
typedef void (*unexpected_handler) ();
|
||||
|
||||
terminate_handler set_terminate (terminate_handler);
|
||||
void terminate () __attribute__ ((__noreturn__));
|
||||
unexpected_handler set_unexpected (unexpected_handler);
|
||||
void unexpected () __attribute__ ((__noreturn__));
|
||||
bool uncaught_exception ();
|
||||
|
||||
} // namespace std
|
||||
|
||||
} // extern "C++"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,104 @@
|
||||
/* float.h for target with IEEE 32/64 bit and Intel 386 style 80 bit
|
||||
floating point formats */
|
||||
#ifndef _FLOAT_H_
|
||||
#define _FLOAT_H_
|
||||
/* Produced by enquire version 4.3, CWI, Amsterdam */
|
||||
|
||||
/* Radix of exponent representation */
|
||||
#undef FLT_RADIX
|
||||
#define FLT_RADIX 2
|
||||
/* Number of base-FLT_RADIX digits in the significand of a float */
|
||||
#undef FLT_MANT_DIG
|
||||
#define FLT_MANT_DIG 24
|
||||
/* Number of decimal digits of precision in a float */
|
||||
#undef FLT_DIG
|
||||
#define FLT_DIG 6
|
||||
/* Addition rounds to 0: zero, 1: nearest, 2: +inf, 3: -inf, -1: unknown */
|
||||
#undef FLT_ROUNDS
|
||||
#define FLT_ROUNDS 1
|
||||
/* Difference between 1.0 and the minimum float greater than 1.0 */
|
||||
#undef FLT_EPSILON
|
||||
#define FLT_EPSILON 1.19209290e-07F
|
||||
/* Minimum int x such that FLT_RADIX**(x-1) is a normalised float */
|
||||
#undef FLT_MIN_EXP
|
||||
#define FLT_MIN_EXP (-125)
|
||||
/* Minimum normalised float */
|
||||
#undef FLT_MIN
|
||||
#define FLT_MIN 1.17549435e-38F
|
||||
/* Minimum int x such that 10**x is a normalised float */
|
||||
#undef FLT_MIN_10_EXP
|
||||
#define FLT_MIN_10_EXP (-37)
|
||||
/* Maximum int x such that FLT_RADIX**(x-1) is a representable float */
|
||||
#undef FLT_MAX_EXP
|
||||
#define FLT_MAX_EXP 128
|
||||
/* Maximum float */
|
||||
#undef FLT_MAX
|
||||
#define FLT_MAX 3.40282347e+38F
|
||||
/* Maximum int x such that 10**x is a representable float */
|
||||
#undef FLT_MAX_10_EXP
|
||||
#define FLT_MAX_10_EXP 38
|
||||
|
||||
/* Number of base-FLT_RADIX digits in the significand of a double */
|
||||
#undef DBL_MANT_DIG
|
||||
#define DBL_MANT_DIG 53
|
||||
/* Number of decimal digits of precision in a double */
|
||||
#undef DBL_DIG
|
||||
#define DBL_DIG 15
|
||||
/* Difference between 1.0 and the minimum double greater than 1.0 */
|
||||
#undef DBL_EPSILON
|
||||
#define DBL_EPSILON 2.2204460492503131e-16
|
||||
/* Minimum int x such that FLT_RADIX**(x-1) is a normalised double */
|
||||
#undef DBL_MIN_EXP
|
||||
#define DBL_MIN_EXP (-1021)
|
||||
/* Minimum normalised double */
|
||||
#undef DBL_MIN
|
||||
#define DBL_MIN 2.2250738585072014e-308
|
||||
/* Minimum int x such that 10**x is a normalised double */
|
||||
#undef DBL_MIN_10_EXP
|
||||
#define DBL_MIN_10_EXP (-307)
|
||||
/* Maximum int x such that FLT_RADIX**(x-1) is a representable double */
|
||||
#undef DBL_MAX_EXP
|
||||
#define DBL_MAX_EXP 1024
|
||||
/* Maximum double */
|
||||
#undef DBL_MAX
|
||||
#define DBL_MAX 1.7976931348623157e+308
|
||||
/* Maximum int x such that 10**x is a representable double */
|
||||
#undef DBL_MAX_10_EXP
|
||||
#define DBL_MAX_10_EXP 308
|
||||
|
||||
/* Number of base-FLT_RADIX digits in the significand of a long double */
|
||||
#undef LDBL_MANT_DIG
|
||||
#define LDBL_MANT_DIG 64
|
||||
/* Number of decimal digits of precision in a long double */
|
||||
#undef LDBL_DIG
|
||||
#define LDBL_DIG 18
|
||||
/* Difference between 1.0 and the minimum long double greater than 1.0 */
|
||||
#undef LDBL_EPSILON
|
||||
#ifndef __LDBL_UNION__
|
||||
#define __LDBL_UNION__
|
||||
union __convert_long_double {
|
||||
unsigned __convert_long_double_i[4];
|
||||
long double __convert_long_double_d;
|
||||
};
|
||||
#endif
|
||||
#define LDBL_EPSILON (__extension__ ((union __convert_long_double) {__convert_long_double_i: {0x0, 0x80000000, 0x3fc0, 0x0}}).__convert_long_double_d)
|
||||
/* Minimum int x such that FLT_RADIX**(x-1) is a normalised long double */
|
||||
#undef LDBL_MIN_EXP
|
||||
#define LDBL_MIN_EXP (-16381)
|
||||
/* Minimum normalised long double */
|
||||
#undef LDBL_MIN
|
||||
#define LDBL_MIN (__extension__ ((union __convert_long_double) {__convert_long_double_i: {0x0, 0x80000000, 0x1, 0x0}}).__convert_long_double_d)
|
||||
/* Minimum int x such that 10**x is a normalised long double */
|
||||
#undef LDBL_MIN_10_EXP
|
||||
#define LDBL_MIN_10_EXP (-4931)
|
||||
/* Maximum int x such that FLT_RADIX**(x-1) is a representable long double */
|
||||
#undef LDBL_MAX_EXP
|
||||
#define LDBL_MAX_EXP 16384
|
||||
/* Maximum long double */
|
||||
#undef LDBL_MAX
|
||||
#define LDBL_MAX (__extension__ ((union __convert_long_double) {__convert_long_double_i: {0xffffffff, 0xffffffff, 0x107ffe, 0x0}}).__convert_long_double_d)
|
||||
/* Maximum int x such that 10**x is a representable long double */
|
||||
#undef LDBL_MAX_10_EXP
|
||||
#define LDBL_MAX_10_EXP 4932
|
||||
|
||||
#endif /* _FLOAT_H___ */
|
||||
@@ -0,0 +1,15 @@
|
||||
/* Macros for C programs written in national variants of ISO 646. */
|
||||
|
||||
#ifndef __cplusplus
|
||||
#define and &&
|
||||
#define and_eq &=
|
||||
#define bitand &
|
||||
#define bitor |
|
||||
#define compl ~
|
||||
#define not !
|
||||
#define not_eq !=
|
||||
#define or ||
|
||||
#define or_eq |=
|
||||
#define xor ^
|
||||
#define xor_eq ^=
|
||||
#endif
|
||||
@@ -0,0 +1,120 @@
|
||||
/* This administrivia gets added to the beginning of limits.h
|
||||
if the system has its own version of limits.h. */
|
||||
|
||||
/* We use _GCC_LIMITS_H_ because we want this not to match
|
||||
any macros that the system's limits.h uses for its own purposes. */
|
||||
#ifndef _GCC_LIMITS_H_ /* Terminated in limity.h. */
|
||||
#define _GCC_LIMITS_H_
|
||||
|
||||
#ifndef _LIBC_LIMITS_H_
|
||||
/* Use "..." so that we find syslimits.h only in this same directory. */
|
||||
#include "syslimits.h"
|
||||
#endif
|
||||
#ifndef _LIMITS_H___
|
||||
#ifndef _MACH_MACHLIMITS_H_
|
||||
|
||||
/* _MACH_MACHLIMITS_H_ is used on OSF/1. */
|
||||
#define _LIMITS_H___
|
||||
#define _MACH_MACHLIMITS_H_
|
||||
|
||||
/* Number of bits in a `char'. */
|
||||
#undef CHAR_BIT
|
||||
#define CHAR_BIT 8
|
||||
|
||||
/* Maximum length of a multibyte character. */
|
||||
#ifndef MB_LEN_MAX
|
||||
#define MB_LEN_MAX 1
|
||||
#endif
|
||||
|
||||
/* Minimum and maximum values a `signed char' can hold. */
|
||||
#undef SCHAR_MIN
|
||||
#define SCHAR_MIN (-128)
|
||||
#undef SCHAR_MAX
|
||||
#define SCHAR_MAX 127
|
||||
|
||||
/* Maximum value an `unsigned char' can hold. (Minimum is 0). */
|
||||
#undef UCHAR_MAX
|
||||
#define UCHAR_MAX 255
|
||||
|
||||
/* Minimum and maximum values a `char' can hold. */
|
||||
#ifdef __CHAR_UNSIGNED__
|
||||
#undef CHAR_MIN
|
||||
#define CHAR_MIN 0
|
||||
#undef CHAR_MAX
|
||||
#define CHAR_MAX 255
|
||||
#else
|
||||
#undef CHAR_MIN
|
||||
#define CHAR_MIN (-128)
|
||||
#undef CHAR_MAX
|
||||
#define CHAR_MAX 127
|
||||
#endif
|
||||
|
||||
/* Minimum and maximum values a `signed short int' can hold. */
|
||||
#undef SHRT_MIN
|
||||
/* For the sake of 16 bit hosts, we may not use -32768 */
|
||||
#define SHRT_MIN (-32767-1)
|
||||
#undef SHRT_MAX
|
||||
#define SHRT_MAX 32767
|
||||
|
||||
/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */
|
||||
#undef USHRT_MAX
|
||||
#define USHRT_MAX 65535
|
||||
|
||||
/* Minimum and maximum values a `signed int' can hold. */
|
||||
#ifndef __INT_MAX__
|
||||
#define __INT_MAX__ 2147483647
|
||||
#endif
|
||||
#undef INT_MIN
|
||||
#define INT_MIN (-INT_MAX-1)
|
||||
#undef INT_MAX
|
||||
#define INT_MAX __INT_MAX__
|
||||
|
||||
/* Maximum value an `unsigned int' can hold. (Minimum is 0). */
|
||||
#undef UINT_MAX
|
||||
#define UINT_MAX (INT_MAX * 2U + 1)
|
||||
|
||||
/* Minimum and maximum values a `signed long int' can hold.
|
||||
(Same as `int'). */
|
||||
#ifndef __LONG_MAX__
|
||||
#if defined (__alpha__) || (defined (_ARCH_PPC) && defined (__64BIT__)) || defined (__sparc_v9__) || defined (__sparcv9)
|
||||
#define __LONG_MAX__ 9223372036854775807L
|
||||
#else
|
||||
#define __LONG_MAX__ 2147483647L
|
||||
#endif /* __alpha__ || sparc64 */
|
||||
#endif
|
||||
#undef LONG_MIN
|
||||
#define LONG_MIN (-LONG_MAX-1)
|
||||
#undef LONG_MAX
|
||||
#define LONG_MAX __LONG_MAX__
|
||||
|
||||
/* Maximum value an `unsigned long int' can hold. (Minimum is 0). */
|
||||
#undef ULONG_MAX
|
||||
#define ULONG_MAX (LONG_MAX * 2UL + 1)
|
||||
|
||||
#if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__)
|
||||
/* Minimum and maximum values a `signed long long int' can hold. */
|
||||
#ifndef __LONG_LONG_MAX__
|
||||
#define __LONG_LONG_MAX__ 9223372036854775807LL
|
||||
#endif
|
||||
#undef LONG_LONG_MIN
|
||||
#define LONG_LONG_MIN (-LONG_LONG_MAX-1)
|
||||
#undef LONG_LONG_MAX
|
||||
#define LONG_LONG_MAX __LONG_LONG_MAX__
|
||||
|
||||
/* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
|
||||
#undef ULONG_LONG_MAX
|
||||
#define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1)
|
||||
#endif
|
||||
|
||||
#endif /* _MACH_MACHLIMITS_H_ */
|
||||
#endif /* _LIMITS_H___ */
|
||||
/* This administrivia gets added to the end of limits.h
|
||||
if the system has its own version of limits.h. */
|
||||
|
||||
#else /* not _GCC_LIMITS_H_ */
|
||||
|
||||
#ifdef _GCC_NEXT_LIMITS_H
|
||||
#include_next <limits.h> /* recurse down to the real one */
|
||||
#endif
|
||||
|
||||
#endif /* not _GCC_LIMITS_H_ */
|
||||
@@ -0,0 +1,42 @@
|
||||
// The -*- C++ -*- dynamic memory management header.
|
||||
// Copyright (C) 1994, 96-97, 1998 Free Software Foundation
|
||||
|
||||
#ifndef __NEW__
|
||||
#define __NEW__
|
||||
|
||||
#pragma interface "new"
|
||||
#include <stddef.h>
|
||||
#include <exception>
|
||||
|
||||
extern "C++" {
|
||||
|
||||
namespace std {
|
||||
|
||||
class bad_alloc : public exception {
|
||||
public:
|
||||
virtual const char* what() const throw() { return "bad_alloc"; }
|
||||
};
|
||||
|
||||
struct nothrow_t {};
|
||||
extern const nothrow_t nothrow;
|
||||
typedef void (*new_handler)();
|
||||
new_handler set_new_handler (new_handler);
|
||||
|
||||
} // namespace std
|
||||
|
||||
// replaceable signatures
|
||||
void *operator new (size_t) throw (std::bad_alloc);
|
||||
void *operator new[] (size_t) throw (std::bad_alloc);
|
||||
void operator delete (void *) throw();
|
||||
void operator delete[] (void *) throw();
|
||||
void *operator new (size_t, const std::nothrow_t&) throw();
|
||||
void *operator new[] (size_t, const std::nothrow_t&) throw();
|
||||
void operator delete (void *, const std::nothrow_t&) throw();
|
||||
void operator delete[] (void *, const std::nothrow_t&) throw();
|
||||
|
||||
// default placement versions of operator new
|
||||
inline void *operator new(size_t, void *place) throw() { return place; }
|
||||
inline void *operator new[](size_t, void *place) throw() { return place; }
|
||||
} // extern "C++"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
// -*- C++ -*- forwarding header.
|
||||
|
||||
#ifndef __NEW_H__
|
||||
#define __NEW_H__
|
||||
|
||||
#include <new>
|
||||
|
||||
using std::new_handler;
|
||||
using std::set_new_handler;
|
||||
|
||||
#endif // __NEW_H__
|
||||
@@ -0,0 +1,4 @@
|
||||
/* This header file is to avoid trouble with semi-ANSI header files
|
||||
on the Convex in system version 8.0. */
|
||||
|
||||
#define _PROTO(list) ()
|
||||
@@ -0,0 +1,215 @@
|
||||
/* stdarg.h for GNU.
|
||||
Note that the type used in va_arg is supposed to match the
|
||||
actual type **after default promotions**.
|
||||
Thus, va_arg (..., short) is not valid. */
|
||||
|
||||
#ifndef _STDARG_H
|
||||
#ifndef _ANSI_STDARG_H_
|
||||
#ifndef __need___va_list
|
||||
#define _STDARG_H
|
||||
#define _ANSI_STDARG_H_
|
||||
#endif /* not __need___va_list */
|
||||
#undef __need___va_list
|
||||
|
||||
#ifdef __clipper__
|
||||
#include "va-clipper.h"
|
||||
#else
|
||||
#ifdef __m88k__
|
||||
#include "va-m88k.h"
|
||||
#else
|
||||
#ifdef __i860__
|
||||
#include "va-i860.h"
|
||||
#else
|
||||
#ifdef __hppa__
|
||||
#include "va-pa.h"
|
||||
#else
|
||||
#ifdef __mips__
|
||||
#include "va-mips.h"
|
||||
#else
|
||||
#ifdef __sparc__
|
||||
#include "va-sparc.h"
|
||||
#else
|
||||
#ifdef __i960__
|
||||
#include "va-i960.h"
|
||||
#else
|
||||
#ifdef __alpha__
|
||||
#include "va-alpha.h"
|
||||
#else
|
||||
#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__)
|
||||
#include "va-h8300.h"
|
||||
#else
|
||||
#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
|
||||
#if defined (_TMS320C4x) || defined (_TMS320C3x)
|
||||
#include <va-c4x.h>
|
||||
#else
|
||||
|
||||
/* Define __gnuc_va_list. */
|
||||
|
||||
#ifndef __GNUC_VA_LIST
|
||||
#define __GNUC_VA_LIST
|
||||
#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__) || defined(__BEOS__)
|
||||
typedef char *__gnuc_va_list;
|
||||
#else
|
||||
typedef void *__gnuc_va_list;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Define the standard macros for the user,
|
||||
if this invocation was from the user program. */
|
||||
#ifdef _STDARG_H
|
||||
|
||||
/* Amount of space required in an argument list for an arg of type TYPE.
|
||||
TYPE may alternatively be an expression whose type is used. */
|
||||
|
||||
#if defined(sysV68)
|
||||
#define __va_rounded_size(TYPE) \
|
||||
(((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
|
||||
#elif defined(_AIX)
|
||||
#define __va_rounded_size(TYPE) \
|
||||
(((sizeof (TYPE) + sizeof (long) - 1) / sizeof (long)) * sizeof (long))
|
||||
#else
|
||||
#define __va_rounded_size(TYPE) \
|
||||
(((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
|
||||
#endif
|
||||
|
||||
#define va_start(AP, LASTARG) \
|
||||
(AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
|
||||
|
||||
#undef va_end
|
||||
void va_end (__gnuc_va_list); /* Defined in libgcc.a */
|
||||
#define va_end(AP) ((void)0)
|
||||
|
||||
/* We cast to void * and then to TYPE * because this avoids
|
||||
a warning about increasing the alignment requirement. */
|
||||
|
||||
#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)), \
|
||||
*((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
|
||||
#else /* big-endian */
|
||||
/* This is for big-endian machines; small args are padded downward. */
|
||||
#define va_arg(AP, TYPE) \
|
||||
(AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
|
||||
*((TYPE *) (void *) ((char *) (AP) \
|
||||
- ((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 TMS320C3x or TMS320C4x */
|
||||
#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 */
|
||||
#endif /* not i960 */
|
||||
#endif /* not sparc */
|
||||
#endif /* not mips */
|
||||
#endif /* not hppa */
|
||||
#endif /* not i860 */
|
||||
#endif /* not m88k */
|
||||
#endif /* not clipper */
|
||||
|
||||
#ifdef _STDARG_H
|
||||
/* Define va_list, if desired, from __gnuc_va_list. */
|
||||
/* We deliberately do not define va_list when called from
|
||||
stdio.h, because ANSI C says that stdio.h is not supposed to define
|
||||
va_list. stdio.h needs to have access to that data type,
|
||||
but must not use that name. It should use the name __gnuc_va_list,
|
||||
which is safe because it is reserved for the implementation. */
|
||||
|
||||
#ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
|
||||
#undef _VA_LIST
|
||||
#endif
|
||||
|
||||
#ifdef _BSD_VA_LIST
|
||||
#undef _BSD_VA_LIST
|
||||
#endif
|
||||
|
||||
#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
|
||||
have no conflict with that. */
|
||||
#ifndef _VA_LIST_
|
||||
#define _VA_LIST_
|
||||
#ifdef __i860__
|
||||
#ifndef _VA_LIST
|
||||
#define _VA_LIST va_list
|
||||
#endif
|
||||
#endif /* __i860__ */
|
||||
typedef __gnuc_va_list va_list;
|
||||
#ifdef _SCO_DS
|
||||
#define __VA_LIST
|
||||
#endif
|
||||
#endif /* _VA_LIST_ */
|
||||
#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.
|
||||
(Note that the comments in NET 2's ansi.h
|
||||
are incorrect for _VA_LIST_--see stdio.h!) */
|
||||
#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
|
||||
/* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
|
||||
#ifndef _VA_LIST_DEFINED
|
||||
/* The macro _VA_LIST is used in SCO Unix 3.2. */
|
||||
#ifndef _VA_LIST
|
||||
/* The macro _VA_LIST_T_H is used in the Bull dpx2 */
|
||||
#ifndef _VA_LIST_T_H
|
||||
/* The macro __va_list__ is used by BeOS. */
|
||||
#ifndef __va_list__
|
||||
typedef __gnuc_va_list va_list;
|
||||
#endif /* not __va_list__ */
|
||||
#endif /* not _VA_LIST_T_H */
|
||||
#endif /* not _VA_LIST */
|
||||
#endif /* not _VA_LIST_DEFINED */
|
||||
#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
|
||||
#define _VA_LIST_
|
||||
#endif
|
||||
#ifndef _VA_LIST
|
||||
#define _VA_LIST
|
||||
#endif
|
||||
#ifndef _VA_LIST_DEFINED
|
||||
#define _VA_LIST_DEFINED
|
||||
#endif
|
||||
#ifndef _VA_LIST_T_H
|
||||
#define _VA_LIST_T_H
|
||||
#endif
|
||||
|
||||
#endif /* not _VA_LIST_, except on certain systems */
|
||||
|
||||
#endif /* not __svr4__ */
|
||||
|
||||
#endif /* _STDARG_H */
|
||||
|
||||
#endif /* not _ANSI_STDARG_H_ */
|
||||
#endif /* not _STDARG_H */
|
||||
@@ -0,0 +1,29 @@
|
||||
/* stdbool.h for GNU. */
|
||||
#ifndef __STDBOOL_H__
|
||||
#define __STDBOOL_H__ 1
|
||||
|
||||
#ifdef __BEOS__
|
||||
typedef unsigned char _Bool;
|
||||
#define bool _Bool
|
||||
#define false 0
|
||||
#define true 1
|
||||
#else
|
||||
|
||||
/* 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
|
||||
|
||||
#endif
|
||||
|
||||
/* Signal that all the definitions are present. */
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
#endif /* stdbool.h */
|
||||
@@ -0,0 +1,338 @@
|
||||
#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_wint_t))
|
||||
#define _STDDEF_H
|
||||
#define _STDDEF_H_
|
||||
/* [email protected] says the NeXT needs this. */
|
||||
#define _ANSI_STDDEF_H
|
||||
/* Irix 5.1 needs this. */
|
||||
#define __STDDEF_H__
|
||||
#endif
|
||||
|
||||
#ifndef __sys_stdtypes_h
|
||||
/* This avoids lossage on SunOS but only if stdtypes.h comes first.
|
||||
There's no way to win with the other order! Sun lossage. */
|
||||
|
||||
/* On 4.3bsd-net2, make sure ansi.h is included, so we have
|
||||
one less case to deal with in the following. */
|
||||
#if defined (__BSD_NET2__) || defined (____386BSD____) || defined (__FreeBSD__) || defined(__NetBSD__)
|
||||
#include <machine/ansi.h>
|
||||
#endif
|
||||
|
||||
/* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
|
||||
defined if the corresponding type is *not* defined.
|
||||
FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_ */
|
||||
#if defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_)
|
||||
#if !defined(_SIZE_T_) && !defined(_BSD_SIZE_T_)
|
||||
#define _SIZE_T
|
||||
#endif
|
||||
#if !defined(_PTRDIFF_T_) && !defined(_BSD_PTRDIFF_T_)
|
||||
#define _PTRDIFF_T
|
||||
#endif
|
||||
/* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
|
||||
instead of _WCHAR_T_. */
|
||||
#if !defined(_WCHAR_T_) && !defined(_BSD_WCHAR_T_)
|
||||
#ifndef _BSD_WCHAR_T_
|
||||
#define _WCHAR_T
|
||||
#endif
|
||||
#endif
|
||||
/* Undef _FOO_T_ if we are supposed to define foo_t. */
|
||||
#if defined (__need_ptrdiff_t) || defined (_STDDEF_H_)
|
||||
#undef _PTRDIFF_T_
|
||||
#undef _BSD_PTRDIFF_T_
|
||||
#endif
|
||||
#if defined (__need_size_t) || defined (_STDDEF_H_)
|
||||
#undef _SIZE_T_
|
||||
#undef _BSD_SIZE_T_
|
||||
#endif
|
||||
#if defined (__need_wchar_t) || defined (_STDDEF_H_)
|
||||
#undef _WCHAR_T_
|
||||
#undef _BSD_WCHAR_T_
|
||||
#endif
|
||||
#endif /* defined(_ANSI_H_) || defined(_MACHINE_ANSI_H_) */
|
||||
|
||||
/* Sequent's header files use _PTRDIFF_T_ in some conflicting way.
|
||||
Just ignore it. */
|
||||
#if defined (__sequent__) && defined (_PTRDIFF_T_)
|
||||
#undef _PTRDIFF_T_
|
||||
#endif
|
||||
|
||||
/* On VxWorks, <type/vxTypesBase.h> may have defined macros like
|
||||
_TYPE_size_t which will typedef size_t. fixincludes patched the
|
||||
vxTypesBase.h so that this macro is only defined if _GCC_SIZE_T is
|
||||
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_))
|
||||
_TYPE_ptrdiff_t;
|
||||
#undef _TYPE_ptrdiff_t
|
||||
#endif
|
||||
#if defined (_TYPE_size_t) && (defined (__need_size_t) || defined (_STDDEF_H_))
|
||||
_TYPE_size_t;
|
||||
#undef _TYPE_size_t
|
||||
#endif
|
||||
#if defined (_TYPE_wchar_t) && (defined (__need_wchar_t) || defined (_STDDEF_H_))
|
||||
_TYPE_wchar_t;
|
||||
#undef _TYPE_wchar_t
|
||||
#endif
|
||||
|
||||
/* In case nobody has defined these types, but we aren't running under
|
||||
GCC 2.00, make sure that __PTRDIFF_TYPE__, __SIZE__TYPE__, and
|
||||
__WCHAR_TYPE__ have reasonable values. This can happen if the
|
||||
parts of GCC is compiled by an older compiler, that actually
|
||||
include gstddef.h, such as collect2. */
|
||||
|
||||
/* Signed type of difference of two pointers. */
|
||||
|
||||
/* Define this type if we are doing the whole job,
|
||||
or if we want this type in particular. */
|
||||
#if defined (_STDDEF_H) || defined (__need_ptrdiff_t)
|
||||
#ifndef _PTRDIFF_T /* in case <sys/types.h> has defined it. */
|
||||
#ifndef _T_PTRDIFF_
|
||||
#ifndef _T_PTRDIFF
|
||||
#ifndef __PTRDIFF_T
|
||||
#ifndef _PTRDIFF_T_
|
||||
#ifndef _BSD_PTRDIFF_T_
|
||||
#ifndef ___int_ptrdiff_t_h
|
||||
#ifndef _GCC_PTRDIFF_T
|
||||
#define _PTRDIFF_T
|
||||
#define _T_PTRDIFF_
|
||||
#define _T_PTRDIFF
|
||||
#define __PTRDIFF_T
|
||||
#define _PTRDIFF_T_
|
||||
#define _BSD_PTRDIFF_T_
|
||||
#define ___int_ptrdiff_t_h
|
||||
#define _GCC_PTRDIFF_T
|
||||
#ifndef __PTRDIFF_TYPE__
|
||||
#define __PTRDIFF_TYPE__ long int
|
||||
#endif
|
||||
typedef __PTRDIFF_TYPE__ ptrdiff_t;
|
||||
#endif /* _GCC_PTRDIFF_T */
|
||||
#endif /* ___int_ptrdiff_t_h */
|
||||
#endif /* _BSD_PTRDIFF_T_ */
|
||||
#endif /* _PTRDIFF_T_ */
|
||||
#endif /* __PTRDIFF_T */
|
||||
#endif /* _T_PTRDIFF */
|
||||
#endif /* _T_PTRDIFF_ */
|
||||
#endif /* _PTRDIFF_T */
|
||||
|
||||
/* If this symbol has done its job, get rid of it. */
|
||||
#undef __need_ptrdiff_t
|
||||
|
||||
#endif /* _STDDEF_H or __need_ptrdiff_t. */
|
||||
|
||||
/* Unsigned type of `sizeof' something. */
|
||||
|
||||
/* 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_
|
||||
#ifndef _T_SIZE
|
||||
#ifndef __SIZE_T
|
||||
#ifndef _SIZE_T_
|
||||
#ifndef _BSD_SIZE_T_
|
||||
#ifndef _SIZE_T_DEFINED_
|
||||
#ifndef _SIZE_T_DEFINED
|
||||
#ifndef ___int_size_t_h
|
||||
#ifndef _GCC_SIZE_T
|
||||
#ifndef _SIZET_
|
||||
#ifndef __size_t
|
||||
#define __size_t__ /* BeOS */
|
||||
#define _SIZE_T
|
||||
#define _SYS_SIZE_T_H
|
||||
#define _T_SIZE_
|
||||
#define _T_SIZE
|
||||
#define __SIZE_T
|
||||
#define _SIZE_T_
|
||||
#define _BSD_SIZE_T_
|
||||
#define _SIZE_T_DEFINED_
|
||||
#define _SIZE_T_DEFINED
|
||||
#define ___int_size_t_h
|
||||
#define _GCC_SIZE_T
|
||||
#define _SIZET_
|
||||
#define __size_t
|
||||
#ifndef __SIZE_TYPE__
|
||||
#define __SIZE_TYPE__ long unsigned int
|
||||
#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_ */
|
||||
#endif /* _GCC_SIZE_T */
|
||||
#endif /* ___int_size_t_h */
|
||||
#endif /* _SIZE_T_DEFINED */
|
||||
#endif /* _SIZE_T_DEFINED_ */
|
||||
#endif /* _BSD_SIZE_T_ */
|
||||
#endif /* _SIZE_T_ */
|
||||
#endif /* __SIZE_T */
|
||||
#endif /* _T_SIZE */
|
||||
#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. */
|
||||
|
||||
|
||||
/* Wide character type.
|
||||
Locale-writers should change this as necessary to
|
||||
be big enough to hold unique values not between 0 and 127,
|
||||
and not (wchar_t) -1, for each defined multibyte character. */
|
||||
|
||||
/* 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
|
||||
#ifndef __WCHAR_T
|
||||
#ifndef _WCHAR_T_
|
||||
#ifndef _BSD_WCHAR_T_
|
||||
#ifndef _WCHAR_T_DEFINED_
|
||||
#ifndef _WCHAR_T_DEFINED
|
||||
#ifndef _WCHAR_T_H
|
||||
#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
|
||||
#define __WCHAR_T
|
||||
#define _WCHAR_T_
|
||||
#define _BSD_WCHAR_T_
|
||||
#define _WCHAR_T_DEFINED_
|
||||
#define _WCHAR_T_DEFINED
|
||||
#define _WCHAR_T_H
|
||||
#define ___int_wchar_t_h
|
||||
#define __INT_WCHAR_T_H
|
||||
#define _GCC_WCHAR_T
|
||||
|
||||
/* On BSD/386 1.1, at least, machine/ansi.h defines _BSD_WCHAR_T_
|
||||
instead of _WCHAR_T_, and _BSD_RUNE_T_ (which, unlike the other
|
||||
symbols in the _FOO_T_ family, stays defined even after its
|
||||
corresponding type is defined). If we define wchar_t, then we
|
||||
must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if
|
||||
we undef _WCHAR_T_, then we must also define rune_t, since
|
||||
headers like runetype.h assume that if machine/ansi.h is included,
|
||||
and _BSD_WCHAR_T_ is not defined, then rune_t is available.
|
||||
machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of
|
||||
the same type." */
|
||||
#ifdef _BSD_WCHAR_T_
|
||||
#undef _BSD_WCHAR_T_
|
||||
#ifdef _BSD_RUNE_T_
|
||||
#if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
|
||||
typedef _BSD_RUNE_T_ rune_t;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef __WCHAR_TYPE__
|
||||
#define __WCHAR_TYPE__ int
|
||||
#endif
|
||||
#ifndef __cplusplus
|
||||
typedef __WCHAR_TYPE__ wchar_t;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#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. */
|
||||
/* 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_
|
||||
#undef _PTRDIFF_T_
|
||||
#undef _BSD_PTRDIFF_T_
|
||||
#endif
|
||||
#ifdef _GCC_SIZE_T_
|
||||
#undef _SIZE_T_
|
||||
#undef _BSD_SIZE_T_
|
||||
#endif
|
||||
#ifdef _GCC_WCHAR_T_
|
||||
#undef _WCHAR_T_
|
||||
#undef _BSD_WCHAR_T_
|
||||
#endif
|
||||
/* The following ones are the real ones. */
|
||||
#ifdef _GCC_PTRDIFF_T
|
||||
#undef _PTRDIFF_T_
|
||||
#undef _BSD_PTRDIFF_T_
|
||||
#endif
|
||||
#ifdef _GCC_SIZE_T
|
||||
#undef _SIZE_T_
|
||||
#undef _BSD_SIZE_T_
|
||||
#endif
|
||||
#ifdef _GCC_WCHAR_T
|
||||
#undef _WCHAR_T_
|
||||
#undef _BSD_WCHAR_T_
|
||||
#endif
|
||||
#endif /* _ANSI_H_ || ( __bsdi__ && _MACHINE_ANSI_H_ ) */
|
||||
|
||||
#endif /* __sys_stdtypes_h */
|
||||
|
||||
/* A null pointer constant. */
|
||||
|
||||
#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
|
||||
|
||||
#ifdef _STDDEF_H
|
||||
|
||||
/* Offset of member MEMBER in a struct of type TYPE. */
|
||||
|
||||
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
|
||||
|
||||
#endif /* _STDDEF_H was defined this time */
|
||||
|
||||
#endif /* !_STDDEF_H && !_STDDEF_H_ && !_ANSI_STDDEF_H && !__STDDEF_H__
|
||||
|| __need_XXX was not defined before */
|
||||
@@ -0,0 +1,8 @@
|
||||
/* syslimits.h stands for the system's own limits.h file.
|
||||
If we can use it ok unmodified, then we install this text.
|
||||
If fixincludes fixes it, then the fixed version is installed
|
||||
instead of this text. */
|
||||
|
||||
#define _GCC_NEXT_LIMITS_H /* tell gcc's limits.h to recurse */
|
||||
#include_next <limits.h>
|
||||
#undef _GCC_NEXT_LIMITS_H
|
||||
@@ -0,0 +1,58 @@
|
||||
// RTTI support for -*- C++ -*-
|
||||
// Copyright (C) 1994, 95-97, 1998 Free Software Foundation
|
||||
|
||||
#ifndef __TYPEINFO__
|
||||
#define __TYPEINFO__
|
||||
|
||||
#pragma interface "typeinfo"
|
||||
|
||||
#include <exception>
|
||||
|
||||
extern "C++" {
|
||||
|
||||
namespace std {
|
||||
|
||||
class type_info {
|
||||
private:
|
||||
// assigning type_info is not supported. made private.
|
||||
type_info& operator= (const type_info&);
|
||||
type_info (const type_info&);
|
||||
|
||||
protected:
|
||||
explicit type_info (const char *n): _name (n) { }
|
||||
|
||||
const char *_name;
|
||||
|
||||
public:
|
||||
// destructor
|
||||
virtual ~type_info ();
|
||||
|
||||
bool before (const type_info& arg) const;
|
||||
const char* name () const
|
||||
{ return _name; }
|
||||
bool operator== (const type_info& arg) const;
|
||||
bool operator!= (const type_info& arg) const;
|
||||
};
|
||||
|
||||
inline bool type_info::
|
||||
operator!= (const type_info& arg) const
|
||||
{
|
||||
return !operator== (arg);
|
||||
}
|
||||
|
||||
class bad_cast : public exception {
|
||||
public:
|
||||
bad_cast() { }
|
||||
virtual ~bad_cast() { }
|
||||
};
|
||||
|
||||
class bad_typeid : public exception {
|
||||
public:
|
||||
bad_typeid () { }
|
||||
virtual ~bad_typeid () { }
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
|
||||
} // extern "C++"
|
||||
#endif
|
||||
@@ -0,0 +1,128 @@
|
||||
/* GNU C varargs and stdargs support for the DEC Alpha. */
|
||||
|
||||
/* Note: We must use the name __builtin_savregs. GCC attaches special
|
||||
significance to that name. In particular, regardless of where in a
|
||||
function __builtin_saveregs is called, GCC moves the call up to the
|
||||
very start of the function. */
|
||||
|
||||
/* Define __gnuc_va_list. */
|
||||
|
||||
#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
|
||||
|
||||
#endif /* __GNUC_VA_LIST */
|
||||
|
||||
/* If this is for internal libc use, don't define anything but
|
||||
__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 */
|
||||
|
||||
/* ANSI alternative. */
|
||||
|
||||
/* 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 */
|
||||
|
||||
#define va_end(__va) ((void) 0)
|
||||
|
||||
/* Values returned by __builtin_classify_type. */
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
/* Note that parameters are always aligned at least to a word boundary
|
||||
(when passed) regardless of what GCC's __alignof__ operator says. */
|
||||
|
||||
/* Avoid errors if compiling GCC v2 with GCC v1. */
|
||||
#if __GNUC__ == 1
|
||||
#define __extension__
|
||||
#endif
|
||||
|
||||
/* Get the size of a type in bytes, rounded up to an integral number
|
||||
of words. */
|
||||
|
||||
#define __va_tsize(__type) \
|
||||
(((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
|
||||
|
||||
/* Copy __gnuc_va_list into another variable of this type. */
|
||||
#define __va_copy(dest, src) (dest) = (src)
|
||||
|
||||
#endif /* __GNUC_VA_LIST_1 */
|
||||
@@ -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) */
|
||||
@@ -0,0 +1,34 @@
|
||||
/* GNU C varargs support for the TMS320C[34]x */
|
||||
|
||||
/* C[34]x arguments grow in weird ways (downwards) that the standard
|
||||
varargs stuff can't handle. */
|
||||
|
||||
#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 /* stdarg.h support */
|
||||
|
||||
#define va_start(AP,LASTARG) AP=(__gnuc_va_list) __builtin_next_arg (LASTARG)
|
||||
|
||||
#else /* varargs.h support */
|
||||
|
||||
#define __va_ellipsis ...
|
||||
#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 + 1)
|
||||
|
||||
#endif /* _STDARG_H */
|
||||
|
||||
#define va_end(AP) ((void) 0)
|
||||
#define va_arg(AP,TYPE) (AP = (__gnuc_va_list) ((char *) (AP) - sizeof(TYPE)), \
|
||||
*((TYPE *) ((char *) (AP))))
|
||||
|
||||
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
|
||||
@@ -0,0 +1,60 @@
|
||||
/* GNU C varargs and stdargs support for Clipper. */
|
||||
|
||||
/* Define __gnuc_va_list. */
|
||||
|
||||
#ifndef __GNUC_VA_LIST
|
||||
#define __GNUC_VA_LIST
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int __va_ap; /* pointer to stack args */
|
||||
void *__va_reg[4]; /* pointer to r0,f0,r1,f1 */
|
||||
int __va_num; /* number of args processed */
|
||||
} __gnuc_va_list;
|
||||
#endif /* not __GNUC_VA_LIST */
|
||||
|
||||
|
||||
#if defined (_STDARG_H) || defined (_VARARGS_H)
|
||||
typedef __gnuc_va_list va_list;
|
||||
#define __va_list __gnuc_va_list /* acc compatibility */
|
||||
|
||||
#define _VA_LIST
|
||||
#define _VA_LIST_
|
||||
#define _SYS_INT_STDARG_H /* acc compatibility */
|
||||
|
||||
/* Call __builtin_next_arg even though we aren't using its value, so that
|
||||
we can verify that LASTARG is correct. */
|
||||
#ifdef _STDARG_H
|
||||
#define va_start(AP,LASTARG) \
|
||||
(__builtin_next_arg (LASTARG), \
|
||||
(AP) = *(va_list *)__builtin_saveregs(), \
|
||||
(AP).__va_num = __builtin_args_info (0), \
|
||||
(AP).__va_ap += __builtin_args_info (1))
|
||||
#else
|
||||
#define va_alist __builtin_va_alist
|
||||
/* The ... causes current_function_varargs to be set in cc1. */
|
||||
#define va_dcl va_list __builtin_va_alist; ...
|
||||
#define va_start(AP) \
|
||||
((AP) = *(va_list *)__builtin_saveregs(), \
|
||||
(AP).__va_num = __builtin_args_info (0))
|
||||
#endif /* _STDARG_H */
|
||||
|
||||
/* round to alignment of `type' but keep a least integer alignment */
|
||||
#define __va_round(AP,TYPE) \
|
||||
((AP).__va_ap = ((AP).__va_ap + __alignof__ (TYPE) - 1 ) & \
|
||||
~(__alignof__ (TYPE) - 1), \
|
||||
((AP).__va_ap = ((AP).__va_ap + sizeof (int) - 1) & ~(sizeof (int) - 1)))
|
||||
|
||||
#define va_arg(AP, TYPE) \
|
||||
(*((AP).__va_num < 2 && __builtin_classify_type (* (TYPE *)0) < 12 \
|
||||
? (__builtin_classify_type (* (TYPE *)0) == 8 \
|
||||
? ((TYPE *)(AP).__va_reg[2 * (AP).__va_num++ + 1]) \
|
||||
: ((TYPE *)(AP).__va_reg[2 * (AP).__va_num++ ])) \
|
||||
: ((AP).__va_num++, __va_round (AP,TYPE), ((TYPE *)((AP).__va_ap))++)))
|
||||
|
||||
#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) */
|
||||
@@ -0,0 +1,56 @@
|
||||
/* stdarg/vararg support for the Hitachi h8/300 and h8/300h */
|
||||
|
||||
/* Define __gnuc_va_list. */
|
||||
|
||||
#ifndef __GNUC_VA_LIST
|
||||
#define __GNUC_VA_LIST
|
||||
typedef void *__gnuc_va_list;
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
|
||||
#ifdef __H8300__
|
||||
#define __va_rounded_size(TYPE) \
|
||||
(((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
|
||||
#else
|
||||
#define __va_rounded_size(TYPE) \
|
||||
(((sizeof (TYPE) + sizeof (long) - 1) / sizeof (long)) * sizeof (long))
|
||||
#endif
|
||||
|
||||
#ifdef _STDARG_H
|
||||
|
||||
#define va_start(AP,LASTARG) \
|
||||
(AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))
|
||||
|
||||
#else /* _VARARGS_H */
|
||||
|
||||
#define va_alist __builtin_va_alist
|
||||
/* The ... causes current_function_varargs to be set in cc1. */
|
||||
#define va_dcl int __builtin_va_alist; __va_ellipsis
|
||||
#define va_start(AP) AP = (void *) &__builtin_va_alist
|
||||
|
||||
#endif /* _VARARGS_H */
|
||||
|
||||
#define va_arg(AP, TYPE) \
|
||||
(AP = (__gnuc_va_list) ((char *) (AP) + __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) */
|
||||
@@ -0,0 +1,214 @@
|
||||
/* Note: We must use the name __builtin_savregs. GCC attaches special
|
||||
significance to that name. In particular, regardless of where in a
|
||||
function __builtin_saveregs is called, GCC moves the call up to the
|
||||
very start of the function. */
|
||||
|
||||
|
||||
/* Define __gnuc_va_list. */
|
||||
|
||||
#ifndef __GNUC_VA_LIST
|
||||
#define __GNUC_VA_LIST
|
||||
|
||||
typedef union {
|
||||
float __freg[8];
|
||||
double __dreg[4];
|
||||
} __f_regs;
|
||||
|
||||
typedef struct {
|
||||
#if defined (__SVR4__) || defined (__svr4__) || defined (__alliant__) || defined (__PARAGON__)
|
||||
__f_regs __float_regs; long __ireg[12];
|
||||
#else /* pre-SVR4 */
|
||||
long __ireg[12]; __f_regs __float_regs;
|
||||
#endif
|
||||
} __va_saved_regs;
|
||||
|
||||
typedef struct {
|
||||
#if defined(__SVR4__) || defined(__svr4__) || defined(__alliant__) || defined (__PARAGON__)
|
||||
unsigned __ireg_used; /* How many int regs consumed 'til now? */
|
||||
unsigned __freg_used; /* How many flt regs consumed 'til now? */
|
||||
long *__reg_base; /* Address of where we stored the regs. */
|
||||
long * __mem_ptr; /* Address of memory overflow args area. */
|
||||
#else /* pre-SVR4 */
|
||||
long *__reg_base; /* Address of where we stored the regs. */
|
||||
long * __mem_ptr; /* Address of memory overflow args area. */
|
||||
unsigned __ireg_used; /* How many int regs consumed 'til now? */
|
||||
unsigned __freg_used; /* How many flt regs consumed 'til now? */
|
||||
#endif
|
||||
} __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)
|
||||
|
||||
#if !defined(_STDARG_H)
|
||||
|
||||
/* varargs support */
|
||||
#define va_alist __builtin_va_alist
|
||||
#if defined (__PARAGON__)
|
||||
#define va_dcl int va_alist;
|
||||
#else /* __PARAGON__ */
|
||||
#define va_dcl
|
||||
#endif /* __PARAGON__ */
|
||||
#define va_start(pvar) ((pvar) = * (__gnuc_va_list *) __builtin_saveregs ())
|
||||
|
||||
#else /* STDARG.H */
|
||||
|
||||
/* ANSI alternative. */
|
||||
/* Note that CUMULATIVE_ARGS elements are measured in bytes on the i860,
|
||||
so we divide by 4 to get # of registers. */
|
||||
#define va_start(pvar, firstarg) \
|
||||
((pvar) = *(__gnuc_va_list *) __builtin_saveregs (), \
|
||||
(pvar).__ireg_used = __builtin_args_info (0) / 4, \
|
||||
(pvar).__freg_used = __builtin_args_info (1) / 4, \
|
||||
(pvar).__mem_ptr = __builtin_next_arg (firstarg))
|
||||
|
||||
#endif /* _STDARG_H */
|
||||
|
||||
/* Values returned by __builtin_classify_type. */
|
||||
|
||||
#ifndef va_end
|
||||
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
|
||||
};
|
||||
|
||||
void va_end (__gnuc_va_list); /* Defined in libgcc.a */
|
||||
#endif
|
||||
#define va_end(__va) ((void) 0)
|
||||
|
||||
#define __NUM_PARM_FREGS 8
|
||||
#define __NUM_PARM_IREGS 12
|
||||
|
||||
#define __savereg(__va) ((__va_saved_regs *) ((__va).__reg_base))
|
||||
|
||||
/* This macro works both for SVR4 and pre-SVR4 environments. */
|
||||
|
||||
/* Note that parameters are always aligned at least to a word boundary
|
||||
(when passed) regardless of what GCC's __alignof__ operator says. */
|
||||
|
||||
/* Make allowances here for adding 128-bit (long double) floats someday. */
|
||||
|
||||
#if 0 /* What was this for? */
|
||||
#ifndef __GNU_VA_LIST
|
||||
#define __ireg_used ireg_used
|
||||
#define __freg_used freg_used
|
||||
#define __mem_ptr mem_ptr
|
||||
#define __reg_base reg_base
|
||||
#endif
|
||||
#endif /* 0 */
|
||||
|
||||
/* Avoid errors if compiling GCC v2 with GCC v1. */
|
||||
#if __GNUC__ == 1
|
||||
#define __extension__
|
||||
#endif
|
||||
|
||||
#define va_arg(__va, __type) \
|
||||
__extension__ \
|
||||
(* (__type *) \
|
||||
({ \
|
||||
register void *__rv; /* result value */ \
|
||||
register unsigned __align; \
|
||||
switch (__builtin_classify_type (* (__type *) 0)) \
|
||||
{ \
|
||||
case __real_type_class: \
|
||||
switch (sizeof (__type)) \
|
||||
{ \
|
||||
case sizeof (float): \
|
||||
case sizeof (double): \
|
||||
if ((__va).__freg_used < __NUM_PARM_FREGS - 1) \
|
||||
{ \
|
||||
if (((__va).__freg_used & 1) != 0) \
|
||||
(__va).__freg_used++; /* skip odd */ \
|
||||
__rv = &__savereg((__va))->__float_regs.__freg[(__va).__freg_used];\
|
||||
(__va).__freg_used += 2; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if ((((unsigned) (__va).__mem_ptr) & (sizeof(double)-1)) != 0) \
|
||||
(__va).__mem_ptr++; /* skip odd */ \
|
||||
__rv = (__va).__mem_ptr; \
|
||||
(__va).__mem_ptr += 2; \
|
||||
} \
|
||||
if (sizeof (__type) == sizeof (float)) \
|
||||
{ \
|
||||
*((float *) __rv) = *((double *) __rv); \
|
||||
*(((long *) __rv) + 1) = 0xfff00001; \
|
||||
} \
|
||||
break; \
|
||||
default: \
|
||||
abort (); \
|
||||
} \
|
||||
break; \
|
||||
case __void_type_class: \
|
||||
case __integer_type_class: \
|
||||
case __char_type_class: \
|
||||
case __enumeral_type_class: \
|
||||
case __boolean_type_class: \
|
||||
case __pointer_type_class: \
|
||||
case __reference_type_class: \
|
||||
case __offset_type_class: \
|
||||
if (sizeof (__type) <= 4) \
|
||||
{ \
|
||||
__rv = ((__va).__ireg_used < __NUM_PARM_IREGS \
|
||||
? (&__savereg((__va))->__ireg[(__va).__ireg_used++]) \
|
||||
: (__va).__mem_ptr++); \
|
||||
break; \
|
||||
} \
|
||||
else if ((__va).__ireg_used + sizeof (__type) / 4 <= __NUM_PARM_IREGS) \
|
||||
{ \
|
||||
__rv = &__savereg((__va))->__ireg[(__va).__ireg_used]; \
|
||||
(__va).__ireg_used += sizeof (__type) / 4; \
|
||||
break; \
|
||||
} \
|
||||
/* Fall through to fetch from memory. */ \
|
||||
case __record_type_class: \
|
||||
case __union_type_class: \
|
||||
__align = (__alignof__ (__type) < sizeof (long) \
|
||||
? sizeof (long) \
|
||||
: __alignof__ (__type)); \
|
||||
(__va).__mem_ptr \
|
||||
= (long *) \
|
||||
((((unsigned) (__va).__mem_ptr) + (__align-1)) & ~(__align-1)); \
|
||||
__rv = (__va).__mem_ptr; \
|
||||
(__va).__mem_ptr \
|
||||
+= ((sizeof (__type) + sizeof (long) - 1) / sizeof (long)); \
|
||||
break; \
|
||||
case __complex_type_class: \
|
||||
case __function_type_class: \
|
||||
case __method_type_class: \
|
||||
case __array_type_class: \
|
||||
case __string_type_class: \
|
||||
case __set_type_class: \
|
||||
case __file_type_class: \
|
||||
case __lang_type_class: \
|
||||
case __no_type_class: \
|
||||
default: \
|
||||
abort (); \
|
||||
} \
|
||||
__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) */
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/* GNU C varargs support for the Intel 80960. */
|
||||
|
||||
/* Define __gnuc_va_list. */
|
||||
|
||||
#ifndef __GNUC_VA_LIST
|
||||
#define __GNUC_VA_LIST
|
||||
/* The first element is the address of the first argument.
|
||||
The second element is the number of bytes skipped past so far. */
|
||||
typedef unsigned __gnuc_va_list[2];
|
||||
#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
|
||||
|
||||
/* The stack size of the type t. */
|
||||
#define __vsiz(T) (((sizeof (T) + 3) / 4) * 4)
|
||||
/* The stack alignment of the type t. */
|
||||
#define __vali(T) (__alignof__ (T) >= 4 ? __alignof__ (T) : 4)
|
||||
/* The offset of the next stack argument after one of type t at offset i. */
|
||||
#define __vpad(I, T) ((((I) + __vali (T) - 1) / __vali (T)) \
|
||||
* __vali (T) + __vsiz (T))
|
||||
|
||||
/* Avoid errors if compiling GCC v2 with GCC v1. */
|
||||
#if __GNUC__ == 1
|
||||
#define __extension__
|
||||
#endif
|
||||
|
||||
#ifdef _STDARG_H
|
||||
/* Call __builtin_next_arg even though we aren't using its value, so that
|
||||
we can verify that firstarg is correct. */
|
||||
#define va_start(AP, LASTARG) \
|
||||
__extension__ \
|
||||
({ __builtin_next_arg (LASTARG); \
|
||||
__asm__ ("st g14,%0" : "=m" (*(AP))); \
|
||||
(AP)[1] = (__builtin_args_info (0) + __builtin_args_info (1)) * 4; })
|
||||
|
||||
#else
|
||||
|
||||
#define va_alist __builtin_va_alist
|
||||
#define va_dcl char *__builtin_va_alist; __va_ellipsis
|
||||
#define va_start(AP) \
|
||||
__extension__ \
|
||||
({ __asm__ ("st g14,%0" : "=m" (*(AP))); \
|
||||
(AP)[1] = (__builtin_args_info (0) + __builtin_args_info (1)) * 4; })
|
||||
#endif
|
||||
|
||||
/* We cast to void * and then to TYPE * because this avoids
|
||||
a warning about increasing the alignment requirement. */
|
||||
#define va_arg(AP, T) \
|
||||
( \
|
||||
( \
|
||||
((AP)[1] <= 48 && (__vpad ((AP)[1], T) > 48 || __vsiz (T) > 16)) \
|
||||
? ((AP)[1] = 48 + __vsiz (T)) \
|
||||
: ((AP)[1] = __vpad ((AP)[1], T)) \
|
||||
), \
|
||||
\
|
||||
*((T *) (void *) ((char *) *(AP) + (AP)[1] - __vsiz (T))) \
|
||||
)
|
||||
|
||||
#ifndef va_end
|
||||
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) */
|
||||
|
||||
@@ -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) */
|
||||
@@ -0,0 +1,87 @@
|
||||
/* GNU C varargs support for the Motorola 88100 */
|
||||
|
||||
/* Define __gnuc_va_list. */
|
||||
|
||||
#ifndef __GNUC_VA_LIST
|
||||
#define __GNUC_VA_LIST
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int __va_arg; /* argument number */
|
||||
int *__va_stk; /* start of args passed on stack */
|
||||
int *__va_reg; /* start of args passed in regs */
|
||||
} __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 /* stdarg.h support */
|
||||
|
||||
/* Call __builtin_next_arg even though we aren't using its value, so that
|
||||
we can verify that LASTARG is correct. */
|
||||
#if __GNUC__ > 1 /* GCC 2.0 and beyond */
|
||||
#define va_start(AP,LASTARG) \
|
||||
(__builtin_next_arg (LASTARG), \
|
||||
(AP) = *(__gnuc_va_list *)__builtin_saveregs())
|
||||
#else
|
||||
#define va_start(AP,LASTARG) \
|
||||
( (AP).__va_reg = (int *) __builtin_saveregs2(0), \
|
||||
(AP).__va_stk = (int *) __builtin_argptr(), \
|
||||
(AP).__va_arg = (int) (__builtin_argsize() + 3) / 4 )
|
||||
#endif
|
||||
|
||||
#else /* varargs.h support */
|
||||
|
||||
#if __GNUC__ > 1 /* GCC 2.0 and beyond */
|
||||
#define va_start(AP) ((AP) = *(__gnuc_va_list *)__builtin_saveregs())
|
||||
#else
|
||||
#define va_start(AP) \
|
||||
( (AP).__va_reg = (int *) __builtin_saveregs2(1), \
|
||||
(AP).__va_stk = (int *) __builtin_argptr(), \
|
||||
(AP).__va_arg = (int) (__builtin_argsize() - 4 + 3) / 4 )
|
||||
#endif
|
||||
#define va_alist __va_1st_arg
|
||||
#define va_dcl register int va_alist;...
|
||||
|
||||
#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
|
||||
#define _VA_LIST_
|
||||
#else
|
||||
/* Similarly, if this gets included first, do nothing in _int_varargs.h. */
|
||||
#define __INT_VARARGS_H
|
||||
#endif
|
||||
|
||||
#define __va_reg_p(TYPE) \
|
||||
(__builtin_classify_type(*(TYPE *)0) < 12 \
|
||||
? sizeof(TYPE) <= 8 : sizeof(TYPE) == 4 && __alignof__(TYPE) == 4)
|
||||
|
||||
#define __va_size(TYPE) ((sizeof(TYPE) + 3) >> 2)
|
||||
|
||||
/* We cast to void * and then to TYPE * because this avoids
|
||||
a warning about increasing the alignment requirement. */
|
||||
#define va_arg(AP,TYPE) \
|
||||
( (AP).__va_arg = (((AP).__va_arg + (1 << (__alignof__(TYPE) >> 3)) - 1) \
|
||||
& ~((1 << (__alignof__(TYPE) >> 3)) - 1)) \
|
||||
+ __va_size(TYPE), \
|
||||
*((TYPE *) (void *) ((__va_reg_p(TYPE) \
|
||||
&& (AP).__va_arg < 8 + __va_size(TYPE) \
|
||||
? (AP).__va_reg : (AP).__va_stk) \
|
||||
+ ((AP).__va_arg - __va_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) */
|
||||
@@ -0,0 +1,277 @@
|
||||
/* ---------------------------------------- */
|
||||
/* VARARGS for MIPS/GNU CC */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* ---------------------------------------- */
|
||||
|
||||
|
||||
/* These macros implement varargs for GNU C--either traditional or ANSI. */
|
||||
|
||||
/* Define __gnuc_va_list. */
|
||||
|
||||
#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. */
|
||||
|
||||
#if __GNUC__ > 1
|
||||
#define __va_ellipsis ...
|
||||
#else
|
||||
#define __va_ellipsis
|
||||
#endif
|
||||
|
||||
#ifdef __mips64
|
||||
#define __va_rounded_size(__TYPE) \
|
||||
(((sizeof (__TYPE) + 8 - 1) / 8) * 8)
|
||||
#else
|
||||
#define __va_rounded_size(__TYPE) \
|
||||
(((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))
|
||||
#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. */
|
||||
#define va_dcl long long int __builtin_va_alist; __va_ellipsis
|
||||
#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. */
|
||||
#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 /* ! _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
|
||||
32 bit calling convention left-aligns all parameters smaller than a word,
|
||||
whereas the __mips64 calling convention does not (and hence they are
|
||||
right aligned). */
|
||||
#ifdef __mips64
|
||||
#ifdef __MIPSEB__
|
||||
#define va_arg(__AP, __type) \
|
||||
((__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) \
|
||||
+ __va_rounded_size (__type))), \
|
||||
*(__type *) (void *) (__AP - __va_rounded_size (__type)))
|
||||
#endif
|
||||
|
||||
#else /* not __mips64 */
|
||||
|
||||
#ifdef __MIPSEB__
|
||||
/* For big-endian machines. */
|
||||
#define va_arg(__AP, __type) \
|
||||
((__AP = (char *) ((__alignof__ (__type) > 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 \
|
||||
? ((__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) */
|
||||
@@ -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 */
|
||||
@@ -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
|
||||
@@ -0,0 +1,52 @@
|
||||
|
||||
/* 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)
|
||||
#if __GNUC__ > 1
|
||||
#define __va_ellipsis ...
|
||||
#define __gnuc_va_start(AP) ((AP) = (va_list)__builtin_saveregs())
|
||||
#else
|
||||
#define va_alist __va_a__, __va_b__, __va_c__, __va_d__
|
||||
#define __va_ellipsis
|
||||
#define __gnuc_va_start(AP)\
|
||||
(AP) = (double *) &__va_a__, &__va_b__, &__va_c__, &__va_d__, \
|
||||
(AP) = (double *)((char *)(AP) + 4)
|
||||
#endif /* __GNUC__ > 1 */
|
||||
|
||||
/* Call __builtin_next_arg even though we aren't using its value, so that
|
||||
we can verify that LASTARG is correct. */
|
||||
#ifdef _STDARG_H
|
||||
#define va_start(AP,LASTARG) \
|
||||
(__builtin_next_arg (LASTARG), __gnuc_va_start (AP))
|
||||
#else
|
||||
/* The ... causes current_function_varargs to be set in cc1. */
|
||||
#define va_dcl long va_alist; __va_ellipsis
|
||||
#define va_start(AP) __gnuc_va_start (AP)
|
||||
#endif
|
||||
|
||||
#define va_arg(AP,TYPE) \
|
||||
(*(sizeof(TYPE) > 8 ? \
|
||||
((AP = (__gnuc_va_list) ((char *)AP - sizeof (int))), \
|
||||
(((TYPE *) (void *) (*((int *) (AP)))))) \
|
||||
:((AP = \
|
||||
(__gnuc_va_list) ((long)((char *)AP - sizeof (TYPE)) \
|
||||
& (sizeof(TYPE) > 4 ? ~0x7 : ~0x3))), \
|
||||
(((TYPE *) (void *) ((char *)AP + ((8 - sizeof(TYPE)) % 4)))))))
|
||||
|
||||
#ifndef va_end
|
||||
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) */
|
||||
@@ -0,0 +1,255 @@
|
||||
/* 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 __va_list_tag {
|
||||
unsigned 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. */
|
||||
unsigned char fpr; /* index into the array of 8 FPRs stored in the
|
||||
register save area fpr=0 corresponds to f1,
|
||||
fpr=1 to f2, etc. */
|
||||
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 */
|
||||
} __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
|
||||
__gnuc_va_list. */
|
||||
#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 */
|
||||
} __va_regsave_t;
|
||||
|
||||
/* Macros to access the register save area */
|
||||
/* We cast to void * and then to TYPE * because this avoids
|
||||
a warning about increasing the alignment requirement. */
|
||||
#define __VA_FP_REGSAVE(AP,OFS,TYPE) \
|
||||
((TYPE *) (void *) (&(((__va_regsave_t *) \
|
||||
(AP)->reg_save_area)->__fp_save[OFS])))
|
||||
|
||||
#define __VA_GP_REGSAVE(AP,OFS,TYPE) \
|
||||
((TYPE *) (void *) (&(((__va_regsave_t *) \
|
||||
(AP)->reg_save_area)->__gp_save[OFS])))
|
||||
|
||||
/* Common code for va_start for both varargs and stdarg. We allow all
|
||||
the work to be done by __builtin_saveregs. It returns a pointer to
|
||||
a va_list that was constructed on the stack; we must simply copy it
|
||||
to the user's variable. */
|
||||
|
||||
#define __va_start_common(AP, FAKE) \
|
||||
__builtin_memcpy ((AP), __builtin_saveregs (), sizeof(__gnuc_va_list))
|
||||
|
||||
#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_next_arg (LASTARG), __va_start_common (AP, 0))
|
||||
|
||||
#else /* varargs.h support */
|
||||
|
||||
#define va_start(AP) __va_start_common (AP, 1)
|
||||
#define va_alist __va_1st_arg
|
||||
#define va_dcl register int va_alist; ...
|
||||
|
||||
#endif /* _STDARG_H */
|
||||
|
||||
#ifdef _SOFT_FLOAT
|
||||
#define __va_float_p(TYPE) 0
|
||||
#else
|
||||
#define __va_float_p(TYPE) (__builtin_classify_type(*(TYPE *)0) == 8)
|
||||
#endif
|
||||
|
||||
#define __va_aggregate_p(TYPE) (__builtin_classify_type(*(TYPE *)0) >= 12)
|
||||
#define __va_size(TYPE) ((sizeof(TYPE) + sizeof (long) - 1) / sizeof (long))
|
||||
|
||||
/* This symbol isn't defined. It is used to flag type promotion violations
|
||||
at link time. We can only do this when optimizing. Use __builtin_trap
|
||||
instead of abort so that we don't require a prototype for abort.
|
||||
|
||||
__builtin_trap stuff is not available on the gcc-2.95 branch, so we just
|
||||
avoid calling it for now. */
|
||||
|
||||
#ifdef __OPTIMIZE__
|
||||
extern void __va_arg_type_violation(void) __attribute__((__noreturn__));
|
||||
#else
|
||||
#define __va_arg_type_violation()
|
||||
#endif
|
||||
|
||||
#define va_arg(AP,TYPE) \
|
||||
__extension__ (*({ \
|
||||
register TYPE *__ptr; \
|
||||
\
|
||||
if (__va_float_p (TYPE) && sizeof (TYPE) < 16) \
|
||||
{ \
|
||||
unsigned char __fpr = (AP)->fpr; \
|
||||
if (__fpr < 8) \
|
||||
{ \
|
||||
__ptr = __VA_FP_REGSAVE (AP, __fpr, TYPE); \
|
||||
(AP)->fpr = __fpr + 1; \
|
||||
} \
|
||||
else if (sizeof (TYPE) == 8) \
|
||||
{ \
|
||||
unsigned long __addr = (unsigned long) (__va_overflow (AP)); \
|
||||
__ptr = (TYPE *)((__addr + 7) & -8); \
|
||||
__va_overflow (AP) = (char *)(__ptr + 1); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
/* float is promoted to double. */ \
|
||||
__va_arg_type_violation (); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
/* Aggregates and long doubles are passed by reference. */ \
|
||||
else if (__va_aggregate_p (TYPE) || __va_float_p (TYPE)) \
|
||||
{ \
|
||||
unsigned char __gpr = (AP)->gpr; \
|
||||
if (__gpr < 8) \
|
||||
{ \
|
||||
__ptr = * __VA_GP_REGSAVE (AP, __gpr, TYPE *); \
|
||||
(AP)->gpr = __gpr + 1; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
TYPE **__pptr = (TYPE **) (__va_overflow (AP)); \
|
||||
__ptr = * __pptr; \
|
||||
__va_overflow (AP) = (char *) (__pptr + 1); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
/* Only integrals remaining. */ \
|
||||
else \
|
||||
{ \
|
||||
/* longlong is aligned. */ \
|
||||
if (sizeof (TYPE) == 8) \
|
||||
{ \
|
||||
unsigned char __gpr = (AP)->gpr; \
|
||||
if (__gpr < 7) \
|
||||
{ \
|
||||
__gpr += __gpr & 1; \
|
||||
__ptr = __VA_GP_REGSAVE (AP, __gpr, TYPE); \
|
||||
(AP)->gpr = __gpr + 2; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
unsigned long __addr = (unsigned long) (__va_overflow (AP)); \
|
||||
__ptr = (TYPE *)((__addr + 7) & -8); \
|
||||
(AP)->gpr = 8; \
|
||||
__va_overflow (AP) = (char *)(__ptr + 1); \
|
||||
} \
|
||||
} \
|
||||
else if (sizeof (TYPE) == 4) \
|
||||
{ \
|
||||
unsigned char __gpr = (AP)->gpr; \
|
||||
if (__gpr < 8) \
|
||||
{ \
|
||||
__ptr = __VA_GP_REGSAVE (AP, __gpr, TYPE); \
|
||||
(AP)->gpr = __gpr + 1; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
__ptr = (TYPE *) __va_overflow (AP); \
|
||||
__va_overflow (AP) = (char *)(__ptr + 1); \
|
||||
} \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
/* Everything else was promoted to int. */ \
|
||||
__va_arg_type_violation (); \
|
||||
} \
|
||||
} \
|
||||
__ptr; \
|
||||
}))
|
||||
|
||||
#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 */
|
||||
@@ -0,0 +1,130 @@
|
||||
/**
|
||||
*
|
||||
* Varargs for PYR/GNU CC
|
||||
*
|
||||
* WARNING -- WARNING -- DANGER
|
||||
*
|
||||
* The code in this file implements varargs for gcc on a pyr in
|
||||
* a way that is compatible with code compiled by the Pyramid Technology
|
||||
* C compiler.
|
||||
* As such, it depends strongly on the Pyramid conventions for
|
||||
* parameter passing.ct and independent implementation.
|
||||
* These (somewhat bizarre) parameter-passing conventions are described
|
||||
* in the ``OSx Operating System Porting Guide''.
|
||||
*
|
||||
* A quick summary is useful:
|
||||
* 12 of the 48 register-windowed regs available for
|
||||
* parameter passing. Parameters of a function call that are eligible
|
||||
* to be passed in registers are assigned registers from TR0/PR0 onwards;
|
||||
* all other arguments are passed on the stack.
|
||||
* Structure and union parameters are *never* passed in registers,
|
||||
* even if they are small enough to fit. They are always passed on
|
||||
* the stack.
|
||||
*
|
||||
* Double-sized parameters cannot be passed in TR11, because
|
||||
* TR12 is not used for passing parameters. If, in the absence of this
|
||||
* rule, a double-sized param would have been passed in TR11,
|
||||
* that parameter is passed on the stack and no parameters are
|
||||
* passed in TR11.
|
||||
*
|
||||
* It is only known to work for passing 32-bit integer quantities
|
||||
* (ie chars, shorts, ints/enums, longs), doubles, or pointers.
|
||||
* Passing structures on a Pyramid via varargs is a loser.
|
||||
* Passing an object larger than 8 bytes on a pyramid via varargs may
|
||||
* also be a loser.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* pointer to next stack parameter in __va_buf[0]
|
||||
* pointer to next parameter register in __va_buf[1]
|
||||
* Count of registers seen at __va_buf[2]
|
||||
* saved pr0..pr11 in __va_buf[3..14]
|
||||
* # of calls to va_arg (debugging) at __va_buf[15]
|
||||
*/
|
||||
|
||||
/* Define __gnuc_va_list. */
|
||||
|
||||
#ifndef __GNUC_VA_LIST
|
||||
#define __GNUC_VA_LIST
|
||||
|
||||
typedef void *__voidptr;
|
||||
#if 1
|
||||
|
||||
typedef struct __va_regs {
|
||||
__voidptr __stackp,__regp,__count;
|
||||
__voidptr __pr0,__pr1,__pr2,__pr3,__pr4,__pr5,__pr6,__pr7,__pr8,__pr9,__pr10,__pr11;
|
||||
} __va_regs;
|
||||
|
||||
typedef __va_regs __va_buf;
|
||||
#else
|
||||
|
||||
/* __va_buf[0] = address of next arg passed on the stack
|
||||
__va_buf[1] = address of next arg passed in a register
|
||||
__va_buf[2] = register-# of next arg passed in a register
|
||||
*/
|
||||
typedef __voidptr(*__va_buf);
|
||||
|
||||
#endif
|
||||
|
||||
typedef __va_buf __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
|
||||
|
||||
#define va_alist \
|
||||
__va0,__va1,__va2,__va3,__va4,__va5,__va6,__va7,__va8,__va9,__va10,__va11, \
|
||||
__builtin_va_alist
|
||||
|
||||
/* The ... causes current_function_varargs to be set in cc1. */
|
||||
#define va_dcl __voidptr va_alist; __va_ellipsis
|
||||
|
||||
|
||||
/* __asm ("rcsp %0" : "=r" ( _AP [0]));*/
|
||||
|
||||
#define va_start(_AP) \
|
||||
_AP = ((struct __va_regs) { \
|
||||
&(_AP.__pr0), (void*)&__builtin_va_alist, (void*)0, \
|
||||
__va0,__va1,__va2,__va3,__va4,__va5, \
|
||||
__va6,__va7,__va8,__va9,__va10,__va11})
|
||||
|
||||
|
||||
/* Avoid errors if compiling GCC v2 with GCC v1. */
|
||||
#if __GNUC__ == 1
|
||||
#define __extension__
|
||||
#endif
|
||||
|
||||
/* We cast to void * and then to TYPE * because this avoids
|
||||
a warning about increasing the alignment requirement. */
|
||||
#define va_arg(_AP, _MODE) \
|
||||
__extension__ \
|
||||
(*({__voidptr *__ap = (__voidptr*)&_AP; \
|
||||
register int __size = sizeof (_MODE); \
|
||||
register int __onstack = \
|
||||
(__size > 8 || ( (int)(__ap[2]) > 11) || \
|
||||
(__size==8 && (int)(__ap[2])==11)); \
|
||||
register int* __param_addr = ((int*)((__ap) [__onstack])); \
|
||||
\
|
||||
((void *)__ap[__onstack])+=__size; \
|
||||
if (__onstack==0 || (int)(__ap[2])==11) \
|
||||
__ap[2]+= (__size >> 2); \
|
||||
(( _MODE *) (void *) __param_addr); \
|
||||
}))
|
||||
|
||||
void va_end (__gnuc_va_list); /* Defined in libgcc.a */
|
||||
#define va_end(_X) ((void)0)
|
||||
|
||||
#endif /* defined (_STDARG_H) || defined (_VARARGS_H) */
|
||||
@@ -0,0 +1,229 @@
|
||||
/* The ! __SH3E_VARG case is similar to the default gvarargs.h . */
|
||||
|
||||
#if (defined (__SH3E__) || defined (__SH4_SINGLE__) || defined (__SH4__) || defined (__SH4_SINGLE_ONLY__)) && ! defined (__HITACHI__)
|
||||
#define __SH3E_VARG
|
||||
#endif
|
||||
|
||||
/* Define __gnuc_va_list. */
|
||||
|
||||
#ifndef __GNUC_VA_LIST
|
||||
#define __GNUC_VA_LIST
|
||||
|
||||
#ifdef __SH3E_VARG
|
||||
|
||||
typedef long __va_greg;
|
||||
typedef float __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_VARG
|
||||
|
||||
#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_VARG
|
||||
|
||||
#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. */
|
||||
|
||||
/* gcc has an extension that allows to use a casted lvalue as an lvalue,
|
||||
But it doesn't work in C++ with -pedantic - even in the presence of
|
||||
__extension__ . We work around this problem by using a reference type. */
|
||||
#ifdef __cplusplus
|
||||
#define __VA_REF &
|
||||
#else
|
||||
#define __VA_REF
|
||||
#endif
|
||||
|
||||
#define __va_arg_sh1(AP, TYPE) __extension__ \
|
||||
({(sizeof (TYPE) == 1 \
|
||||
? ({union {TYPE t; char c;} __t; \
|
||||
__asm("" \
|
||||
: "=r" (__t.c) \
|
||||
: "0" ((((union { int i, j; } *__VA_REF) (AP))++)->i)); \
|
||||
__t.t;}) \
|
||||
: sizeof (TYPE) == 2 \
|
||||
? ({union {TYPE t; short s;} __t; \
|
||||
__asm("" \
|
||||
: "=r" (__t.s) \
|
||||
: "0" ((((union { int i, j; } *__VA_REF) (AP))++)->i)); \
|
||||
__t.t;}) \
|
||||
: sizeof (TYPE) >= 4 || __LITTLE_ENDIAN_P \
|
||||
? (((union { TYPE t; int i;} *__VA_REF) (AP))++)->t \
|
||||
: ((union {TYPE t;TYPE u;}*) ((char *)++(int *__VA_REF)(AP) - sizeof (TYPE)))->t);})
|
||||
|
||||
#ifdef __SH3E_VARG
|
||||
|
||||
#define __PASS_AS_FLOAT(TYPE_CLASS,SIZE) \
|
||||
(TYPE_CLASS == __real_type_class && SIZE == 4)
|
||||
|
||||
#define __TARGET_SH4_P 0
|
||||
|
||||
#if defined(__SH4__) || defined(__SH4_SINGLE__)
|
||||
#undef __PASS_AS_FLOAT
|
||||
#define __PASS_AS_FLOAT(TYPE_CLASS,SIZE) \
|
||||
(TYPE_CLASS == __real_type_class && SIZE <= 8 \
|
||||
|| TYPE_CLASS == __complex_type_class && SIZE <= 16)
|
||||
#undef __TARGET_SH4_P
|
||||
#define __TARGET_SH4_P 1
|
||||
#endif
|
||||
|
||||
#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) \
|
||||
{ \
|
||||
if (((__type == __real_type_class && sizeof (TYPE) > 4)\
|
||||
|| sizeof (TYPE) > 8) \
|
||||
&& (((int) (pvar).__va_next_fp ^ (int) (pvar).__va_next_fp_limit)\
|
||||
& 4)) \
|
||||
(pvar).__va_next_fp++; \
|
||||
__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) \
|
||||
if (! __TARGET_SH4_P) \
|
||||
(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) */
|
||||
@@ -0,0 +1,165 @@
|
||||
/* 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
|
||||
#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;
|
||||
#else
|
||||
/* This has to be a void * to be compatible with Sun svr4.
|
||||
i.e., we have to pass a `va_list' to vsprintf. */
|
||||
typedef void * __gnuc_va_list;
|
||||
#endif
|
||||
#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
|
||||
|
||||
/* Call __builtin_next_arg even though we aren't using its value, so that
|
||||
we can verify that LASTARG is correct. */
|
||||
#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
|
||||
|
||||
#else
|
||||
|
||||
#define va_alist __builtin_va_alist
|
||||
#define va_dcl int __builtin_va_alist;...
|
||||
|
||||
#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))
|
||||
#endif
|
||||
|
||||
#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(pvar) ((void)0)
|
||||
|
||||
/* Avoid errors if compiling GCC v2 with GCC v1. */
|
||||
#if __GNUC__ == 1
|
||||
#define __extension__
|
||||
#endif
|
||||
|
||||
/* 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. */
|
||||
|
||||
#ifdef __arch64__
|
||||
|
||||
typedef unsigned int __ptrint __attribute__ ((__mode__ (__DI__)));
|
||||
|
||||
/* ??? TODO: little endian support */
|
||||
|
||||
#define va_arg(pvar, TYPE) \
|
||||
__extension__ \
|
||||
(*({int __type = __builtin_classify_type (* (TYPE *) 0); \
|
||||
char * __result; \
|
||||
if (__type == __real_type_class) /* float? */ \
|
||||
{ \
|
||||
if (__alignof__ (TYPE) == 16) \
|
||||
(pvar) = (void *) (((__ptrint) (pvar) + 15) & -16); \
|
||||
__result = (pvar); \
|
||||
(pvar) = (char *) (pvar) + sizeof (TYPE); \
|
||||
} \
|
||||
else if (__type < __record_type_class) /* integer? */ \
|
||||
{ \
|
||||
(pvar) = (char *) (pvar) + 8; \
|
||||
__result = (char *) (pvar) - sizeof (TYPE); \
|
||||
} \
|
||||
else /* aggregate object */ \
|
||||
{ \
|
||||
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 \
|
||||
{ \
|
||||
__result = * (void **) (pvar); \
|
||||
(pvar) = (char *) (pvar) + 8; \
|
||||
} \
|
||||
} \
|
||||
(TYPE *) __result;}))
|
||||
|
||||
#else /* not __arch64__ */
|
||||
|
||||
#define __va_rounded_size(TYPE) \
|
||||
(((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
|
||||
|
||||
/* We don't declare the union member `d' to have type TYPE
|
||||
because that would lose in C++ if TYPE has a constructor. */
|
||||
/* 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_arg(pvar,TYPE) \
|
||||
__extension__ \
|
||||
(*({((__builtin_classify_type (*(TYPE*) 0) >= __record_type_class \
|
||||
|| (__builtin_classify_type (*(TYPE*) 0) == __real_type_class \
|
||||
&& sizeof (TYPE) == 16)) \
|
||||
? ((pvar) = (char *)(pvar) + __va_rounded_size (TYPE *), \
|
||||
*(TYPE **) (void *) ((char *)(pvar) - __va_rounded_size (TYPE *))) \
|
||||
: __va_rounded_size (TYPE) == 8 \
|
||||
? ({ union {char __d[sizeof (TYPE)]; int __i[2];} __u; \
|
||||
__u.__i[0] = ((int *) (void *) (pvar))[0]; \
|
||||
__u.__i[1] = ((int *) (void *) (pvar))[1]; \
|
||||
(pvar) = (char *)(pvar) + 8; \
|
||||
(TYPE *) (void *) __u.__d; }) \
|
||||
: ((pvar) = (char *)(pvar) + __va_rounded_size (TYPE), \
|
||||
((TYPE *) (void *) ((char *)(pvar) - __va_rounded_size (TYPE)))));}))
|
||||
|
||||
#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) */
|
||||
@@ -0,0 +1,64 @@
|
||||
/* varargs.h for SPUR */
|
||||
|
||||
/* NB. This is NOT the definition needed for the new ANSI proposed
|
||||
standard */
|
||||
|
||||
|
||||
struct __va_struct { char __regs[20]; };
|
||||
|
||||
#define va_alist __va_regs, __va_stack
|
||||
|
||||
/* 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
|
||||
|
||||
/* The ... causes current_function_varargs to be set in cc1. */
|
||||
#define va_dcl struct __va_struct __va_regs; int __va_stack;
|
||||
|
||||
typedef struct {
|
||||
int __pnt;
|
||||
char *__regs;
|
||||
char *__stack;
|
||||
} va_list;
|
||||
|
||||
#define va_start(pvar) \
|
||||
((pvar).__pnt = 0, (pvar).__regs = __va_regs.__regs, \
|
||||
(pvar).__stack = (char *) &__va_stack)
|
||||
#define va_end(pvar) ((void)0)
|
||||
|
||||
/* Avoid errors if compiling GCC v2 with GCC v1. */
|
||||
#if __GNUC__ == 1
|
||||
#define __extension__
|
||||
#endif
|
||||
|
||||
#define va_arg(pvar,type) \
|
||||
__extension__ \
|
||||
(*({ type *__va_result; \
|
||||
if ((pvar).__pnt >= 20) { \
|
||||
__va_result = ( (type *) ((pvar).__stack + (pvar).__pnt - 20)); \
|
||||
(pvar).__pnt += (sizeof(type) + 7) & ~7; \
|
||||
} \
|
||||
else if ((pvar).__pnt + sizeof(type) > 20) { \
|
||||
__va_result = (type *) (pvar).__stack; \
|
||||
(pvar).__pnt = 20 + ( (sizeof(type) + 7) & ~7); \
|
||||
} \
|
||||
else if (sizeof(type) == 8) { \
|
||||
union {double d; int i[2];} __u; \
|
||||
__u.i[0] = *(int *) ((pvar).__regs + (pvar).__pnt); \
|
||||
__u.i[1] = *(int *) ((pvar).__regs + (pvar).__pnt + 4); \
|
||||
__va_result = (type *) &__u; \
|
||||
(pvar).__pnt += 8; \
|
||||
} \
|
||||
else { \
|
||||
__va_result = (type *) ((pvar).__regs + (pvar).__pnt); \
|
||||
(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)
|
||||
@@ -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
|
||||
@@ -0,0 +1,232 @@
|
||||
/* Record that this is varargs.h; this turns off stdarg.h. */
|
||||
|
||||
#ifndef _VARARGS_H
|
||||
#define _VARARGS_H
|
||||
|
||||
#ifdef __sparc__
|
||||
#include "va-sparc.h"
|
||||
#else
|
||||
#ifdef __spur__
|
||||
#include "va-spur.h"
|
||||
#else
|
||||
#ifdef __mips__
|
||||
#include "va-mips.h"
|
||||
#else
|
||||
#ifdef __i860__
|
||||
#include "va-i860.h"
|
||||
#else
|
||||
#ifdef __pyr__
|
||||
#include "va-pyr.h"
|
||||
#else
|
||||
#ifdef __clipper__
|
||||
#include "va-clipper.h"
|
||||
#else
|
||||
#ifdef __m88k__
|
||||
#include "va-m88k.h"
|
||||
#else
|
||||
#if defined(__hppa__) || defined(hp800)
|
||||
#include "va-pa.h"
|
||||
#else
|
||||
#ifdef __i960__
|
||||
#include "va-i960.h"
|
||||
#else
|
||||
#ifdef __alpha__
|
||||
#include "va-alpha.h"
|
||||
#else
|
||||
#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__)
|
||||
#include "va-h8300.h"
|
||||
#else
|
||||
#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
|
||||
#if defined (_TMS320C4x) || defined (_TMS320C3x)
|
||||
#include <va-c4x.h>
|
||||
#else
|
||||
|
||||
#ifdef __NeXT__
|
||||
|
||||
/* On Next, erase any vestiges of stdarg.h. */
|
||||
|
||||
#ifdef _ANSI_STDARG_H_
|
||||
#define _VA_LIST_
|
||||
#endif
|
||||
#define _ANSI_STDARG_H_
|
||||
|
||||
#undef va_alist
|
||||
#undef va_dcl
|
||||
#undef va_list
|
||||
#undef va_start
|
||||
#undef va_end
|
||||
#undef __va_rounded_size
|
||||
#undef va_arg
|
||||
#endif /* __NeXT__ */
|
||||
|
||||
/* 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
|
||||
|
||||
/* These macros implement traditional (non-ANSI) varargs
|
||||
for GNU C. */
|
||||
|
||||
#define va_alist __builtin_va_alist
|
||||
/* The ... causes current_function_varargs to be set in cc1. */
|
||||
/* ??? We don't process attributes correctly in K&R argument context. */
|
||||
typedef int __builtin_va_alist_t __attribute__((__mode__(__word__)));
|
||||
#define va_dcl __builtin_va_alist_t __builtin_va_alist; __va_ellipsis
|
||||
|
||||
/* Define __gnuc_va_list, just as in gstdarg.h. */
|
||||
|
||||
#ifndef __GNUC_VA_LIST
|
||||
#define __GNUC_VA_LIST
|
||||
#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__BEOS__)
|
||||
typedef char *__gnuc_va_list;
|
||||
#else
|
||||
typedef void *__gnuc_va_list;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define va_start(AP) AP=(char *) &__builtin_va_alist
|
||||
|
||||
#define va_end(AP) ((void)0)
|
||||
|
||||
#if defined(sysV68)
|
||||
#define __va_rounded_size(TYPE) \
|
||||
(((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
|
||||
#elif defined(_AIX)
|
||||
#define __va_rounded_size(TYPE) \
|
||||
(((sizeof (TYPE) + sizeof (long) - 1) / sizeof (long)) * sizeof (long))
|
||||
#else
|
||||
#define __va_rounded_size(TYPE) \
|
||||
(((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
|
||||
#endif
|
||||
|
||||
#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)), \
|
||||
*((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
|
||||
#else /* big-endian */
|
||||
/* This is for big-endian machines; small args are padded downward. */
|
||||
#define va_arg(AP, TYPE) \
|
||||
(AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)), \
|
||||
*((TYPE *) (void *) ((char *) (AP) \
|
||||
- ((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 /* not TMS320C3x or TMS320C4x */
|
||||
#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 */
|
||||
#endif /* not i960 */
|
||||
#endif /* not hppa */
|
||||
#endif /* not m88k */
|
||||
#endif /* not clipper */
|
||||
#endif /* not pyr */
|
||||
#endif /* not i860 */
|
||||
#endif /* not mips */
|
||||
#endif /* not spur */
|
||||
#endif /* not sparc */
|
||||
#endif /* not _VARARGS_H */
|
||||
|
||||
/* Define va_list from __gnuc_va_list. */
|
||||
|
||||
#ifdef _HIDDEN_VA_LIST /* On OSF1, this means varargs.h is "half-loaded". */
|
||||
#undef _VA_LIST
|
||||
#endif
|
||||
|
||||
#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
|
||||
have no conflict with that. */
|
||||
#ifndef _VA_LIST_
|
||||
#define _VA_LIST_
|
||||
#ifdef __i860__
|
||||
#ifndef _VA_LIST
|
||||
#define _VA_LIST va_list
|
||||
#endif
|
||||
#endif /* __i860__ */
|
||||
typedef __gnuc_va_list va_list;
|
||||
#ifdef _SCO_DS
|
||||
#define __VA_LIST
|
||||
#endif
|
||||
#endif /* _VA_LIST_ */
|
||||
|
||||
#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.
|
||||
(Note that the comments in NET 2's ansi.h
|
||||
are incorrect for _VA_LIST_--see stdio.h!) */
|
||||
/* Michael Eriksson <[email protected]> at Thu Sep 30 11:00:57 1993:
|
||||
Sequent defines _VA_LIST_ in <machine/machtypes.h> to be the type to
|
||||
use for va_list (``typedef _VA_LIST_ va_list'') */
|
||||
#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
|
||||
/* The macro _VA_LIST_DEFINED is used in Windows NT 3.5 */
|
||||
#ifndef _VA_LIST_DEFINED
|
||||
/* The macro _VA_LIST is used in SCO Unix 3.2. */
|
||||
#ifndef _VA_LIST
|
||||
/* The macro _VA_LIST_T_H is used in the Bull dpx2 */
|
||||
#ifndef _VA_LIST_T_H
|
||||
/* The macro __va_list__ is used by BeOS. */
|
||||
#ifndef __va_list__
|
||||
typedef __gnuc_va_list va_list;
|
||||
#endif /* not __va_list__ */
|
||||
#endif /* not _VA_LIST_T_H */
|
||||
#endif /* not _VA_LIST */
|
||||
#endif /* not _VA_LIST_DEFINED */
|
||||
#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
|
||||
#define _VA_LIST_
|
||||
#endif
|
||||
#ifndef _VA_LIST
|
||||
#define _VA_LIST
|
||||
#endif
|
||||
#ifndef _VA_LIST_DEFINED
|
||||
#define _VA_LIST_DEFINED
|
||||
#endif
|
||||
#ifndef _VA_LIST_T_H
|
||||
#define _VA_LIST_T_H
|
||||
#endif
|
||||
|
||||
#endif /* not _VA_LIST_, except on certain systems */
|
||||
|
||||
#endif /* not __svr4__ */
|
||||
|
||||
/* The next BSD release (if there is one) wants this symbol to be
|
||||
undefined instead of _VA_LIST_. */
|
||||
#ifdef _BSD_VA_LIST
|
||||
#undef _BSD_VA_LIST
|
||||
#endif
|
||||
@@ -1,7 +1,13 @@
|
||||
/*
|
||||
* Copyright 2008, Haiku Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _SIZE_T_H_
|
||||
#define _SIZE_T_H_
|
||||
|
||||
typedef unsigned long size_t;
|
||||
typedef signed long ssize_t;
|
||||
#include <stddef.h>
|
||||
|
||||
// TODO: ATM gcc's stddef.h defines ssize_t for BeOS.h. We should fix this.
|
||||
//typedef long signed int ssize_t;
|
||||
|
||||
#endif /* _SIZE_T_H_ */
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
/*
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
/* GCC's stdarg.h defines _STDARG_H - and we intend to include
|
||||
* this header with the line below.
|
||||
* It contains the actual platform dependent varargs definitions.
|
||||
*/
|
||||
|
||||
#ifndef _STDARG_H
|
||||
# include_next <stdarg.h>
|
||||
#endif
|
||||
@@ -1,19 +0,0 @@
|
||||
#ifndef _STDDEF_H_
|
||||
#define _STDDEF_H_
|
||||
/*
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
#include <null.h>
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ > 3
|
||||
#define offsetof(type,member) __builtin_offsetof(type, member)
|
||||
#else
|
||||
#define offsetof(type,member) ((size_t)&((type*)0)->member)
|
||||
#endif
|
||||
|
||||
typedef long ptrdiff_t;
|
||||
|
||||
#include <wchar_t.h>
|
||||
#include <size_t.h>
|
||||
|
||||
#endif /* _STDDEF_H_ */
|
||||
@@ -10,6 +10,10 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
// Dodge gcc 2.95.3's fixincludes hack stdio_va_list by including this string:
|
||||
// __gnuc_va_list
|
||||
|
||||
|
||||
#define BUFSIZ 1024
|
||||
#define _IOFBF 0 /* fully buffered */
|
||||
#define _IOLBF 1 /* line buffered */
|
||||
|
||||
+13
-3
@@ -7,11 +7,22 @@
|
||||
#ifndef _WCHAR_H
|
||||
#define _WCHAR_H
|
||||
|
||||
#include <wchar_t.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// stddef.h is not supposed to define wint_t, but gcc 2.95.3's one does.
|
||||
// In all other cases we will do that.
|
||||
#ifndef _WINT_T
|
||||
#define _WINT_T
|
||||
typedef unsigned int wint_t;
|
||||
|
||||
#ifndef __WINT_TYPE__
|
||||
#define __WINT_TYPE__ unsigned int
|
||||
#endif
|
||||
|
||||
typedef __WINT_TYPE__ wint_t;
|
||||
|
||||
#endif // _WINT_T
|
||||
|
||||
typedef int wctype_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -19,7 +30,6 @@ typedef struct {
|
||||
wint_t __value;
|
||||
} mbstate_t;
|
||||
|
||||
#include <size_t.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
+4
-12
@@ -1,15 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2002 Marcus Overhagen
|
||||
* All rights reserved.
|
||||
*
|
||||
* Distributed under the terms of the MIT license
|
||||
* Copyright 2008, Haiku Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _WCHAR_T_H
|
||||
#define _WCHAR_T_H
|
||||
|
||||
#if !defined(__cplusplus) || __GNUC__ < 3
|
||||
typedef unsigned short wchar_t;
|
||||
#endif
|
||||
|
||||
#endif /* _WCHAR_T_H */
|
||||
|
||||
// Include GCC's stddef.h. It defines wchar_t.
|
||||
#include <stddef.h>
|
||||
|
||||
Reference in New Issue
Block a user