diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2021-07-30 12:56:24 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2021-07-31 12:00:31 -0700 |
commit | 8e4d6bf27e0efbfca04c86cc9d6598518e83bd21 (patch) | |
tree | 88342e65a8f9e6541e96f3ce8aab8ec9a261f467 /lib/limits.in.h | |
parent | 804ac808a9b17d7ee7cf49f7c713c4a4e4d6423f (diff) | |
download | gnulib-8e4d6bf27e0efbfca04c86cc9d6598518e83bd21.tar.gz |
limits-h: add BOOL_MAX, BOOL_WIDTH
* doc/posix-headers/limits.texi (limits.h): Document them.
* lib/limits.in.h: Also define CHAR_WIDTH etc. if C2x.
(BOOL_MAX, BOOL_WIDTH): New macros, from C2x.
* m4/limits-h.m4 (gl_LIMITS_H): Also check BOOL_WIDTH.
Diffstat (limited to 'lib/limits.in.h')
-rw-r--r-- | lib/limits.in.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/limits.in.h b/lib/limits.in.h index 65ea12dbc8..2ecafebb00 100644 --- a/lib/limits.in.h +++ b/lib/limits.in.h @@ -99,10 +99,11 @@ # endif #endif -/* Macros specified by ISO/IEC TS 18661-1:2014. */ +/* Macros specified by C2x and by ISO/IEC TS 18661-1:2014. */ #if (! defined ULLONG_WIDTH \ - && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__)) + && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__ \ + || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__))) # define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX) # define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX) # define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX) @@ -114,7 +115,16 @@ # define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX) # define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX) # define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX) -#endif /* !ULLONG_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */ +#endif + +/* Macros specified by C2x. */ + +#if (! defined BOOL_WIDTH \ + && (defined _GNU_SOURCE \ + || (defined __STDC_VERSION__ && 201710 < __STDC_VERSION__))) +# define BOOL_MAX 1 +# define BOOL_WIDTH 1 +#endif #endif /* _@GUARD_PREFIX@_LIMITS_H */ #endif /* _@GUARD_PREFIX@_LIMITS_H */ |