From bbd441b204ca06f4ae8039e89e82d0160d1b2616 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Sun, 16 Apr 2023 07:24:29 +0200 Subject: [PATCH] Misc macro definition updates --- float.h | 10 +++++----- iso646.h | 4 ++-- limits.h | 26 +++++++++++++------------- stdalign.h | 10 +++++----- stdarg.h | 10 +++++----- stdbool.h | 10 +++++----- stddef.h | 10 +++++----- stdint.h | 52 +++++++++++++++++++++++++++++---------------------- stdnoreturn.h | 4 ++-- 9 files changed, 72 insertions(+), 64 deletions(-) diff --git a/float.h b/float.h index 4299bad..f45ab80 100644 --- a/float.h +++ b/float.h @@ -1,10 +1,10 @@ -#if !defined(_FLOAT_H) || defined(__LIBC_CXX_WRAP) -#if !defined(__LIBC_CXX_WRAP) -#define _FLOAT_H 1 +#if !defined(__FSTD_HDRS_FLOAT_H) || defined(__FSTD_HDRS_CXX_WRAP) +#if !defined(__FSTD_HDRS_CXX_WRAP) +#define __FSTD_HDRS_FLOAT_H 1 #endif -#ifndef __FLOAT_H_MACROS -#define __FLOAT_H_MACROS 1 +#ifndef __FSTD_HDRS_FLOAT_H_MACROS +#define __FSTD_HDRS_FLOAT_H_MACROS 1 #define FLT_ROUNDS 1 diff --git a/iso646.h b/iso646.h index 599705e..cd08919 100644 --- a/iso646.h +++ b/iso646.h @@ -1,5 +1,5 @@ -#ifndef _ISO646_H -#define _ISO646_H 1 +#ifndef __FSTD_HDRS_ISO646_H +#define __FSTD_HDRS_ISO646_H 1 #define and && #define and_eq &= diff --git a/limits.h b/limits.h index 5a1e5a9..6323374 100644 --- a/limits.h +++ b/limits.h @@ -1,14 +1,14 @@ -#if !defined(_LIMITS_H) || defined(__LIBC_CXX_WRAP) -#if !defined(__LIBC_CXX_WRAP) -#define _LIMITS_H 1 +#if !defined(__FSTD_HDRS_LIMITS_H) || defined(__FSTD_HDRS_CXX_WRAP) +#if !defined(__FSTD_HDRS_CXX_WRAP) +#define __FSTD_HDRS_LIMITS_H 1 #endif -#ifndef __LIMITS_H_MACROS -#define __LIMITS_H_MACROS 1 +#ifndef __FSTD_HDRS_LIMITS_H_MACROS +#define __FSTD_HDRS_LIMITS_H_MACROS 1 -#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) +#ifndef __FSTD_HDRS_C_JOIN +# define __FSTD_HDRS_C_EXPAND_JOIN(x, suffix) x ## suffix +# define __FSTD_HDRS_C_JOIN(x, suffix) __FSTD_HDRS_C_EXPAND_JOIN(x, suffix) #endif #define CHAR_BIT __CHAR_BIT__ @@ -18,7 +18,7 @@ #define SCHAR_MAX __SCHAR_MAX__ #define SCHAR_MIN (-SCHAR_MAX - 1) -#define UCHAR_MAX (__LIBC_C_JOIN(SCHAR_MAX, U) * 2 + 1) +#define UCHAR_MAX (__FSTD_HDRS_C_JOIN(SCHAR_MAX, U) * 2 + 1) #ifdef __CHAR_UNSIGNED__ # define CHAR_MAX UCHAR_MAX @@ -31,22 +31,22 @@ #define SHRT_MAX __SHRT_MAX__ #define SHRT_MIN (-SHRT_MAX - 1) -#define USHRT_MAX (__LIBC_C_JOIN(SHRT_MAX, U) * 2 + 1) +#define USHRT_MAX (__FSTD_HDRS_C_JOIN(SHRT_MAX, U) * 2 + 1) #define INT_MAX __INT_MAX__ #define INT_MIN (-INT_MAX - 1) -#define UINT_MAX (__LIBC_C_JOIN(INT_MAX, U) * 2 + 1) +#define UINT_MAX (__FSTD_HDRS_C_JOIN(INT_MAX, U) * 2 + 1) #define LONG_MAX __LONG_MAX__ #define LONG_MIN (-LONG_MAX - 1) -#define ULONG_MAX (__LIBC_C_JOIN(LONG_MAX, U) * 2 + 1) +#define ULONG_MAX (__FSTD_HDRS_C_JOIN(LONG_MAX, U) * 2 + 1) #define LLONG_MAX __LONG_LONG_MAX__ #define LLONG_MIN (-LLONG_MAX - 1) -#define ULLONG_MAX (__LIBC_C_JOIN(LLONG_MAX, U) * 2 + 1) +#define ULLONG_MAX (__FSTD_HDRS_C_JOIN(LLONG_MAX, U) * 2 + 1) #endif diff --git a/stdalign.h b/stdalign.h index 45bdce8..d138500 100644 --- a/stdalign.h +++ b/stdalign.h @@ -1,10 +1,10 @@ -#if !defined(_STDALIGN_H) || defined(__LIBC_CXX_WRAP) -#if !defined(__LIBC_CXX_WRAP) -#define _STDALIGN_H 1 +#if !defined(__FSTD_HDRS_STDALIGN_H) || defined(__FSTD_HDRS_CXX_WRAP) +#if !defined(__FSTD_HDRS_CXX_WRAP) +#define __FSTD_HDRS_STDALIGN_H 1 #endif -#ifndef __STDALIGN_H_MACROS -#define __STDALIGN_H_MACROS 1 +#ifndef __FSTD_HDRS_STDALIGN_H_MACROS +#define __FSTD_HDRS_STDALIGN_H_MACROS 1 #ifndef __cplusplus # define alignas _Alignas diff --git a/stdarg.h b/stdarg.h index 72df8c7..6d5e385 100644 --- a/stdarg.h +++ b/stdarg.h @@ -1,12 +1,12 @@ -#if !defined(_STDARG_H) || defined(__LIBC_CXX_WRAP) -#if !defined(__LIBC_CXX_WRAP) -#define _STDARG_H 1 +#if !defined(__FSTD_HDRS_STDARG_H) || defined(__FSTD_HDRS_CXX_WRAP) +#if !defined(__FSTD_HDRS_CXX_WRAP) +#define __FSTD_HDRS_STDARG_H 1 #endif typedef __builtin_va_list va_list; -#ifndef __STDARG_H_MACROS -#define __STDARG_H_MACROS 1 +#ifndef __FSTD_HDRS_STDARG_H_MACROS +#define __FSTD_HDRS_STDARG_H_MACROS 1 #define va_start(v, l) __builtin_va_start(v, l) #define va_end(v) __builtin_va_end(v) diff --git a/stdbool.h b/stdbool.h index 46dc75b..77a85ae 100644 --- a/stdbool.h +++ b/stdbool.h @@ -1,10 +1,10 @@ -#if !defined(_STDBOOL_H) || defined(__LIBC_CXX_WRAP) -#if !defined(__LIBC_CXX_WRAP) -#define _STDBOOL_H 1 +#if !defined(__FSTD_HDRS_STDBOOL_H) || defined(__FSTD_HDRS_CXX_WRAP) +#if !defined(__FSTD_HDRS_CXX_WRAP) +#define __FSTD_HDRS_STDBOOL_H 1 #endif -#ifndef __STDBOOL_H_MACROS -#define __STDBOOL_H_MACROS 1 +#ifndef __FSTD_HDRS_STDBOOL_H_MACROS +#define __FSTD_HDRS_STDBOOL_H_MACROS 1 #ifndef __cplusplus # define bool _Bool diff --git a/stddef.h b/stddef.h index 066bb3f..d5fb84b 100644 --- a/stddef.h +++ b/stddef.h @@ -1,6 +1,6 @@ -#if !defined(_STDDEF_H) || defined(__LIBC_CXX_WRAP) -#if !defined(__LIBC_CXX_WRAP) -#define _STDDEF_H 1 +#if !defined(__FSTD_HDRS_STDDEF_H) || defined(__FSTD_HDRS_CXX_WRAP) +#if !defined(__FSTD_HDRS_CXX_WRAP) +#define __FSTD_HDRS_STDDEF_H 1 #endif typedef __SIZE_TYPE__ size_t; @@ -20,8 +20,8 @@ typedef typeof(nullptr) nullptr_t; typedef decltype(nullptr) nullptr_t; #endif -#ifndef __STDDEF_H_MACROS -#define __STDDEF_H_MACROS 1 +#ifndef __FSTD_HDRS_STDDEF_H_MACROS +#define __FSTD_HDRS_STDDEF_H_MACROS 1 #ifdef NULL #undef NULL diff --git a/stdint.h b/stdint.h index 3fccff0..e249961 100644 --- a/stdint.h +++ b/stdint.h @@ -1,6 +1,6 @@ -#if !defined(_STDINT_H) || defined(__LIBC_CXX_WRAP) -#if !defined(__LIBC_CXX_WRAP) -#define _STDINT_H 1 +#if !defined(__FSTD_HDRS_STDINT_H) || defined(__FSTD_HDRS_CXX_WRAP) +#if !defined(__FSTD_HDRS_CXX_WRAP) +#define __FSTD_HDRS_STDINT_H 1 #endif typedef __UINT8_TYPE__ uint8_t; @@ -39,28 +39,28 @@ typedef __INTPTR_TYPE__ intptr_t; typedef __UINTMAX_TYPE__ uintmax_t; typedef __INTMAX_TYPE__ intmax_t; -#ifndef __STDINT_H_MACROS -#define __STDINT_H_MACROS 1 +#ifndef __FSTD_HDRS_STDINT_H_MACROS +#define __FSTD_HDRS_STDINT_H_MACROS 1 /* Clang and GCC have different mechanisms for INT32_C and friends. */ #ifdef __clang__ -# 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) +# ifndef __FSTD_HDRS_C_JOIN +# define __FSTD_HDRS_C_EXPAND_JOIN(x, suffix) x ## suffix +# define __FSTD_HDRS_C_JOIN(x, suffix) __FSTD_HDRS_C_EXPAND_JOIN(x, suffix) # endif -# 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 INT8_C(x) __FSTD_HDRS_C_JOIN(x, __INT8_C_SUFFIX__) +# define INT16_C(x) __FSTD_HDRS_C_JOIN(x, __INT16_C_SUFFIX__) +# define INT32_C(x) __FSTD_HDRS_C_JOIN(x, __INT32_C_SUFFIX__) +# define INT64_C(x) __FSTD_HDRS_C_JOIN(x, __INT64_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__) +# define UINT8_C(x) __FSTD_HDRS_C_JOIN(x, __UINT8_C_SUFFIX__) +# define UINT16_C(x) __FSTD_HDRS_C_JOIN(x, __UINT16_C_SUFFIX__) +# define UINT32_C(x) __FSTD_HDRS_C_JOIN(x, __UINT32_C_SUFFIX__) +# define UINT64_C(x) __FSTD_HDRS_C_JOIN(x, __UINT64_C_SUFFIX__) -# define INTMAX_C(x) __LIBC_C_JOIN(x, __INTMAX_C_SUFFIX__) -# define UINTMAX_C(x) __LIBC_C_JOIN(x, __UINTMAX_C_SUFFIX__) +# define INTMAX_C(x) __FSTD_HDRS_C_JOIN(x, __INTMAX_C_SUFFIX__) +# define UINTMAX_C(x) __FSTD_HDRS_C_JOIN(x, __UINTMAX_C_SUFFIX__) #else # define INT8_C(x) __INT8_C(x) # define INT16_C(x) __INT16_C(x) @@ -137,11 +137,19 @@ typedef __INTMAX_TYPE__ intmax_t; #define SIZE_MAX __SIZE_MAX__ -#define WCHAR_MAX __WCHAR_MAX__ -#define WCHAR_MIN (-WCHAR_MAX - 1) +#ifndef WCHAR_MAX +# define WCHAR_MAX __WCHAR_MAX__ +#endif +#ifndef WCHAR_MIN +# define WCHAR_MIN (-WCHAR_MAX - 1) +#endif -#define WINT_MAX __WINT_MAX__ -#define WINT_MIN (-WINT_MAX - 1) +#ifndef WINT_MAX +# define WINT_MAX __WINT_MAX__ +#endif +#ifndef WINT_MIN +# define WINT_MIN (-WINT_MAX - 1) +#endif #endif diff --git a/stdnoreturn.h b/stdnoreturn.h index 9c2691f..0ab1246 100644 --- a/stdnoreturn.h +++ b/stdnoreturn.h @@ -1,5 +1,5 @@ -#ifndef _STDNORETURN_H -#define _STDNORETURN_H 1 +#ifndef __FSTD_HDRS_STDNORETURN_H +#define __FSTD_HDRS_STDNORETURN_H 1 #define noreturn _Noreturn