sync repo
This commit is contained in:
parent
5a54c79520
commit
2596ba135d
13 changed files with 249 additions and 332 deletions
|
@ -28,6 +28,8 @@
|
|||
const char * const target_machine_defs =
|
||||
"__i386__\0"
|
||||
"__i386\0"
|
||||
"i386\0"
|
||||
"_X86_\0"
|
||||
;
|
||||
|
||||
/* define to 1/0 to [not] have EBX as 4th register */
|
||||
|
|
|
@ -3534,6 +3534,7 @@ static const char * const target_os_defs =
|
|||
"__stupidos\0"
|
||||
"__unix__\0"
|
||||
"__unix\0"
|
||||
"unix\0"
|
||||
;
|
||||
|
||||
static void putdef(CString *cs, const char *p)
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
/* ---------------------------------------------- */
|
||||
/* This file implements for arm/arm64/riscv:
|
||||
* __atomic_compare_exchange_1
|
||||
* __atomic_compare_exchange_2
|
||||
* __atomic_compare_exchange_4
|
||||
* __atomic_compare_exchange_8
|
||||
*/
|
||||
|
||||
#ifdef __leading_underscore
|
||||
# define _(s) _##s
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/* uses alias to allow building with gcc/clang */
|
||||
#ifdef __TINYC__
|
||||
#define BUILTIN(x) __builtin_##x
|
||||
#define BUILTINN(x) "__builtin_" # x
|
||||
# define BUILTIN(x) __builtin_##x
|
||||
# define BUILTINN(x) "__builtin_" # x
|
||||
#else
|
||||
#define BUILTIN(x) __tcc_builtin_##x
|
||||
#define BUILTINN(x) "__tcc_builtin_" # x
|
||||
#endif
|
||||
# define BUILTIN(x) __tcc_builtin_##x
|
||||
# define BUILTINN(x) "__tcc_builtin_" # x
|
||||
#endif /* __TINYC__ */
|
||||
|
||||
/* ---------------------------------------------- */
|
||||
/* This file implements:
|
||||
|
@ -77,63 +77,38 @@ static const unsigned char table_2_64[] = {
|
|||
or if x is zero, returns zero. */
|
||||
int BUILTIN(ffs) (int x) { FFSI(x) }
|
||||
int BUILTIN(ffsll) (long long x) { FFSL(x) }
|
||||
#if __SIZEOF_LONG__ == 4
|
||||
int BUILTIN(ffsl) (long x) __attribute__((alias(BUILTINN(ffs))));
|
||||
#else
|
||||
int BUILTIN(ffsl) (long x) __attribute__((alias(BUILTINN(ffsll))));
|
||||
#endif
|
||||
|
||||
/* Returns the number of leading 0-bits in x, starting at the most significant
|
||||
bit position. If x is 0, the result is undefined. */
|
||||
int BUILTIN(clz) (unsigned int x) { CLZI(x) }
|
||||
int BUILTIN(clzll) (unsigned long long x) { CLZL(x) }
|
||||
#if __SIZEOF_LONG__ == 4
|
||||
int BUILTIN(clzl) (unsigned long x) __attribute__((alias(BUILTINN(clz))));
|
||||
#else
|
||||
int BUILTIN(clzl) (unsigned long x) __attribute__((alias(BUILTINN(clzll))));
|
||||
#endif
|
||||
|
||||
/* Returns the number of trailing 0-bits in x, starting at the least
|
||||
significant bit position. If x is 0, the result is undefined. */
|
||||
int BUILTIN(ctz) (unsigned int x) { CTZI(x) }
|
||||
int BUILTIN(ctzll) (unsigned long long x) { CTZL(x) }
|
||||
#if __SIZEOF_LONG__ == 4
|
||||
int BUILTIN(ctzl) (unsigned long x) __attribute__((alias(BUILTINN(ctz))));
|
||||
#else
|
||||
int BUILTIN(ctzl) (unsigned long x) __attribute__((alias(BUILTINN(ctzll))));
|
||||
#endif
|
||||
|
||||
/* Returns the number of leading redundant sign bits in x, i.e. the number
|
||||
of bits following the most significant bit that are identical to it.
|
||||
There are no special cases for 0 or other values. */
|
||||
int BUILTIN(clrsb) (int x) { if (x < 0) x = ~x; x <<= 1; CLZI(x) }
|
||||
int BUILTIN(clrsbll) (long long x) { if (x < 0) x = ~x; x <<= 1; CLZL(x) }
|
||||
#if __SIZEOF_LONG__ == 4
|
||||
int BUILTIN(clrsbl) (long x) __attribute__((alias(BUILTINN(clrsb))));
|
||||
#else
|
||||
int BUILTIN(clrsbl) (long x) __attribute__((alias(BUILTINN(clrsbll))));
|
||||
#endif
|
||||
|
||||
/* Returns the number of 1-bits in x.*/
|
||||
int BUILTIN(popcount) (unsigned int x) { POPCOUNTI(x, 0x3f) }
|
||||
int BUILTIN(popcountll) (unsigned long long x) { POPCOUNTL(x, 0x7f) }
|
||||
#if __SIZEOF_LONG__ == 4
|
||||
int BUILTIN(popcountl) (unsigned long x) __attribute__((alias(BUILTINN(popcount))));
|
||||
#else
|
||||
int BUILTIN(popcountl ) (unsigned long x) __attribute__((alias(BUILTINN(popcountll))));
|
||||
#endif
|
||||
|
||||
/* Returns the parity of x, i.e. the number of 1-bits in x modulo 2. */
|
||||
int BUILTIN(parity) (unsigned int x) { POPCOUNTI(x, 0x01) }
|
||||
int BUILTIN(parityll) (unsigned long long x) { POPCOUNTL(x, 0x01) }
|
||||
#if __SIZEOF_LONG__ == 4
|
||||
int BUILTIN(parityl) (unsigned long x) __attribute__((alias(BUILTINN(parity))));
|
||||
#else
|
||||
int BUILTIN(parityl) (unsigned long x) __attribute__((alias(BUILTINN(parityll))));
|
||||
#endif
|
||||
|
||||
#ifndef __TINYC__
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 6)
|
||||
# if defined(__GNUC__) && (__GNUC__ >= 6)
|
||||
/* gcc overrides alias from __builtin_ffs... to ffs.. so use assembly code */
|
||||
__asm__(".globl __builtin_ffs");
|
||||
__asm__(".set __builtin_ffs,__tcc_builtin_ffs");
|
||||
|
@ -141,11 +116,11 @@ __asm__(".globl __builtin_ffsl");
|
|||
__asm__(".set __builtin_ffsl,__tcc_builtin_ffsl");
|
||||
__asm__(".globl __builtin_ffsll");
|
||||
__asm__(".set __builtin_ffsll,__tcc_builtin_ffsll");
|
||||
#else
|
||||
# else
|
||||
int __builtin_ffs(int x) __attribute__((alias("__tcc_builtin_ffs")));
|
||||
int __builtin_ffsl(long x) __attribute__((alias("__tcc_builtin_ffsl")));
|
||||
int __builtin_ffsll(long long x) __attribute__((alias("__tcc_builtin_ffsll")));
|
||||
#endif
|
||||
# endif
|
||||
int __builtin_clz(unsigned int x) __attribute__((alias("__tcc_builtin_clz")));
|
||||
int __builtin_clzl(unsigned long x) __attribute__((alias("__tcc_builtin_clzl")));
|
||||
int __builtin_clzll(unsigned long long x) __attribute__((alias("__tcc_builtin_clzll")));
|
||||
|
|
|
@ -1,75 +1,41 @@
|
|||
#ifndef _FLOAT_H_
|
||||
#define _FLOAT_H_
|
||||
|
||||
#define FLT_RADIX 2
|
||||
# define FLT_RADIX 2
|
||||
|
||||
/* IEEE float */
|
||||
#define FLT_MANT_DIG 24
|
||||
#define FLT_DIG 6
|
||||
#define FLT_ROUNDS 1
|
||||
#define FLT_EPSILON 1.19209290e-07F
|
||||
#define FLT_MIN_EXP (-125)
|
||||
#define FLT_MIN 1.17549435e-38F
|
||||
#define FLT_MIN_10_EXP (-37)
|
||||
#define FLT_MAX_EXP 128
|
||||
#define FLT_MAX 3.40282347e+38F
|
||||
#define FLT_MAX_10_EXP 38
|
||||
# define FLT_MANT_DIG 24
|
||||
# define FLT_DIG 6
|
||||
# define FLT_ROUNDS 1
|
||||
# define FLT_EPSILON 1.19209290e-07F
|
||||
# define FLT_MIN_EXP (-125)
|
||||
# define FLT_MIN 1.17549435e-38F
|
||||
# define FLT_MIN_10_EXP (-37)
|
||||
# define FLT_MAX_EXP 128
|
||||
# define FLT_MAX 3.40282347e+38F
|
||||
# define FLT_MAX_10_EXP 38
|
||||
|
||||
/* IEEE double */
|
||||
#define DBL_MANT_DIG 53
|
||||
#define DBL_DIG 15
|
||||
#define DBL_EPSILON 2.2204460492503131e-16
|
||||
#define DBL_MIN_EXP (-1021)
|
||||
#define DBL_MIN 2.2250738585072014e-308
|
||||
#define DBL_MIN_10_EXP (-307)
|
||||
#define DBL_MAX_EXP 1024
|
||||
#define DBL_MAX 1.7976931348623157e+308
|
||||
#define DBL_MAX_10_EXP 308
|
||||
# define DBL_MANT_DIG 53
|
||||
# define DBL_DIG 15
|
||||
# define DBL_EPSILON 2.2204460492503131e-16
|
||||
# define DBL_MIN_EXP (-1021)
|
||||
# define DBL_MIN 2.2250738585072014e-308
|
||||
# define DBL_MIN_10_EXP (-307)
|
||||
# define DBL_MAX_EXP 1024
|
||||
# define DBL_MAX 1.7976931348623157e+308
|
||||
# define DBL_MAX_10_EXP 308
|
||||
|
||||
/* horrible intel long double */
|
||||
#if defined __i386__ || defined __x86_64__
|
||||
|
||||
#define LDBL_MANT_DIG 64
|
||||
#define LDBL_DIG 18
|
||||
#define LDBL_EPSILON 1.08420217248550443401e-19L
|
||||
#define LDBL_MIN_EXP (-16381)
|
||||
#define LDBL_MIN 3.36210314311209350626e-4932L
|
||||
#define LDBL_MIN_10_EXP (-4931)
|
||||
#define LDBL_MAX_EXP 16384
|
||||
#define LDBL_MAX 1.18973149535723176502e+4932L
|
||||
#define LDBL_MAX_10_EXP 4932
|
||||
#define DECIMAL_DIG 21
|
||||
|
||||
#elif defined __aarch64__ || defined __riscv
|
||||
/*
|
||||
* Use values from:
|
||||
* gcc -dM -E -xc /dev/null | grep LDBL | sed -e "s/__//g"
|
||||
*/
|
||||
#define LDBL_MANT_DIG 113
|
||||
#define LDBL_DIG 33
|
||||
#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L
|
||||
#define LDBL_MIN_EXP (-16381)
|
||||
#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L
|
||||
#define LDBL_MIN_10_EXP (-4931)
|
||||
#define LDBL_MAX_EXP 16384
|
||||
#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L
|
||||
#define LDBL_MAX_10_EXP 4932
|
||||
#define DECIMAL_DIG 36
|
||||
|
||||
#else
|
||||
|
||||
/* same as IEEE double */
|
||||
#define LDBL_MANT_DIG 53
|
||||
#define LDBL_DIG 15
|
||||
#define LDBL_EPSILON 2.2204460492503131e-16L
|
||||
#define LDBL_MIN_EXP (-1021)
|
||||
#define LDBL_MIN 2.2250738585072014e-308L
|
||||
#define LDBL_MIN_10_EXP (-307)
|
||||
#define LDBL_MAX_EXP 1024
|
||||
#define LDBL_MAX 1.7976931348623157e+308L
|
||||
#define LDBL_MAX_10_EXP 308
|
||||
#define DECIMAL_DIG 17
|
||||
|
||||
#endif
|
||||
# define LDBL_MANT_DIG 64
|
||||
# define LDBL_DIG 18
|
||||
# define LDBL_EPSILON 1.08420217248550443401e-19L
|
||||
# define LDBL_MIN_EXP (-16381)
|
||||
# define LDBL_MIN 3.36210314311209350626e-4932L
|
||||
# define LDBL_MIN_10_EXP (-4931)
|
||||
# define LDBL_MAX_EXP 16384
|
||||
# define LDBL_MAX 1.18973149535723176502e+4932L
|
||||
# define LDBL_MAX_10_EXP 4932
|
||||
# define DECIMAL_DIG 21
|
||||
|
||||
#endif /* _FLOAT_H_ */
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
#ifndef _STDALIGN_H
|
||||
#define _STDALIGN_H
|
||||
#ifndef _STDALIGN_H_
|
||||
# define _STDALIGN_H_ 1
|
||||
|
||||
#if __STDC_VERSION__ < 201112L && (defined(__GNUC__) || defined(__TINYC__))
|
||||
# define _Alignas(t) __attribute__((__aligned__(t)))
|
||||
# define _Alignof(t) __alignof__(t)
|
||||
#endif
|
||||
# if __STDC_VERSION__ < 201112L && (defined(__GNUC__) || defined(__TINYC__))
|
||||
# define _Alignas(t) __attribute__((__aligned__(t)))
|
||||
# define _Alignof(t) __alignof__(t)
|
||||
# endif
|
||||
|
||||
#define alignas _Alignas
|
||||
#define alignof _Alignof
|
||||
# define alignas _Alignas
|
||||
# define alignof _Alignof
|
||||
|
||||
#define __alignas_is_defined 1
|
||||
#define __alignof_is_defined 1
|
||||
# define __alignas_is_defined 1
|
||||
# define __alignof_is_defined 1
|
||||
|
||||
#endif /* _STDALIGN_H */
|
||||
#endif /* !_STDALIGN_H_ */
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _STDARG_H
|
||||
#define _STDARG_H
|
||||
#ifndef _STDARG_H_
|
||||
#define _STDARG_H_
|
||||
|
||||
typedef __builtin_va_list va_list;
|
||||
#define va_start __builtin_va_start
|
||||
|
@ -11,4 +11,4 @@ typedef __builtin_va_list va_list;
|
|||
typedef va_list __gnuc_va_list;
|
||||
#define _VA_LIST_DEFINED
|
||||
|
||||
#endif /* _STDARG_H */
|
||||
#endif /* _STDARG_H_ */
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#ifndef _STDBOOL_H
|
||||
#define _STDBOOL_H
|
||||
#ifndef _STDBOOL_H_
|
||||
# define _STDBOOL_H_ 1
|
||||
|
||||
/* ISOC99 boolean */
|
||||
# define bool _Bool
|
||||
# define true 1
|
||||
# define false 0
|
||||
|
||||
#define bool _Bool
|
||||
#define true 1
|
||||
#define false 0
|
||||
#define __bool_true_false_are_defined 1
|
||||
# define __bool_true_false_are_defined 1
|
||||
|
||||
#endif /* _STDBOOL_H */
|
||||
#endif /* !_STDBOOL_H */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#ifndef _STDDEF_H
|
||||
#define _STDDEF_H
|
||||
#ifndef _STDDEF_H_
|
||||
# define _STDDEF_H_
|
||||
|
||||
typedef __SIZE_TYPE__ size_t;
|
||||
typedef __PTRDIFF_TYPE__ ssize_t;
|
||||
|
@ -8,22 +8,23 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
|
|||
typedef __PTRDIFF_TYPE__ intptr_t;
|
||||
typedef __SIZE_TYPE__ uintptr_t;
|
||||
|
||||
#if __STDC_VERSION__ >= 201112L
|
||||
typedef union { long long __ll; long double __ld; } max_align_t;
|
||||
#endif
|
||||
# if __STDC_VERSION__ >= 201112L
|
||||
typedef union {
|
||||
long long __ll;
|
||||
long double __ld;
|
||||
} max_align_t;
|
||||
# endif
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL ((void*)0)
|
||||
#endif
|
||||
# ifndef NULL
|
||||
# define NULL ((void*)0)
|
||||
# endif
|
||||
|
||||
#undef offsetof
|
||||
#define offsetof(type, field) ((size_t)&((type *)0)->field)
|
||||
# undef offsetof
|
||||
# define offsetof(type, field) ((size_t)&((type *)0)->field)
|
||||
|
||||
#if defined __i386__ || defined __x86_64__
|
||||
void *alloca(size_t size);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* !_STDDEF_H_ */
|
||||
|
||||
/* Older glibc require a wint_t from <stddef.h> (when requested
|
||||
by __need_wint_t, as otherwise stddef.h isn't allowed to
|
||||
|
@ -32,10 +33,10 @@ void *alloca(size_t size);
|
|||
already (without requiring wint_t). Some other libs define _WINT_T
|
||||
if they've already provided that type, so we can use that as guard.
|
||||
TCC defines __WINT_TYPE__ for us. */
|
||||
#if defined (__need_wint_t)
|
||||
#ifndef _WINT_T
|
||||
#define _WINT_T
|
||||
#ifdef __need_wint_t
|
||||
# ifndef _WINT_T
|
||||
# define _WINT_T
|
||||
typedef __WINT_TYPE__ wint_t;
|
||||
#endif
|
||||
#undef __need_wint_t
|
||||
#endif
|
||||
# endif
|
||||
# undef __need_wint_t
|
||||
#endif /* !__need_win_t */
|
||||
|
|
37
libtcc1/include/stdint.h
Normal file
37
libtcc1/include/stdint.h
Normal file
|
@ -0,0 +1,37 @@
|
|||
#ifndef _STDINT_H_
|
||||
# define _STDINT_H_ 1
|
||||
|
||||
typedef __UINT8_TYPE__ uint8_t;
|
||||
typedef __UINT16_TYPE__ uint16_t;
|
||||
typedef __UINT32_TYPE__ uint32_t;
|
||||
typedef __UINT64_TYPE__ uint64_t;
|
||||
|
||||
typedef __INT8_TYPE__ int8_t;
|
||||
typedef __INT16_TYPE__ int16_t;
|
||||
typedef __INT32_TYPE__ int32_t;
|
||||
typedef __INT64_TYPE__ int64_t;
|
||||
|
||||
typedef __UINTPTR_TYPE__ uintptr_t;
|
||||
typedef __INTPTR_TYPE__ intptr_t;
|
||||
|
||||
# define UINT8_C(x) __UINT8_C(x)
|
||||
# define UINT16_C(x) __UINT16_C(x)
|
||||
# define UINT32_C(x) __UINT32_C(x)
|
||||
# define UINT64_C(x) __UINT64_C(x)
|
||||
|
||||
# define INT8_C(x) __INT8_C(x)
|
||||
# define INT16_C(x) __INT16_C(x)
|
||||
# define INT32_C(x) __INT32_C(x)
|
||||
# define INT64_C(x) __INT64_C(x)
|
||||
|
||||
# define UINT8_MAX __UINT8_MAX__
|
||||
# define UINT16_MAX __UINT16_MAX__
|
||||
# define UINT32_MAX __UINT32_MAX__
|
||||
# define UINT64_MAX __UINT64_MAX__
|
||||
|
||||
# define INT8_MAX __INT8_MAX__
|
||||
# define INT16_MAX __INT16_MAX__
|
||||
# define INT32_MAX __INT32_MAX__
|
||||
# define INT64_MAX __INT64_MAX__
|
||||
|
||||
#endif /* !_STDINT_H_ */
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _STDNORETURN_H
|
||||
#define _STDNORETURN_H
|
||||
#ifndef _STDNORETURN_H_
|
||||
# define _STDNORETURN_H_ 1
|
||||
|
||||
/* ISOC11 noreturn */
|
||||
#define noreturn _Noreturn
|
||||
# define noreturn _Noreturn
|
||||
|
||||
#endif /* _STDNORETURN_H */
|
||||
#endif /* !_STDNORETURN_H_ */
|
||||
|
|
|
@ -5,198 +5,151 @@
|
|||
|
||||
This file is either included at runtime as is, or converted and
|
||||
included as C-strings at compile-time (depending on CONFIG_TCC_PREDEFS).
|
||||
|
||||
Note that line indent matters:
|
||||
|
||||
- in lines starting at column 1, platform macros are replaced by
|
||||
corresponding TCC target compile-time macros. See conftest.c for
|
||||
the list of platform macros supported in lines starting at column 1.
|
||||
|
||||
- only lines indented >= 4 are actually included into the executable,
|
||||
check tccdefs_.h.
|
||||
*/
|
||||
|
||||
#if __SIZEOF_POINTER__ == 4
|
||||
/* 32bit systems. */
|
||||
#if defined __OpenBSD__
|
||||
#define __SIZE_TYPE__ unsigned long
|
||||
#define __PTRDIFF_TYPE__ long
|
||||
#else
|
||||
#define __SIZE_TYPE__ unsigned int
|
||||
#define __PTRDIFF_TYPE__ int
|
||||
#endif
|
||||
#define __ILP32__ 1
|
||||
#define __INT64_TYPE__ long long
|
||||
#elif __SIZEOF_LONG__ == 4
|
||||
/* 64bit Windows. */
|
||||
#define __SIZE_TYPE__ unsigned long long
|
||||
#define __PTRDIFF_TYPE__ long long
|
||||
#define __LLP64__ 1
|
||||
#define __INT64_TYPE__ long long
|
||||
#else
|
||||
/* Other 64bit systems. */
|
||||
#define __SIZE_TYPE__ unsigned long
|
||||
#define __PTRDIFF_TYPE__ long
|
||||
#define __LP64__ 1
|
||||
# if defined __linux__
|
||||
#define __INT64_TYPE__ long
|
||||
# else /* APPLE, BSD */
|
||||
#define __INT64_TYPE__ long long
|
||||
# endif
|
||||
#endif
|
||||
#define __SIZEOF_INT__ 4
|
||||
#define __INT_MAX__ 0x7fffffff
|
||||
#if __SIZEOF_LONG__ == 4
|
||||
#define __LONG_MAX__ 0x7fffffffL
|
||||
#else
|
||||
#define __LONG_MAX__ 0x7fffffffffffffffL
|
||||
#endif
|
||||
#define __SIZEOF_LONG_LONG__ 8
|
||||
#define __LONG_LONG_MAX__ 0x7fffffffffffffffLL
|
||||
#define __CHAR_BIT__ 8
|
||||
#define __ORDER_LITTLE_ENDIAN__ 1234
|
||||
#define __ORDER_BIG_ENDIAN__ 4321
|
||||
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
||||
#define __WCHAR_TYPE__ int
|
||||
#define __WINT_TYPE__ int
|
||||
#define __SIZE_TYPE__ unsigned int
|
||||
#define __PTRDIFF_TYPE__ int
|
||||
#define __ILP32__ 1
|
||||
#define _ILP32 1
|
||||
|
||||
#define __SIZEOF_INT__ 4
|
||||
#define __INT_MAX__ 0x7fffffff
|
||||
#define __LONG_MAX__ 0x7fffffffL
|
||||
|
||||
#define __SIZEOF_LONG_LONG__ 8
|
||||
#define __LONG_LONG_MAX__ 0x7fffffffffffffffLL
|
||||
|
||||
#define __CHAR_BIT__ 8
|
||||
#define __ORDER_LITTLE_ENDIAN__ 1234
|
||||
#define __ORDER_BIG_ENDIAN__ 4321
|
||||
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
||||
|
||||
#define __WCHAR_TYPE__ int
|
||||
#define __WINT_TYPE__ int
|
||||
|
||||
#if __STDC_VERSION__ >= 201112L
|
||||
# define __STDC_NO_ATOMICS__ 1
|
||||
# define __STDC_NO_COMPLEX__ 1
|
||||
# define __STDC_NO_THREADS__ 1
|
||||
# define __STDC_UTF_16__ 1
|
||||
# define __STDC_UTF_32__ 1
|
||||
# define __STDC_NO_ATOMICS__ 1
|
||||
# define __STDC_NO_COMPLEX__ 1
|
||||
# define __STDC_NO_THREADS__ 1
|
||||
# define __STDC_UTF_16__ 1
|
||||
# define __STDC_UTF_32__ 1
|
||||
#endif
|
||||
|
||||
/* Some derived integer types needed to get stdint.h to compile correctly on some platforms */
|
||||
#define __UINTPTR_TYPE__ unsigned __PTRDIFF_TYPE__
|
||||
#define __INTPTR_TYPE__ __PTRDIFF_TYPE__
|
||||
#define __INT32_TYPE__ int
|
||||
/* Some derived integer types needed to get stdint.h to compile correctly on some platforms */
|
||||
#define __UINTPTR_TYPE__ unsigned __PTRDIFF_TYPE__
|
||||
#define __INTPTR_TYPE__ __PTRDIFF_TYPE__
|
||||
|
||||
/* glibc defines. We do not support __USER_NAME_PREFIX__ */
|
||||
#define __REDIRECT(name, proto, alias) name proto __asm__ (#alias)
|
||||
#define __REDIRECT_NTH(name, proto, alias) name proto __asm__ (#alias) __THROW
|
||||
#define __REDIRECT_NTHNL(name, proto, alias) name proto __asm__ (#alias) __THROWNL
|
||||
#define __UINT8_MAX__ 0xff
|
||||
#define __UINT8_TYPE__ unsigned char
|
||||
#define __UINT8_C(c) c
|
||||
#define __INT8_MAX__ 0x7f
|
||||
#define __INT8_TYPE__ signed char
|
||||
#define __INT8_C(c) c
|
||||
|
||||
/* not implemented */
|
||||
#define __PRETTY_FUNCTION__ __FUNCTION__
|
||||
#define __has_builtin(x) 0
|
||||
#define __has_feature(x) 0
|
||||
#define __has_attribute(x) 0
|
||||
#define __UINT16_MAX__ 0xffff
|
||||
#define __UINT16_TYPE__ short unsigned int
|
||||
#define __UINT16_C(c) c
|
||||
#define __INT16_MAX__ 0x7fff
|
||||
#define __INT16_TYPE__ short int
|
||||
#define __INT16_C(c) c
|
||||
|
||||
/* C23 Keywords */
|
||||
#define _Nonnull
|
||||
#define _Nullable
|
||||
#define _Nullable_result
|
||||
#define _Null_unspecified
|
||||
#define __UINT32_MAX__ 0xffffffffU
|
||||
#define __UINT32_TYPE__ unsigned int
|
||||
#define __UINT32_C(c) c ## U
|
||||
#define __INT32_MAX__ 0x7fffffff
|
||||
#define __INT32_TYPE__ int
|
||||
#define __INT32_C(c) c
|
||||
|
||||
/* skip __builtin... with -E */
|
||||
#ifndef __TCC_PP__
|
||||
#define __INT64_MAX__ 0x7fffffffffffffffLL
|
||||
#define __INT64_TYPE__ long long int
|
||||
#define __INT64_C(c) c ## LL
|
||||
#define __UINT64_MAX__ 0xffffffffffffffffULL
|
||||
#define __UINT64_TYPE__ long long unsigned int
|
||||
#define __UINT64_C(c) c ## ULL
|
||||
|
||||
#define __builtin_offsetof(type, field) ((__SIZE_TYPE__)&((type*)0)->field)
|
||||
#define __builtin_extract_return_addr(x) x
|
||||
#if !defined __linux__ && !defined _WIN32
|
||||
/* used by math.h */
|
||||
#define __builtin_huge_val() 1e500
|
||||
#define __builtin_huge_valf() 1e50f
|
||||
#define __builtin_huge_vall() 1e5000L
|
||||
# if defined __APPLE__
|
||||
#define __builtin_nanf(ignored_string) (0.0F/0.0F)
|
||||
/* used by floats.h to implement FLT_ROUNDS C99 macro. 1 == to nearest */
|
||||
#define __builtin_flt_rounds() 1
|
||||
/* used by _fd_def.h */
|
||||
#define __builtin_bzero(p, ignored_size) bzero(p, sizeof(*(p)))
|
||||
/* glibc defines. We do not support __USER_NAME_PREFIX__ */
|
||||
#define __REDIRECT(name, proto, alias) name proto __asm__ (#alias)
|
||||
#define __REDIRECT_NTH(name, proto, alias) name proto __asm__ (#alias) __THROW
|
||||
#define __REDIRECT_NTHNL(name, proto, alias) name proto __asm__ (#alias) __THROWNL
|
||||
|
||||
/* not implemented */
|
||||
#define __PRETTY_FUNCTION__ __FUNCTION__
|
||||
#define __has_builtin(x) 0
|
||||
#define __has_feature(x) 0
|
||||
#define __has_attribute(x) 0
|
||||
|
||||
/* C23 Keywords */
|
||||
#define _Nonnull
|
||||
#define _Nullable
|
||||
#define _Nullable_result
|
||||
#define _Null_unspecified
|
||||
|
||||
/* skip __builtin... with -E */
|
||||
#ifndef __TCC_PP__
|
||||
|
||||
# define __builtin_offsetof(type, field) ((__SIZE_TYPE__)&((type*)0)->field)
|
||||
# define __builtin_extract_return_addr(x) x
|
||||
|
||||
/* __builtin_va_list */
|
||||
typedef char *__builtin_va_list;
|
||||
# define __builtin_va_start(ap,last) (ap = ((char *)&(last)) + ((sizeof(last)+3)&~3))
|
||||
# define __builtin_va_arg(ap,t) (*(t*)((ap+=(sizeof(t)+3)&~3)-((sizeof(t)+3)&~3)))
|
||||
|
||||
# define __builtin_va_end(ap) (void)(ap)
|
||||
# ifndef __builtin_va_copy
|
||||
# define __builtin_va_copy(dest, src) (dest) = (src)
|
||||
# endif /* !__builtin_va_copy */
|
||||
|
||||
/* TCC BBUILTIN */
|
||||
# ifdef __leading_underscore
|
||||
# define __RENAME(X) __asm__("_"X)
|
||||
# else
|
||||
#define __builtin_nanf(ignored_string) (0.0F/0.0F)
|
||||
# define __RENAME(X) __asm__(X)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* __builtin_va_list */
|
||||
typedef char *__builtin_va_list;
|
||||
#define __builtin_va_start(ap,last) (ap = ((char *)&(last)) + ((sizeof(last)+3)&~3))
|
||||
#define __builtin_va_arg(ap,t) (*(t*)((ap+=(sizeof(t)+3)&~3)-((sizeof(t)+3)&~3)))
|
||||
|
||||
#define __builtin_va_end(ap) (void)(ap)
|
||||
#ifndef __builtin_va_copy
|
||||
# define __builtin_va_copy(dest, src) (dest) = (src)
|
||||
#endif
|
||||
# define __BUILTIN(ret,name,params) ret __builtin_##name params __RENAME(#name);
|
||||
|
||||
/* TCC BBUILTIN AND BOUNDS ALIASES */
|
||||
#ifdef __leading_underscore
|
||||
# define __RENAME(X) __asm__("_"X)
|
||||
#else
|
||||
# define __RENAME(X) __asm__(X)
|
||||
#endif
|
||||
__BUILTIN(void*, memcpy, (void *, const void*, __SIZE_TYPE__))
|
||||
__BUILTIN(void*, memmove, (void *, const void*, __SIZE_TYPE__))
|
||||
__BUILTIN(void*, memset, (void *, int, __SIZE_TYPE__))
|
||||
__BUILTIN(int, memcmp, (const void *, const void*, __SIZE_TYPE__))
|
||||
__BUILTIN(__SIZE_TYPE__, strlen, (const char *))
|
||||
__BUILTIN(char*, strcpy, (char *, const char *))
|
||||
__BUILTIN(char*, strncpy, (char *, const char*, __SIZE_TYPE__))
|
||||
__BUILTIN(int, strcmp, (const char*, const char*))
|
||||
__BUILTIN(int, strncmp, (const char*, const char*, __SIZE_TYPE__))
|
||||
__BUILTIN(char*, strcat, (char*, const char*))
|
||||
__BUILTIN(char*, strncat, (char*, const char*, __SIZE_TYPE__))
|
||||
__BUILTIN(char*, strchr, (const char*, int))
|
||||
__BUILTIN(char*, strrchr, (const char*, int))
|
||||
__BUILTIN(char*, strdup, (const char*))
|
||||
|
||||
#ifdef __TCC_BCHECK__
|
||||
# define __BUILTINBC(ret,name,params) ret __builtin_##name params __RENAME("__bound_"#name);
|
||||
# define __BOUND(ret,name,params) ret name params __RENAME("__bound_"#name);
|
||||
#else
|
||||
# define __BUILTINBC(ret,name,params) ret __builtin_##name params __RENAME(#name);
|
||||
# define __BOUND(ret,name,params)
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
#define __BOTH __BOUND
|
||||
#define __BUILTIN(ret,name,params)
|
||||
#else
|
||||
#define __BOTH(ret,name,params) __BUILTINBC(ret,name,params)__BOUND(ret,name,params)
|
||||
#define __BUILTIN(ret,name,params) ret __builtin_##name params __RENAME(#name);
|
||||
#endif
|
||||
|
||||
__BOTH(void*, memcpy, (void *, const void*, __SIZE_TYPE__))
|
||||
__BOTH(void*, memmove, (void *, const void*, __SIZE_TYPE__))
|
||||
__BOTH(void*, memset, (void *, int, __SIZE_TYPE__))
|
||||
__BOTH(int, memcmp, (const void *, const void*, __SIZE_TYPE__))
|
||||
__BOTH(__SIZE_TYPE__, strlen, (const char *))
|
||||
__BOTH(char*, strcpy, (char *, const char *))
|
||||
__BOTH(char*, strncpy, (char *, const char*, __SIZE_TYPE__))
|
||||
__BOTH(int, strcmp, (const char*, const char*))
|
||||
__BOTH(int, strncmp, (const char*, const char*, __SIZE_TYPE__))
|
||||
__BOTH(char*, strcat, (char*, const char*))
|
||||
__BOTH(char*, strncat, (char*, const char*, __SIZE_TYPE__))
|
||||
__BOTH(char*, strchr, (const char*, int))
|
||||
__BOTH(char*, strrchr, (const char*, int))
|
||||
__BOTH(char*, strdup, (const char*))
|
||||
__BUILTIN(void*, malloc, (__SIZE_TYPE__))
|
||||
__BUILTIN(void*, realloc, (void *, __SIZE_TYPE__))
|
||||
__BUILTIN(void*, calloc, (__SIZE_TYPE__, __SIZE_TYPE__))
|
||||
__BUILTIN(void*, memalign, (__SIZE_TYPE__, __SIZE_TYPE__))
|
||||
__BUILTIN(void, free, (void*))
|
||||
|
||||
#if defined __linux__ || defined __APPLE__ // HAVE MALLOC_REDIR
|
||||
#define __MAYBE_REDIR __BUILTIN
|
||||
#else
|
||||
#define __MAYBE_REDIR __BOTH
|
||||
#endif
|
||||
__MAYBE_REDIR(void*, malloc, (__SIZE_TYPE__))
|
||||
__MAYBE_REDIR(void*, realloc, (void *, __SIZE_TYPE__))
|
||||
__MAYBE_REDIR(void*, calloc, (__SIZE_TYPE__, __SIZE_TYPE__))
|
||||
__MAYBE_REDIR(void*, memalign, (__SIZE_TYPE__, __SIZE_TYPE__))
|
||||
__MAYBE_REDIR(void, free, (void*))
|
||||
#if defined __i386__ || defined __x86_64__
|
||||
__BOTH(void*, alloca, (__SIZE_TYPE__))
|
||||
#else
|
||||
__BUILTIN(void*, alloca, (__SIZE_TYPE__))
|
||||
#endif
|
||||
__BUILTIN(void, abort, (void))
|
||||
__BOUND(void, longjmp, ())
|
||||
#if !defined _WIN32
|
||||
__BOUND(void*, mmap, ())
|
||||
__BOUND(int, munmap, ())
|
||||
#endif
|
||||
#undef __BUILTINBC
|
||||
#undef __BUILTIN
|
||||
#undef __BOUND
|
||||
#undef __BOTH
|
||||
#undef __MAYBE_REDIR
|
||||
#undef __RENAME
|
||||
__BUILTIN(void*, alloca, (__SIZE_TYPE__))
|
||||
|
||||
#define __BUILTIN_EXTERN(name,u) \
|
||||
int __builtin_##name(u int); \
|
||||
int __builtin_##name##l(u long); \
|
||||
int __builtin_##name##ll(u long long);
|
||||
__BUILTIN_EXTERN(ffs,)
|
||||
__BUILTIN_EXTERN(clz, unsigned)
|
||||
__BUILTIN_EXTERN(ctz, unsigned)
|
||||
__BUILTIN_EXTERN(clrsb,)
|
||||
__BUILTIN_EXTERN(popcount, unsigned)
|
||||
__BUILTIN_EXTERN(parity, unsigned)
|
||||
#undef __BUILTIN_EXTERN
|
||||
__BUILTIN(void, abort, (void))
|
||||
|
||||
#endif /* ndef __TCC_PP__ */
|
||||
# undef __BUILTIN
|
||||
# undef __RENAME
|
||||
|
||||
# define __BUILTIN_EXTERN(name,u) \
|
||||
int __builtin_##name(u int); \
|
||||
int __builtin_##name##l(u long); \
|
||||
int __builtin_##name##ll(u long long);
|
||||
|
||||
__BUILTIN_EXTERN(ffs,)
|
||||
__BUILTIN_EXTERN(clz, unsigned)
|
||||
__BUILTIN_EXTERN(ctz, unsigned)
|
||||
__BUILTIN_EXTERN(clrsb,)
|
||||
__BUILTIN_EXTERN(popcount, unsigned)
|
||||
__BUILTIN_EXTERN(parity, unsigned)
|
||||
# undef __BUILTIN_EXTERN
|
||||
|
||||
#endif /* !__TCC_PP__ */
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
/**
|
||||
* This file has no copyright assigned and is placed in the Public Domain.
|
||||
* This file is part of the w64 mingw-runtime package.
|
||||
* No warranty is given; refer to the file DISCLAIMER within this package.
|
||||
*/
|
||||
#ifndef _VARARGS_H
|
||||
#define _VARARGS_H
|
||||
|
||||
#error "TinyCC no longer implements <varargs.h>."
|
||||
#error "Revise your code to use <stdarg.h>."
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue