From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.4 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id CE7741F8C6 for ; Sat, 31 Jul 2021 19:01:56 +0000 (UTC) Received: from localhost ([::1]:41410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m9uF6-0007b4-8H for normalperson@yhbt.net; Sat, 31 Jul 2021 15:01:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45400) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m9uEv-0007av-Dx for bug-gnulib@gnu.org; Sat, 31 Jul 2021 15:01:41 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:37060) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m9uEt-00061x-6G for bug-gnulib@gnu.org; Sat, 31 Jul 2021 15:01:41 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id E40051600F1 for ; Sat, 31 Jul 2021 12:01:35 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id bceTiTWhW_OM; Sat, 31 Jul 2021 12:01:34 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id A8C221600DB; Sat, 31 Jul 2021 12:01:34 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id GS-f9vH8OoXy; Sat, 31 Jul 2021 12:01:34 -0700 (PDT) Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 788FC160083; Sat, 31 Jul 2021 12:01:34 -0700 (PDT) From: Paul Eggert To: bug-gnulib@gnu.org Subject: [PATCH 1/6] limits-h: add BOOL_MAX, BOOL_WIDTH Date: Sat, 31 Jul 2021 12:01:18 -0700 Message-Id: <20210731190124.279622-1-eggert@cs.ucla.edu> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@cs.ucla.edu; helo=zimbra.cs.ucla.edu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paul Eggert Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" * 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. --- ChangeLog | 8 ++++++++ doc/posix-headers/limits.texi | 4 ++++ lib/limits.in.h | 16 +++++++++++++--- m4/limits-h.m4 | 3 ++- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index d8a9bb1b8..dbf648571 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2021-07-30 Paul Eggert + + 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. + 2021-07-28 Simon Josefsson =20 maintainer-makefile: Respect cfg.mk setting announcement_Cc_, diff --git a/doc/posix-headers/limits.texi b/doc/posix-headers/limits.tex= i index edfc71619..22dc4239f 100644 --- a/doc/posix-headers/limits.texi +++ b/doc/posix-headers/limits.texi @@ -17,6 +17,10 @@ glibc 2.11 without @code{-D_GNU_SOURCE}, Cygwin, mingw= , MSVC 14. @item Macros like @code{CHAR_WIDTH} are not defined on some platforms: glibc 2.24, NetBSD 9.0, many others. +@item +The macros @code{BOOL_MAX} and @code{BOOL_WIDTH} are not defined on +some platforms: +glibc 2.32, many others. @end itemize =20 Portability problems fixed by Gnulib module @code{gethostname}: diff --git a/lib/limits.in.h b/lib/limits.in.h index 65ea12dbc..2ecafebb0 100644 --- a/lib/limits.in.h +++ b/lib/limits.in.h @@ -99,10 +99,11 @@ # endif #endif =20 -/* Macros specified by ISO/IEC TS 18661-1:2014. */ +/* Macros specified by C2x and by ISO/IEC TS 18661-1:2014. */ =20 #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 =20 #endif /* _@GUARD_PREFIX@_LIMITS_H */ #endif /* _@GUARD_PREFIX@_LIMITS_H */ diff --git a/m4/limits-h.m4 b/m4/limits-h.m4 index 70dbb7dcf..00c9fe9e5 100644 --- a/m4/limits-h.m4 +++ b/m4/limits-h.m4 @@ -11,7 +11,7 @@ AC_DEFUN_ONCE([gl_LIMITS_H], [ gl_CHECK_NEXT_HEADERS([limits.h]) =20 - AC_CACHE_CHECK([whether limits.h has LLONG_MAX, WORD_BIT, ULLONG_WIDTH= etc.], + AC_CACHE_CHECK([whether limits.h has WORD_BIT, BOOL_WIDTH etc.], [gl_cv_header_limits_width], [AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( @@ -22,6 +22,7 @@ AC_DEFUN_ONCE([gl_LIMITS_H], long long llm =3D LLONG_MAX; int wb =3D WORD_BIT; int ullw =3D ULLONG_WIDTH; + int bw =3D BOOL_WIDTH; ]])], [gl_cv_header_limits_width=3Dyes], [gl_cv_header_limits_width=3Dno])]) --=20 2.31.1