diff options
author | Daniel Dunbar <daniel@zuster.org> | 2013-04-12 23:24:56 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2013-04-12 23:24:56 +0000 |
commit | 2943d3dded877fbe0bb965756f047d379032d4ba (patch) | |
tree | e06b91255e0c019db32f97223b89993619083544 /lib/Headers | |
parent | e0c804b214cbca72e00ecefecb19b43c9b0cdda7 (diff) |
Headers: Add support for ISO9899:2011 rsize_t.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179427 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Headers')
-rw-r--r-- | lib/Headers/stddef.h | 11 | ||||
-rw-r--r-- | lib/Headers/stdint.h | 6 |
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/Headers/stddef.h b/lib/Headers/stddef.h index 52962248f6..c4861551da 100644 --- a/lib/Headers/stddef.h +++ b/lib/Headers/stddef.h @@ -42,6 +42,17 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; typedef __SIZE_TYPE__ size_t; #endif +/* ISO9899:2011 7.20 (C11 Annex K): Define risze_t if __STDC_WANT_LIB_EXT1__ is + * enabled. */ +#if (defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 && \ + !defined(_RSIZE_T)) || __has_feature(modules) +/* Always define rsize_t when modules are available. */ +#if !__has_feature(modules) +#define _RSIZE_T +#endif +typedef __SIZE_TYPE__ rsize_t; +#endif + #ifndef __cplusplus /* Always define wchar_t when modules are available. */ #if !defined(_WCHAR_T) || __has_feature(modules) diff --git a/lib/Headers/stdint.h b/lib/Headers/stdint.h index 051047f7d2..11529c0c67 100644 --- a/lib/Headers/stdint.h +++ b/lib/Headers/stdint.h @@ -667,6 +667,12 @@ typedef __UINTMAX_TYPE__ uintmax_t; #define PTRDIFF_MAX __INTN_MAX(__PTRDIFF_WIDTH__) #define SIZE_MAX __UINTN_MAX(__SIZE_WIDTH__) +/* ISO9899:2011 7.20 (C11 Annex K): Define RSIZE_MAX if __STDC_WANT_LIB_EXT1__ + * is enabled. */ +#if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1 +#define RSIZE_MAX (SIZE_MAX >> 1) +#endif + /* C99 7.18.2.5 Limits of greatest-width integer types. */ #define INTMAX_MIN __INTN_MIN(__INTMAX_WIDTH__) #define INTMAX_MAX __INTN_MAX(__INTMAX_WIDTH__) |