From patchwork Wed Aug 19 16:39:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 1347940 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BWtmY0C7Fz9sPf for ; Thu, 20 Aug 2020 02:39:57 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D3093386F009; Wed, 19 Aug 2020 16:39:53 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180]) by sourceware.org (Postfix) with ESMTPS id 3A55A386EC72 for ; Wed, 19 Aug 2020 16:39:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3A55A386EC72 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=joseph_myers@mentor.com IronPort-SDR: 6gZjZdlL2abYhK2gT6/Bs54lmB8qQuR0hJxAMvrtrZHjZXJKP0wXUK2DSSTIfv7PuwniuWJizq 4P9LhUZPLvf16UkKoJvjgt2Ks917W78h0N+m+LGIzVTLQ6k5cMtYSiINDMhY1BqW97dtzQSdtp HukOCuoGrCzE+yP68afAPbOFv6owm4o3cgccVrYV72yniBN44wnvtWae0x2pSIQu9vSC/stkvd ZOsajE1ifpjkshpLhXiHHLCJ68or/iA8470gkFttoG8pIzjlL4wSKJgiDhvbSjfACaUaojwGfv K0I= X-IronPort-AV: E=Sophos;i="5.76,332,1592899200"; d="scan'208";a="52049237" Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa3.mentor.iphmx.com with ESMTP; 19 Aug 2020 08:39:51 -0800 IronPort-SDR: 2hUiajBUwBhE39bUA5lRTzOvHJ7QgI0cUcinrNBomEzwvwq3S5P3d5Pdg8UgvjDBoHIzSOkgDV H8AWuzpSwICUdqDTAnuQ4zfzmPvHN2W2W4V4iHAd4Am/Xc2TR9iNZyIL9tTnrXOhZSgIuxcVmm UoTdwggGdJ+AV4FEd6RxXxufQcwaFhAIxgO6+ckbBigi0J+WLoCdLod3qFfqBmA6gdksNrJ018 1vKc6QG+kErYz1Mb83u9LkCm4C69Dn8ln3H6zVynrTSL6mJrRsRkVrxlNS3LriZW057kVEqmm7 JnI= Date: Wed, 19 Aug 2020 16:39:45 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Subject: Add C2x BOOL_MAX and BOOL_WIDTH to limits.h Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To SVR-IES-MBX-03.mgc.mentorg.com (139.181.222.3) X-Spam-Status: No, score=-3132.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" C2x adds BOOL_MAX and BOOL_WIDTH macros to . This patch adds them to glibc's for the case when they aren't defined by GCC's . Tested for x86_64. 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 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 . */ # include