Miscellaneous updates and improvements

This commit is contained in:
mintsuki 2024-09-09 11:52:37 +02:00
parent 4b8b780075
commit f890bb9278
7 changed files with 48 additions and 30 deletions

28
float.h
View File

@ -12,10 +12,8 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#if !defined(__FSTD_HDRS_FLOAT_H) || defined(__FSTD_HDRS_CXX_WRAP) #ifndef __FSTD_HDRS_FLOAT_H
#if !defined(__FSTD_HDRS_CXX_WRAP)
#define __FSTD_HDRS_FLOAT_H 1 #define __FSTD_HDRS_FLOAT_H 1
#endif
#undef FLT_ROUNDS #undef FLT_ROUNDS
#define FLT_ROUNDS 1 #define FLT_ROUNDS 1
@ -30,19 +28,17 @@
#undef LDBL_MANT_DIG #undef LDBL_MANT_DIG
#define LDBL_MANT_DIG __LDBL_MANT_DIG__ #define LDBL_MANT_DIG __LDBL_MANT_DIG__
#if (defined(__cplusplus) && __cplusplus >= 201103L) \
|| (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
#undef DECIMAL_DIG #undef DECIMAL_DIG
#define DECIMAL_DIG __DECIMAL_DIG__ #define DECIMAL_DIG __DECIMAL_DIG__
#undef FLT_DECIMAL_DIG
#define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
#undef DBL_DECIMAL_DIG
#define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
#undef LDBL_DECIMAL_DIG
#define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
#undef FLT_EVAL_METHOD #undef FLT_EVAL_METHOD
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
#endif
#undef FLT_DIG #undef FLT_DIG
#define FLT_DIG __FLT_DIG__ #define FLT_DIG __FLT_DIG__
#undef DBL_DIG #undef DBL_DIG
@ -99,6 +95,16 @@
#undef LDBL_MIN #undef LDBL_MIN
#define LDBL_MIN __LDBL_MIN__ #define LDBL_MIN __LDBL_MIN__
#if (defined(__cplusplus) && __cplusplus >= 201703L) \
|| (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
#undef FLT_DECIMAL_DIG
#define FLT_DECIMAL_DIG __FLT_DECIMAL_DIG__
#undef DBL_DECIMAL_DIG
#define DBL_DECIMAL_DIG __DBL_DECIMAL_DIG__
#undef LDBL_DECIMAL_DIG
#define LDBL_DECIMAL_DIG __LDBL_DECIMAL_DIG__
#undef FLT_TRUE_MIN #undef FLT_TRUE_MIN
#define FLT_TRUE_MIN __FLT_DENORM_MIN__ #define FLT_TRUE_MIN __FLT_DENORM_MIN__
#undef DBL_TRUE_MIN #undef DBL_TRUE_MIN
@ -114,3 +120,5 @@
#define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__ #define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
#endif #endif
#endif

View File

@ -12,10 +12,8 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#if !defined(__FSTD_HDRS_LIMITS_H) || defined(__FSTD_HDRS_CXX_WRAP) #ifndef __FSTD_HDRS_LIMITS_H
#if !defined(__FSTD_HDRS_CXX_WRAP)
#define __FSTD_HDRS_LIMITS_H 1 #define __FSTD_HDRS_LIMITS_H 1
#endif
#undef CHAR_BIT #undef CHAR_BIT
#define CHAR_BIT __CHAR_BIT__ #define CHAR_BIT __CHAR_BIT__
@ -80,6 +78,8 @@
#undef ULONG_MAX #undef ULONG_MAX
#define ULONG_MAX (LONG_MAX * 2UL + 1UL) #define ULONG_MAX (LONG_MAX * 2UL + 1UL)
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#undef LLONG_MAX #undef LLONG_MAX
#define LLONG_MAX __LONG_LONG_MAX__ #define LLONG_MAX __LONG_LONG_MAX__
#undef LLONG_MIN #undef LLONG_MIN
@ -89,3 +89,5 @@
#define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) #define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
#endif #endif
#endif

View File

@ -16,6 +16,10 @@
#define __FSTD_HDRS_STDALIGN_H 1 #define __FSTD_HDRS_STDALIGN_H 1
#ifndef __cplusplus #ifndef __cplusplus
#if defined(__STDC_VERSION__) && __STDC_VERSION__ > 201710L
/* These do not need to be defined for C23+ */
#else
# undef alignas # undef alignas
# define alignas _Alignas # define alignas _Alignas
# undef alignof # undef alignof
@ -28,3 +32,5 @@
#endif #endif
#endif #endif
#endif

View File

@ -12,15 +12,17 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#if !defined(__FSTD_HDRS_STDARG_H) || defined(__FSTD_HDRS_CXX_WRAP) #ifndef __FSTD_HDRS_STDARG_H
#if !defined(__FSTD_HDRS_CXX_WRAP)
#define __FSTD_HDRS_STDARG_H 1 #define __FSTD_HDRS_STDARG_H 1
#endif
typedef __builtin_va_list va_list; typedef __builtin_va_list va_list;
#undef va_start #undef va_start
#define va_start(v, l) __builtin_va_start(v, l) #if defined(__STDC_VERSION__) && __STDC_VERSION__ > 201710L
# define va_start(v, ...) __builtin_va_start(v, 0)
#else
# define va_start(v, l) __builtin_va_start(v, l)
#endif
#undef va_end #undef va_end
#define va_end(v) __builtin_va_end(v) #define va_end(v) __builtin_va_end(v)
#undef va_arg #undef va_arg

View File

@ -12,12 +12,14 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#if !defined(__FSTD_HDRS_STDBOOL_H) || defined(__FSTD_HDRS_CXX_WRAP) #ifndef __FSTD_HDRS_STDBOOL_H
#if !defined(__FSTD_HDRS_CXX_WRAP)
#define __FSTD_HDRS_STDBOOL_H 1 #define __FSTD_HDRS_STDBOOL_H 1
#endif
#ifndef __cplusplus #ifndef __cplusplus
#if defined(__STDC_VERSION__) && __STDC_VERSION__ > 201710L
/* These do not need to be defined for C23+ */
#else
# undef bool # undef bool
# define bool _Bool # define bool _Bool
@ -27,6 +29,8 @@
# define false 0 # define false 0
#endif #endif
#endif
#undef __bool_true_false_are_defined #undef __bool_true_false_are_defined
#define __bool_true_false_are_defined 1 #define __bool_true_false_are_defined 1

View File

@ -12,10 +12,8 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#if !defined(__FSTD_HDRS_STDDEF_H) || defined(__FSTD_HDRS_CXX_WRAP) #ifndef __FSTD_HDRS_STDDEF_H
#if !defined(__FSTD_HDRS_CXX_WRAP)
#define __FSTD_HDRS_STDDEF_H 1 #define __FSTD_HDRS_STDDEF_H 1
#endif
typedef __SIZE_TYPE__ size_t; typedef __SIZE_TYPE__ size_t;
typedef __PTRDIFF_TYPE__ ptrdiff_t; typedef __PTRDIFF_TYPE__ ptrdiff_t;
@ -23,8 +21,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
#ifndef __cplusplus #ifndef __cplusplus
typedef __WCHAR_TYPE__ wchar_t; typedef __WCHAR_TYPE__ wchar_t;
/* XXX fix to use proper __STDC_VERSION__ number later on */ #if defined(__STDC_VERSION__) && __STDC_VERSION__ > 201710L
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202000L)
typedef typeof(nullptr) nullptr_t; typedef typeof(nullptr) nullptr_t;
#endif #endif
@ -44,10 +41,11 @@ typedef decltype(nullptr) nullptr_t;
#undef offsetof #undef offsetof
#define offsetof(s, m) __builtin_offsetof(s, m) #define offsetof(s, m) __builtin_offsetof(s, m)
/* XXX fix to use proper __STDC_VERSION__ number later on */ #if defined(__STDC_VERSION__) && __STDC_VERSION__ > 201710L
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202000L)
# undef unreachable # undef unreachable
# define unreachable() __builtin_unreachable() # define unreachable() __builtin_unreachable()
# define __STDC_VERSION_STDDEF_H__ 202311L
#endif #endif
#endif #endif

View File

@ -12,10 +12,8 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
#if !defined(__FSTD_HDRS_STDINT_H) || defined(__FSTD_HDRS_CXX_WRAP) #ifndef __FSTD_HDRS_STDINT_H
#if !defined(__FSTD_HDRS_CXX_WRAP)
#define __FSTD_HDRS_STDINT_H 1 #define __FSTD_HDRS_STDINT_H 1
#endif
#ifdef __UINT8_TYPE__ #ifdef __UINT8_TYPE__
typedef __UINT8_TYPE__ uint8_t; typedef __UINT8_TYPE__ uint8_t;