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.
*/
#if !defined(__FSTD_HDRS_FLOAT_H) || defined(__FSTD_HDRS_CXX_WRAP)
#if !defined(__FSTD_HDRS_CXX_WRAP)
#ifndef __FSTD_HDRS_FLOAT_H
#define __FSTD_HDRS_FLOAT_H 1
#endif
#undef FLT_ROUNDS
#define FLT_ROUNDS 1
@ -30,19 +28,17 @@
#undef LDBL_MANT_DIG
#define LDBL_MANT_DIG __LDBL_MANT_DIG__
#if (defined(__cplusplus) && __cplusplus >= 201103L) \
|| (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
#undef 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
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
#endif
#undef FLT_DIG
#define FLT_DIG __FLT_DIG__
#undef DBL_DIG
@ -99,6 +95,16 @@
#undef 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
#define FLT_TRUE_MIN __FLT_DENORM_MIN__
#undef DBL_TRUE_MIN
@ -114,3 +120,5 @@
#define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__
#endif
#endif

View File

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

View File

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

View File

@ -12,15 +12,17 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#if !defined(__FSTD_HDRS_STDARG_H) || defined(__FSTD_HDRS_CXX_WRAP)
#if !defined(__FSTD_HDRS_CXX_WRAP)
#ifndef __FSTD_HDRS_STDARG_H
#define __FSTD_HDRS_STDARG_H 1
#endif
typedef __builtin_va_list va_list;
#undef va_start
#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
#define va_end(v) __builtin_va_end(v)
#undef va_arg

View File

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

View File

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

View File

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