diff options
Diffstat (limited to 'contrib/llvm-project/clang/lib/Headers/limits.h')
-rw-r--r-- | contrib/llvm-project/clang/lib/Headers/limits.h | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/contrib/llvm-project/clang/lib/Headers/limits.h b/contrib/llvm-project/clang/lib/Headers/limits.h index c653580bac4e..56dffe568486 100644 --- a/contrib/llvm-project/clang/lib/Headers/limits.h +++ b/contrib/llvm-project/clang/lib/Headers/limits.h @@ -9,6 +9,10 @@ #ifndef __CLANG_LIMITS_H #define __CLANG_LIMITS_H +#if defined(__MVS__) && __has_include_next(<limits.h>) +#include_next <limits.h> +#else + /* The system's limits.h may, in turn, try to #include_next GCC's limits.h. Avert this #include_next madness. */ #if defined __GNUC__ && !defined _GCC_LIMITS_H_ @@ -52,7 +56,11 @@ #define LONG_MIN (-__LONG_MAX__ -1L) #define UCHAR_MAX (__SCHAR_MAX__*2 +1) -#define USHRT_MAX (__SHRT_MAX__ *2 +1) +#if __SHRT_WIDTH__ < __INT_WIDTH__ +#define USHRT_MAX (__SHRT_MAX__ * 2 + 1) +#else +#define USHRT_MAX (__SHRT_MAX__ * 2U + 1U) +#endif #define UINT_MAX (__INT_MAX__ *2U +1U) #define ULONG_MAX (__LONG_MAX__ *2UL+1UL) @@ -62,6 +70,24 @@ #define CHAR_BIT __CHAR_BIT__ +/* C23 5.2.4.2.1 */ +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L +#define BOOL_WIDTH __BOOL_WIDTH__ +#define CHAR_WIDTH CHAR_BIT +#define SCHAR_WIDTH CHAR_BIT +#define UCHAR_WIDTH CHAR_BIT +#define USHRT_WIDTH __SHRT_WIDTH__ +#define SHRT_WIDTH __SHRT_WIDTH__ +#define UINT_WIDTH __INT_WIDTH__ +#define INT_WIDTH __INT_WIDTH__ +#define ULONG_WIDTH __LONG_WIDTH__ +#define LONG_WIDTH __LONG_WIDTH__ +#define ULLONG_WIDTH __LLONG_WIDTH__ +#define LLONG_WIDTH __LLONG_WIDTH__ + +#define BITINT_MAXWIDTH __BITINT_MAXWIDTH__ +#endif + #ifdef __CHAR_UNSIGNED__ /* -funsigned-char */ #define CHAR_MIN 0 #define CHAR_MAX UCHAR_MAX @@ -73,7 +99,8 @@ /* C99 5.2.4.2.1: Added long long. C++11 18.3.3.2: same contents as the Standard C Library header <limits.h>. */ -#if __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ + (defined(__cplusplus) && __cplusplus >= 201103L) #undef LLONG_MIN #undef LLONG_MAX @@ -99,4 +126,5 @@ #define ULONG_LONG_MAX (__LONG_LONG_MAX__*2ULL+1ULL) #endif +#endif /* __MVS__ */ #endif /* __CLANG_LIMITS_H */ |