]> sourceware.org Git - glibc.git/commitdiff
Add C2x BOOL_MAX and BOOL_WIDTH to limits.h.
authorJoseph Myers <joseph@codesourcery.com>
Wed, 19 Aug 2020 22:46:41 +0000 (22:46 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 19 Aug 2020 22:46:41 +0000 (22:46 +0000)
C2x adds BOOL_MAX and BOOL_WIDTH macros to <limits.h>.  This patch
adds them to glibc's <limits.h> for the case when they aren't defined
by GCC's <limits.h>.

Tested for x86_64.

include/limits.h

index 8195da78a4a6074d737ec45ba27b8fec6005543e..29e9b943b94364034579f4d8d97b90f191b76630 100644 (file)
 # endif
 #endif /* Use IEC_60559_BFP_EXT.  */
 
+/* The macros for _Bool are not defined by GCC's <limits.h> before GCC
+   11, or if _GNU_SOURCE is defined rather than enabling C2x support
+   with -std.  */
+#if __GLIBC_USE (ISOC2X)
+# ifndef BOOL_MAX
+#  define BOOL_MAX 1
+# endif
+# ifndef BOOL_WIDTH
+#  define BOOL_WIDTH 1
+# endif
+#endif
+
 #ifdef __USE_POSIX
 /* POSIX adds things to <limits.h>.  */
 # include <bits/posix1_lim.h>
This page took 0.040652 seconds and 5 git commands to generate.