public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Joseph Myers <jsm28@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] Add C2x BOOL_MAX and BOOL_WIDTH to limits.h.
Date: Wed, 19 Aug 2020 22:46:57 +0000 (GMT)	[thread overview]
Message-ID: <20200819224657.DF9753857C5A@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e5baabf57b1f6bcaf60068b3fd24af649e4e91c6

commit e5baabf57b1f6bcaf60068b3fd24af649e4e91c6
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Wed Aug 19 22:46:41 2020 +0000

    Add C2x BOOL_MAX and BOOL_WIDTH to limits.h.
    
    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.

Diff:
---
 include/limits.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/limits.h b/include/limits.h
index 8195da78a4..29e9b943b9 100644
--- a/include/limits.h
+++ b/include/limits.h
@@ -178,6 +178,18 @@
 # 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>


                 reply	other threads:[~2020-08-19 22:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200819224657.DF9753857C5A@sourceware.org \
    --to=jsm28@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).