From 1c0cc775732201f4c4d3ee0d6772be786b3b4aa1 Mon Sep 17 00:00:00 2001 From: Uneven Prankster Date: Sun, 15 Oct 2023 21:28:29 -0300 Subject: A lot has certainly happened! --- tinycc/include/float.h | 75 ---------- tinycc/include/stdalign.h | 16 --- tinycc/include/stdarg.h | 14 -- tinycc/include/stdatomic.h | 172 ----------------------- tinycc/include/stdbool.h | 11 -- tinycc/include/stddef.h | 41 ------ tinycc/include/stdnoreturn.h | 7 - tinycc/include/tccdefs.h | 325 ------------------------------------------- tinycc/include/tgmath.h | 89 ------------ tinycc/include/varargs.h | 12 -- 10 files changed, 762 deletions(-) delete mode 100644 tinycc/include/float.h delete mode 100644 tinycc/include/stdalign.h delete mode 100644 tinycc/include/stdarg.h delete mode 100644 tinycc/include/stdatomic.h delete mode 100644 tinycc/include/stdbool.h delete mode 100644 tinycc/include/stddef.h delete mode 100644 tinycc/include/stdnoreturn.h delete mode 100644 tinycc/include/tccdefs.h delete mode 100644 tinycc/include/tgmath.h delete mode 100644 tinycc/include/varargs.h (limited to 'tinycc/include') diff --git a/tinycc/include/float.h b/tinycc/include/float.h deleted file mode 100644 index 24b7410..0000000 --- a/tinycc/include/float.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef _FLOAT_H_ -#define _FLOAT_H_ - -#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 - -/* 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 - -/* 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_EXP 16384 -#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 - -#endif /* _FLOAT_H_ */ diff --git a/tinycc/include/stdalign.h b/tinycc/include/stdalign.h deleted file mode 100644 index ae46c34..0000000 --- a/tinycc/include/stdalign.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _STDALIGN_H -#define _STDALIGN_H - -#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_is_defined 1 -#define __alignof_is_defined 1 - -#endif /* _STDALIGN_H */ - diff --git a/tinycc/include/stdarg.h b/tinycc/include/stdarg.h deleted file mode 100644 index aa784da..0000000 --- a/tinycc/include/stdarg.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _STDARG_H -#define _STDARG_H - -typedef __builtin_va_list va_list; -#define va_start __builtin_va_start -#define va_arg __builtin_va_arg -#define va_copy __builtin_va_copy -#define va_end __builtin_va_end - -/* fix a buggy dependency on GCC in libio.h */ -typedef va_list __gnuc_va_list; -#define _VA_LIST_DEFINED - -#endif /* _STDARG_H */ diff --git a/tinycc/include/stdatomic.h b/tinycc/include/stdatomic.h deleted file mode 100644 index a8372ee..0000000 --- a/tinycc/include/stdatomic.h +++ /dev/null @@ -1,172 +0,0 @@ -/* This file is derived from clang's stdatomic.h */ - -/*===---- stdatomic.h - Standard header for atomic types and operations -----=== - * - * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. - * See https://llvm.org/LICENSE.txt for license information. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - * - *===-----------------------------------------------------------------------=== - */ - -#ifndef _STDATOMIC_H -#define _STDATOMIC_H - -#include -#include -#include - -#define __ATOMIC_RELAXED 0 -#define __ATOMIC_CONSUME 1 -#define __ATOMIC_ACQUIRE 2 -#define __ATOMIC_RELEASE 3 -#define __ATOMIC_ACQ_REL 4 -#define __ATOMIC_SEQ_CST 5 - -/* Memory ordering */ -typedef enum { - memory_order_relaxed = __ATOMIC_RELAXED, - memory_order_consume = __ATOMIC_CONSUME, - memory_order_acquire = __ATOMIC_ACQUIRE, - memory_order_release = __ATOMIC_RELEASE, - memory_order_acq_rel = __ATOMIC_ACQ_REL, - memory_order_seq_cst = __ATOMIC_SEQ_CST, -} memory_order; - -/* Atomic typedefs */ -typedef _Atomic(_Bool) atomic_bool; -typedef _Atomic(char) atomic_char; -typedef _Atomic(signed char) atomic_schar; -typedef _Atomic(unsigned char) atomic_uchar; -typedef _Atomic(short) atomic_short; -typedef _Atomic(unsigned short) atomic_ushort; -typedef _Atomic(int) atomic_int; -typedef _Atomic(unsigned int) atomic_uint; -typedef _Atomic(long) atomic_long; -typedef _Atomic(unsigned long) atomic_ulong; -typedef _Atomic(long long) atomic_llong; -typedef _Atomic(unsigned long long) atomic_ullong; -typedef _Atomic(uint_least16_t) atomic_char16_t; -typedef _Atomic(uint_least32_t) atomic_char32_t; -typedef _Atomic(wchar_t) atomic_wchar_t; -typedef _Atomic(int_least8_t) atomic_int_least8_t; -typedef _Atomic(uint_least8_t) atomic_uint_least8_t; -typedef _Atomic(int_least16_t) atomic_int_least16_t; -typedef _Atomic(uint_least16_t) atomic_uint_least16_t; -typedef _Atomic(int_least32_t) atomic_int_least32_t; -typedef _Atomic(uint_least32_t) atomic_uint_least32_t; -typedef _Atomic(int_least64_t) atomic_int_least64_t; -typedef _Atomic(uint_least64_t) atomic_uint_least64_t; -typedef _Atomic(int_fast8_t) atomic_int_fast8_t; -typedef _Atomic(uint_fast8_t) atomic_uint_fast8_t; -typedef _Atomic(int_fast16_t) atomic_int_fast16_t; -typedef _Atomic(uint_fast16_t) atomic_uint_fast16_t; -typedef _Atomic(int_fast32_t) atomic_int_fast32_t; -typedef _Atomic(uint_fast32_t) atomic_uint_fast32_t; -typedef _Atomic(int_fast64_t) atomic_int_fast64_t; -typedef _Atomic(uint_fast64_t) atomic_uint_fast64_t; -typedef _Atomic(intptr_t) atomic_intptr_t; -typedef _Atomic(uintptr_t) atomic_uintptr_t; -typedef _Atomic(size_t) atomic_size_t; -typedef _Atomic(ptrdiff_t) atomic_ptrdiff_t; -typedef _Atomic(intmax_t) atomic_intmax_t; -typedef _Atomic(uintmax_t) atomic_uintmax_t; - -/* Atomic flag */ -typedef struct { - atomic_bool value; -} atomic_flag; - -#define ATOMIC_FLAG_INIT {0} - -#define atomic_flag_test_and_set_explicit(object, order) \ - __atomic_test_and_set((void *)(&((object)->value)), order) -#define atomic_flag_test_and_set(object) \ - atomic_flag_test_and_set_explicit(object, __ATOMIC_SEQ_CST) - -#define atomic_flag_clear_explicit(object, order) \ - __atomic_clear((bool *)(&((object)->value)), order) -#define atomic_flag_clear(object) \ - atomic_flag_clear_explicit(object, __ATOMIC_SEQ_CST) - -/* Generic routines */ -#define atomic_init(object, desired) \ - atomic_store_explicit(object, desired, __ATOMIC_RELAXED) - -#define atomic_store_explicit(object, desired, order) \ - ({ __typeof__ (object) ptr = (object); \ - __typeof__ (*ptr) tmp = (desired); \ - __atomic_store (ptr, &tmp, (order)); \ - }) -#define atomic_store(object, desired) \ - atomic_store_explicit (object, desired, __ATOMIC_SEQ_CST) - -#define atomic_load_explicit(object, order) \ - ({ __typeof__ (object) ptr = (object); \ - __typeof__ (*ptr) tmp; \ - __atomic_load (ptr, &tmp, (order)); \ - tmp; \ - }) -#define atomic_load(object) atomic_load_explicit (object, __ATOMIC_SEQ_CST) - -#define atomic_exchange_explicit(object, desired, order) \ - ({ __typeof__ (object) ptr = (object); \ - __typeof__ (*ptr) val = (desired); \ - __typeof__ (*ptr) tmp; \ - __atomic_exchange (ptr, &val, &tmp, (order)); \ - tmp; \ - }) -#define atomic_exchange(object, desired) \ - atomic_exchange_explicit (object, desired, __ATOMIC_SEQ_CST) - -#define atomic_compare_exchange_strong_explicit(object, expected, desired, success, failure) \ - ({ __typeof__ (object) ptr = (object); \ - __typeof__ (*ptr) tmp = desired; \ - __atomic_compare_exchange(ptr, expected, &tmp, 0, success, failure); \ - }) -#define atomic_compare_exchange_strong(object, expected, desired) \ - atomic_compare_exchange_strong_explicit (object, expected, desired, \ - __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) - -#define atomic_compare_exchange_weak_explicit(object, expected, desired, success, failure) \ - ({ __typeof__ (object) ptr = (object); \ - __typeof__ (*ptr) tmp = desired; \ - __atomic_compare_exchange(ptr, expected, &tmp, 1, success, failure); \ - }) -#define atomic_compare_exchange_weak(object, expected, desired) \ - atomic_compare_exchange_weak_explicit (PTR, VAL, DES, \ - __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST) - -#define atomic_fetch_add(object, operand) \ - __atomic_fetch_add(object, operand, __ATOMIC_SEQ_CST) -#define atomic_fetch_add_explicit __atomic_fetch_add - -#define atomic_fetch_sub(object, operand) \ - __atomic_fetch_sub(object, operand, __ATOMIC_SEQ_CST) -#define atomic_fetch_sub_explicit __atomic_fetch_sub - -#define atomic_fetch_or(object, operand) \ - __atomic_fetch_or(object, operand, __ATOMIC_SEQ_CST) -#define atomic_fetch_or_explicit __atomic_fetch_or - -#define atomic_fetch_xor(object, operand) \ - __atomic_fetch_xor(object, operand, __ATOMIC_SEQ_CST) -#define atomic_fetch_xor_explicit __atomic_fetch_xor - -#define atomic_fetch_and(object, operand) \ - __atomic_fetch_and(object, operand, __ATOMIC_SEQ_CST) -#define atomic_fetch_and_explicit __atomic_fetch_and - -extern void atomic_thread_fence (memory_order); -extern void __atomic_thread_fence (memory_order); -#define atomic_thread_fence(order) __atomic_thread_fence (order) -extern void atomic_signal_fence (memory_order); -extern void __atomic_signal_fence (memory_order); -#define atomic_signal_fence(order) __atomic_signal_fence (order) -extern bool __atomic_is_lock_free(size_t size, void *ptr); -#define atomic_is_lock_free(OBJ) __atomic_is_lock_free (sizeof (*(OBJ)), (OBJ)) - -extern bool __atomic_test_and_set (void *, memory_order); -extern void __atomic_clear (bool *, memory_order); - -#endif /* _STDATOMIC_H */ diff --git a/tinycc/include/stdbool.h b/tinycc/include/stdbool.h deleted file mode 100644 index d2ee446..0000000 --- a/tinycc/include/stdbool.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _STDBOOL_H -#define _STDBOOL_H - -/* ISOC99 boolean */ - -#define bool _Bool -#define true 1 -#define false 0 -#define __bool_true_false_are_defined 1 - -#endif /* _STDBOOL_H */ diff --git a/tinycc/include/stddef.h b/tinycc/include/stddef.h deleted file mode 100644 index da9b9e0..0000000 --- a/tinycc/include/stddef.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef _STDDEF_H -#define _STDDEF_H - -typedef __SIZE_TYPE__ size_t; -typedef __PTRDIFF_TYPE__ ssize_t; -typedef __WCHAR_TYPE__ wchar_t; -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 - -#ifndef NULL -#define NULL ((void*)0) -#endif - -#undef offsetof -#define offsetof(type, field) ((size_t)&((type *)0)->field) - -#if defined __i386__ || defined __x86_64__ -void *alloca(size_t size); -#endif - -#endif - -/* Older glibc require a wint_t from (when requested - by __need_wint_t, as otherwise stddef.h isn't allowed to - define this type). Note that this must be outside the normal - _STDDEF_H guard, so that it works even when we've included the file - 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 -typedef __WINT_TYPE__ wint_t; -#endif -#undef __need_wint_t -#endif diff --git a/tinycc/include/stdnoreturn.h b/tinycc/include/stdnoreturn.h deleted file mode 100644 index 4d580ea..0000000 --- a/tinycc/include/stdnoreturn.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef _STDNORETURN_H -#define _STDNORETURN_H - -/* ISOC11 noreturn */ -#define noreturn _Noreturn - -#endif /* _STDNORETURN_H */ diff --git a/tinycc/include/tccdefs.h b/tinycc/include/tccdefs.h deleted file mode 100644 index 4e03cb9..0000000 --- a/tinycc/include/tccdefs.h +++ /dev/null @@ -1,325 +0,0 @@ -/* tccdefs.h - - Nothing is defined before this file except target machine, target os - and the few things related to option settings in tccpp.c:tcc_predefs(). - - 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__ -#if defined _WIN32 - #define __WCHAR_TYPE__ unsigned short - #define __WINT_TYPE__ unsigned short -#elif defined __linux__ - #define __WCHAR_TYPE__ int - #define __WINT_TYPE__ unsigned int -#else - #define __WCHAR_TYPE__ int - #define __WINT_TYPE__ int -#endif - - #if __STDC_VERSION__ >= 201112L - # define __STDC_NO_ATOMICS__ 1 - # define __STDC_NO_COMPLEX__ 1 - # define __STDC_NO_THREADS__ 1 -#if !defined _WIN32 - # define __STDC_UTF_16__ 1 - # define __STDC_UTF_32__ 1 -#endif - #endif - -#if defined _WIN32 - #define __declspec(x) __attribute__((x)) - #define __cdecl - -#elif defined __FreeBSD__ - #define __GNUC__ 9 - #define __GNUC_MINOR__ 3 - #define __GNUC_PATCHLEVEL__ 0 - #define __GNUC_STDC_INLINE__ 1 - #define __NO_TLS 1 - #define __RUNETYPE_INTERNAL 1 -# if __SIZEOF_POINTER__ == 8 - /* FIXME, __int128_t is used by setjump */ - #define __int128_t struct { unsigned char _dummy[16] __attribute((aligned(16))); } - #define __SIZEOF_SIZE_T__ 8 - #define __SIZEOF_PTRDIFF_T__ 8 -#else - #define __SIZEOF_SIZE_T__ 4 - #define __SIZEOF_PTRDIFF_T__ 4 -# endif - -#elif defined __FreeBSD_kernel__ - -#elif defined __NetBSD__ - #define __GNUC__ 4 - #define __GNUC_MINOR__ 1 - #define __GNUC_PATCHLEVEL__ 0 - #define _Pragma(x) - #define __ELF__ 1 -#if defined __aarch64__ - #define _LOCORE /* avoids usage of __asm */ -#endif - -#elif defined __OpenBSD__ - #define __GNUC__ 4 - #define _ANSI_LIBRARY 1 - -#elif defined __APPLE__ - /* emulate APPLE-GCC to make libc's headerfiles compile: */ - #define __GNUC__ 4 /* darwin emits warning on GCC<4 */ - #define __APPLE_CC__ 1 /* for */ - #define __LITTLE_ENDIAN__ 1 - #define _DONT_USE_CTYPE_INLINE_ 1 - /* avoids usage of GCC/clang specific builtins in libc-headerfiles: */ - #define __FINITE_MATH_ONLY__ 1 - #define _FORTIFY_SOURCE 0 - -#elif defined __ANDROID__ - #define BIONIC_IOCTL_NO_SIGNEDNESS_OVERLOAD - #define __PRETTY_FUNCTION__ __FUNCTION__ - #define __has_builtin(x) 0 - #define __has_feature(x) 0 - #define _Nonnull - #define _Nullable - -#else - /* Linux */ - -#endif - /* Some derived integer types needed to get stdint.h to compile correctly on some platforms */ -#ifndef __NetBSD__ - #define __UINTPTR_TYPE__ unsigned __PTRDIFF_TYPE__ - #define __INTPTR_TYPE__ __PTRDIFF_TYPE__ -#endif - #define __INT32_TYPE__ int - -#if !defined _WIN32 - /* glibc defines */ - #define __REDIRECT(name, proto, alias) name proto __asm__ (#alias) - #define __REDIRECT_NTH(name, proto, alias) name proto __asm__ (#alias) __THROW -#endif - - /* skip __builtin... with -E */ - #ifndef __TCC_PP__ - - #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))) -# else - #define __builtin_nanf(ignored_string) (0.0F/0.0F) -# endif -#endif - - /* __builtin_va_list */ -#if defined __x86_64__ -#if !defined _WIN32 - /* GCC compatible definition of va_list. */ - /* This should be in sync with the declaration in our lib/libtcc1.c */ - typedef struct { - unsigned gp_offset, fp_offset; - union { - unsigned overflow_offset; - char *overflow_arg_area; - }; - char *reg_save_area; - } __builtin_va_list[1]; - - void *__va_arg(__builtin_va_list ap, int arg_type, int size, int align); - #define __builtin_va_start(ap, last) \ - (*(ap) = *(__builtin_va_list)((char*)__builtin_frame_address(0) - 24)) - #define __builtin_va_arg(ap, t) \ - (*(t *)(__va_arg(ap, __builtin_va_arg_types(t), sizeof(t), __alignof__(t)))) - #define __builtin_va_copy(dest, src) (*(dest) = *(src)) - -#else /* _WIN64 */ - typedef char* __builtin_va_list; - #define __builtin_va_arg(ap, t) ((sizeof(t) > 8 || (sizeof(t) & (sizeof(t) - 1))) \ - ? **(t **)((ap += 8) - 8) : *(t *)((ap += 8) - 8)) -#endif - -#elif defined __arm__ - typedef char *__builtin_va_list; - #define _tcc_alignof(type) ((int)&((struct {char c;type x;} *)0)->x) - #define _tcc_align(addr,type) (((unsigned)addr + _tcc_alignof(type) - 1) \ - & ~(_tcc_alignof(type) - 1)) - #define __builtin_va_start(ap,last) (ap = ((char *)&(last)) + ((sizeof(last)+3)&~3)) - #define __builtin_va_arg(ap,type) (ap = (void *) ((_tcc_align(ap,type)+sizeof(type)+3) \ - &~3), *(type *)(ap - ((sizeof(type)+3)&~3))) - -#elif defined __aarch64__ -#if defined __APPLE__ - typedef struct { - void *__stack; - } __builtin_va_list; - -#else - typedef struct { - void *__stack, *__gr_top, *__vr_top; - int __gr_offs, __vr_offs; - } __builtin_va_list; - -#endif -#elif defined __riscv - typedef char *__builtin_va_list; - #define __va_reg_size (__riscv_xlen >> 3) - #define _tcc_align(addr,type) (((unsigned long)addr + __alignof__(type) - 1) \ - & -(__alignof__(type))) - #define __builtin_va_arg(ap,type) (*(sizeof(type) > (2*__va_reg_size) ? *(type **)((ap += __va_reg_size) - __va_reg_size) : (ap = (va_list)(_tcc_align(ap,type) + (sizeof(type)+__va_reg_size - 1)& -__va_reg_size), (type *)(ap - ((sizeof(type)+ __va_reg_size - 1)& -__va_reg_size))))) - -#else /* __i386__ */ - 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))) - -#endif - #define __builtin_va_end(ap) (void)(ap) - #ifndef __builtin_va_copy - # define __builtin_va_copy(dest, src) (dest) = (src) - #endif - - /* TCC BBUILTIN AND BOUNDS ALIASES */ - #ifdef __leading_underscore - # define __RENAME(X) __asm__("_"X) - #else - # define __RENAME(X) __asm__(X) - #endif - - #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*)) -#if defined __ARM_EABI__ - __BOUND(void*,__aeabi_memcpy,(void*,const void*,__SIZE_TYPE__)) - __BOUND(void*,__aeabi_memmove,(void*,const void*,__SIZE_TYPE__)) - __BOUND(void*,__aeabi_memmove4,(void*,const void*,__SIZE_TYPE__)) - __BOUND(void*,__aeabi_memmove8,(void*,const void*,__SIZE_TYPE__)) - __BOUND(void*,__aeabi_memset,(void*,int,__SIZE_TYPE__)) -#endif - -#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 - - #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 /* ndef __TCC_PP__ */ \ No newline at end of file diff --git a/tinycc/include/tgmath.h b/tinycc/include/tgmath.h deleted file mode 100644 index 5d3e357..0000000 --- a/tinycc/include/tgmath.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * ISO C Standard: 7.22 Type-generic math - */ - -#ifndef _TGMATH_H -#define _TGMATH_H - -#include - -#ifndef __cplusplus -#define __tgmath_real(x, F) \ - _Generic ((x), float: F##f, long double: F##l, default: F)(x) -#define __tgmath_real_2_1(x, y, F) \ - _Generic ((x), float: F##f, long double: F##l, default: F)(x, y) -#define __tgmath_real_2(x, y, F) \ - _Generic ((x)+(y), float: F##f, long double: F##l, default: F)(x, y) -#define __tgmath_real_3_2(x, y, z, F) \ - _Generic ((x)+(y), float: F##f, long double: F##l, default: F)(x, y, z) -#define __tgmath_real_3(x, y, z, F) \ - _Generic ((x)+(y)+(z), float: F##f, long double: F##l, default: F)(x, y, z) - -/* Functions defined in both and (7.22p4) */ -#define acos(z) __tgmath_real(z, acos) -#define asin(z) __tgmath_real(z, asin) -#define atan(z) __tgmath_real(z, atan) -#define acosh(z) __tgmath_real(z, acosh) -#define asinh(z) __tgmath_real(z, asinh) -#define atanh(z) __tgmath_real(z, atanh) -#define cos(z) __tgmath_real(z, cos) -#define sin(z) __tgmath_real(z, sin) -#define tan(z) __tgmath_real(z, tan) -#define cosh(z) __tgmath_real(z, cosh) -#define sinh(z) __tgmath_real(z, sinh) -#define tanh(z) __tgmath_real(z, tanh) -#define exp(z) __tgmath_real(z, exp) -#define log(z) __tgmath_real(z, log) -#define pow(z1,z2) __tgmath_real_2(z1, z2, pow) -#define sqrt(z) __tgmath_real(z, sqrt) -#define fabs(z) __tgmath_real(z, fabs) - -/* Functions defined in only (7.22p5) */ -#define atan2(x,y) __tgmath_real_2(x, y, atan2) -#define cbrt(x) __tgmath_real(x, cbrt) -#define ceil(x) __tgmath_real(x, ceil) -#define copysign(x,y) __tgmath_real_2(x, y, copysign) -#define erf(x) __tgmath_real(x, erf) -#define erfc(x) __tgmath_real(x, erfc) -#define exp2(x) __tgmath_real(x, exp2) -#define expm1(x) __tgmath_real(x, expm1) -#define fdim(x,y) __tgmath_real_2(x, y, fdim) -#define floor(x) __tgmath_real(x, floor) -#define fma(x,y,z) __tgmath_real_3(x, y, z, fma) -#define fmax(x,y) __tgmath_real_2(x, y, fmax) -#define fmin(x,y) __tgmath_real_2(x, y, fmin) -#define fmod(x,y) __tgmath_real_2(x, y, fmod) -#define frexp(x,y) __tgmath_real_2_1(x, y, frexp) -#define hypot(x,y) __tgmath_real_2(x, y, hypot) -#define ilogb(x) __tgmath_real(x, ilogb) -#define ldexp(x,y) __tgmath_real_2_1(x, y, ldexp) -#define lgamma(x) __tgmath_real(x, lgamma) -#define llrint(x) __tgmath_real(x, llrint) -#define llround(x) __tgmath_real(x, llround) -#define log10(x) __tgmath_real(x, log10) -#define log1p(x) __tgmath_real(x, log1p) -#define log2(x) __tgmath_real(x, log2) -#define logb(x) __tgmath_real(x, logb) -#define lrint(x) __tgmath_real(x, lrint) -#define lround(x) __tgmath_real(x, lround) -#define nearbyint(x) __tgmath_real(x, nearbyint) -#define nextafter(x,y) __tgmath_real_2(x, y, nextafter) -#define nexttoward(x,y) __tgmath_real_2(x, y, nexttoward) -#define remainder(x,y) __tgmath_real_2(x, y, remainder) -#define remquo(x,y,z) __tgmath_real_3_2(x, y, z, remquo) -#define rint(x) __tgmath_real(x, rint) -#define round(x) __tgmath_real(x, round) -#define scalbln(x,y) __tgmath_real_2_1(x, y, scalbln) -#define scalbn(x,y) __tgmath_real_2_1(x, y, scalbn) -#define tgamma(x) __tgmath_real(x, tgamma) -#define trunc(x) __tgmath_real(x, trunc) - -/* Functions defined in only (7.22p6) -#define carg(z) __tgmath_cplx_only(z, carg) -#define cimag(z) __tgmath_cplx_only(z, cimag) -#define conj(z) __tgmath_cplx_only(z, conj) -#define cproj(z) __tgmath_cplx_only(z, cproj) -#define creal(z) __tgmath_cplx_only(z, creal) -*/ -#endif /* __cplusplus */ -#endif /* _TGMATH_H */ diff --git a/tinycc/include/varargs.h b/tinycc/include/varargs.h deleted file mode 100644 index d614366..0000000 --- a/tinycc/include/varargs.h +++ /dev/null @@ -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 ." -#error "Revise your code to use ." - -#endif -- cgit v1.2.3