From 144b9d357142d44d7f7c224773e98e1ebecb6161 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Thu, 23 Mar 2023 19:24:51 +0100 Subject: [PATCH] Misc fixes and improvements --- float.h | 12 ++++++++++-- limits.h | 4 ++-- stdalign.h | 4 ++-- stdarg.h | 4 ++-- stdbool.h | 4 ++-- stddef.h | 4 ++-- stdint.h | 18 ++++++++++-------- 7 files changed, 30 insertions(+), 20 deletions(-) diff --git a/float.h b/float.h index b8887ed..4299bad 100644 --- a/float.h +++ b/float.h @@ -1,5 +1,5 @@ -#if !defined(_FLOAT_H) || defined(__LIBC_GUARDLESS_INCLUDE) -#if !defined(__LIBC_GUARDLESS_INCLUDE) +#if !defined(_FLOAT_H) || defined(__LIBC_CXX_WRAP) +#if !defined(__LIBC_CXX_WRAP) #define _FLOAT_H 1 #endif @@ -54,6 +54,14 @@ #define DBL_MIN __DBL_MIN__ #define LDBL_MIN __LDBL_MIN__ +#define FLT_TRUE_MIN __FLT_DENORM_MIN__ +#define DBL_TRUE_MIN __DBL_DENORM_MIN__ +#define LDBL_TRUE_MIN __LDBL_DENORM_MIN__ + +#define FLT_HAS_SUBNORM __FLT_HAS_DENORM__ +#define DBL_HAS_SUBNORM __DBL_HAS_DENORM__ +#define LDBL_HAS_SUBNORM __LDBL_HAS_DENORM__ + #endif #endif diff --git a/limits.h b/limits.h index 0ef495a..5a1e5a9 100644 --- a/limits.h +++ b/limits.h @@ -1,5 +1,5 @@ -#if !defined(_LIMITS_H) || defined(__LIBC_GUARDLESS_INCLUDE) -#if !defined(__LIBC_GUARDLESS_INCLUDE) +#if !defined(_LIMITS_H) || defined(__LIBC_CXX_WRAP) +#if !defined(__LIBC_CXX_WRAP) #define _LIMITS_H 1 #endif diff --git a/stdalign.h b/stdalign.h index abdea0c..45bdce8 100644 --- a/stdalign.h +++ b/stdalign.h @@ -1,5 +1,5 @@ -#if !defined(_STDALIGN_H) || defined(__LIBC_GUARDLESS_INCLUDE) -#if !defined(__LIBC_GUARDLESS_INCLUDE) +#if !defined(_STDALIGN_H) || defined(__LIBC_CXX_WRAP) +#if !defined(__LIBC_CXX_WRAP) #define _STDALIGN_H 1 #endif diff --git a/stdarg.h b/stdarg.h index d756a59..72df8c7 100644 --- a/stdarg.h +++ b/stdarg.h @@ -1,5 +1,5 @@ -#if !defined(_STDARG_H) || defined(__LIBC_GUARDLESS_INCLUDE) -#if !defined(__LIBC_GUARDLESS_INCLUDE) +#if !defined(_STDARG_H) || defined(__LIBC_CXX_WRAP) +#if !defined(__LIBC_CXX_WRAP) #define _STDARG_H 1 #endif diff --git a/stdbool.h b/stdbool.h index 365536c..46dc75b 100644 --- a/stdbool.h +++ b/stdbool.h @@ -1,5 +1,5 @@ -#if !defined(_STDBOOL_H) || defined(__LIBC_GUARDLESS_INCLUDE) -#if !defined(__LIBC_GUARDLESS_INCLUDE) +#if !defined(_STDBOOL_H) || defined(__LIBC_CXX_WRAP) +#if !defined(__LIBC_CXX_WRAP) #define _STDBOOL_H 1 #endif diff --git a/stddef.h b/stddef.h index b40d82d..066bb3f 100644 --- a/stddef.h +++ b/stddef.h @@ -1,5 +1,5 @@ -#if !defined(_STDDEF_H) || defined(__LIBC_GUARDLESS_INCLUDE) -#if !defined(__LIBC_GUARDLESS_INCLUDE) +#if !defined(_STDDEF_H) || defined(__LIBC_CXX_WRAP) +#if !defined(__LIBC_CXX_WRAP) #define _STDDEF_H 1 #endif diff --git a/stdint.h b/stdint.h index 6b993a3..3fccff0 100644 --- a/stdint.h +++ b/stdint.h @@ -1,5 +1,5 @@ -#if !defined(_STDINT_H) || defined(__LIBC_GUARDLESS_INCLUDE) -#if !defined(__LIBC_GUARDLESS_INCLUDE) +#if !defined(_STDINT_H) || defined(__LIBC_CXX_WRAP) +#if !defined(__LIBC_CXX_WRAP) #define _STDINT_H 1 #endif @@ -44,15 +44,17 @@ typedef __INTMAX_TYPE__ intmax_t; /* Clang and GCC have different mechanisms for INT32_C and friends. */ #ifdef __clang__ -# define __LIBC_C_EXPAND_JOIN(x, suffix) x ## suffix -# define __LIBC_C_JOIN(x, suffix) __LIBC_C_EXPAND_JOIN(x, suffix) +# ifndef __LIBC_C_JOIN +# define __LIBC_C_EXPAND_JOIN(x, suffix) x ## suffix +# define __LIBC_C_JOIN(x, suffix) __LIBC_C_EXPAND_JOIN(x, suffix) +# endif -# define INT8_C(x) __LIBC_C_JOIN(x, __INT8_C_SUFFIX__) +# define INT8_C(x) __LIBC_C_JOIN(x, __INT8_C_SUFFIX__) # define INT16_C(x) __LIBC_C_JOIN(x, __INT16_C_SUFFIX__) # define INT32_C(x) __LIBC_C_JOIN(x, __INT32_C_SUFFIX__) # define INT64_C(x) __LIBC_C_JOIN(x, __INT64_C_SUFFIX__) -# define UINT8_C(x) __LIBC_C_JOIN(x, __UINT8_C_SUFFIX__) +# define UINT8_C(x) __LIBC_C_JOIN(x, __UINT8_C_SUFFIX__) # define UINT16_C(x) __LIBC_C_JOIN(x, __UINT16_C_SUFFIX__) # define UINT32_C(x) __LIBC_C_JOIN(x, __UINT32_C_SUFFIX__) # define UINT64_C(x) __LIBC_C_JOIN(x, __UINT64_C_SUFFIX__) @@ -60,12 +62,12 @@ typedef __INTMAX_TYPE__ intmax_t; # define INTMAX_C(x) __LIBC_C_JOIN(x, __INTMAX_C_SUFFIX__) # define UINTMAX_C(x) __LIBC_C_JOIN(x, __UINTMAX_C_SUFFIX__) #else -# define INT8_C(x) __INT8_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_C(x) __UINT8_C(x) +# 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)