File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,17 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
4242typedef __SIZE_TYPE__ size_t ;
4343#endif
4444
45+ /* ISO9899:2011 7.20 (C11 Annex K): Define risze_t if __STDC_WANT_LIB_EXT1__ is
46+ * enabled. */
47+ #if (defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 && \
48+ !defined (_RSIZE_T)) || __has_feature(modules)
49+ /* Always define rsize_t when modules are available. */
50+ #if !__has_feature(modules)
51+ #define _RSIZE_T
52+ #endif
53+ typedef __SIZE_TYPE__ rsize_t ;
54+ #endif
55+
4556#ifndef __cplusplus
4657/* Always define wchar_t when modules are available. */
4758#if !defined(_WCHAR_T) || __has_feature(modules)
Original file line number Diff line number Diff line change @@ -667,6 +667,12 @@ typedef __UINTMAX_TYPE__ uintmax_t;
667667#define PTRDIFF_MAX __INTN_MAX(__PTRDIFF_WIDTH__)
668668#define SIZE_MAX __UINTN_MAX(__SIZE_WIDTH__)
669669
670+ /* ISO9899:2011 7.20 (C11 Annex K): Define RSIZE_MAX if __STDC_WANT_LIB_EXT1__
671+ * is enabled. */
672+ #if defined(__STDC_WANT_LIB_EXT1__ ) && __STDC_WANT_LIB_EXT1__ >= 1
673+ #define RSIZE_MAX (SIZE_MAX >> 1)
674+ #endif
675+
670676/* C99 7.18.2.5 Limits of greatest-width integer types. */
671677#define INTMAX_MIN __INTN_MIN(__INTMAX_WIDTH__)
672678#define INTMAX_MAX __INTN_MAX(__INTMAX_WIDTH__)
Original file line number Diff line number Diff line change @@ -17,3 +17,8 @@ _Static_assert(__alignas_is_defined, "");
1717_Static_assert (__alignof_is_defined , "" );
1818alignas(alignof(int )) char c [4 ];
1919_Static_assert (__alignof(c ) == 4 , "" );
20+
21+ #define __STDC_WANT_LIB_EXT1__ 1
22+ #include <stddef.h>
23+ #include <stdint.h>
24+ rsize_t x = RSIZE_MAX ;
You can’t perform that action at this time.
0 commit comments