From patchwork Sat Nov 14 00:09:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 1400191 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=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.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 4CXwhM07m9z9sTc for ; Sat, 14 Nov 2020 11:10:08 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BDB6C3950C78; Sat, 14 Nov 2020 00:10:05 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from esa1.mentor.iphmx.com (esa1.mentor.iphmx.com [68.232.129.153]) by sourceware.org (Postfix) with ESMTPS id 081453854831 for ; Sat, 14 Nov 2020 00:10:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 081453854831 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: U68vWAC7lDg7P6AmHnp+dDaPvy4kNLaiv9p694qVmBWN5211ybhucJeyM0ifKTAmASObdfvlK+ C1TeZcgSdOerEeN60c5wNMzUz1vHnZvTwmfTsbmhi/aujRn5B+cYju5b6cf/aEqyDKRPlUjZNh frYmhT+tYhZ5KdN9VeoRi3f1hAOOTuSobiNulbOmcXFp4kqBKbIIhbW5N3fhybmoM2yeoahYRn ROuf6qvn92GpQkAt406arj9dRwa9H8NDEjnl2jzc1qWQA1SZNWU0dj5uGE2E95zwrSHFgh1d0D ARQ= X-IronPort-AV: E=Sophos;i="5.77,476,1596528000"; d="scan'208";a="57353655" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa1.mentor.iphmx.com with ESMTP; 13 Nov 2020 16:10:01 -0800 IronPort-SDR: c9A1fHNy6ngtzyOLOV37Qr5SI+NaJucEzgSIkJkhJzcXXjizE1+F8KGezysd0K5s3h5+pPtXrf u/4c8ax2JZc42njZoU1KWSkTcFIAjTAS5QcWF618gVovVxj5b7CUIlZ9YiBv5zV5HYBkpXZeMK Pdx/zPiXdbfKHD4syQMqDKLHfMz8DlVUmJYBkepEx8iobI+MkUGqQI+Ud9E+K/MwBUhkS+XUn0 s3DknXUyV+twbKCjhILfUr3TAyq7ppl3OIbZ7vHpRpjtwGuDdfVDn6I492TB2E2e/nxMjChPGl q+Q= Date: Sat, 14 Nov 2020 00:09:56 +0000 From: Joseph Myers X-X-Sender: jsm28@digraph.polyomino.org.uk To: Subject: float.h: Handle C2x __STDC_WANT_IEC_60559_EXT__ Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-02.mgc.mentorg.com (139.181.222.2) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-Spam-Status: No, score=-3129.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" TS 18661-1 and 18661-2 have various definitions conditional on __STDC_WANT_IEC_60559_BFP_EXT__ and __STDC_WANT_IEC_60559_DFP_EXT__ macros. When those TSes were integrated into C2x, most of the feature test macro conditionals were removed (with declarations for decimal FP becoming conditional only on whether decimal FP is supported by the implementation and those for binary FP becoming unconditionally required). A few tests of those feature test macros remained for declarations that appeared only in Annex F and not in the main part of the standard. A change accepted for C2x at the last WG14 meeting (but not yet added to the working draft in git) was to replace both those macros by __STDC_WANT_IEC_60559_EXT__; if __STDC_WANT_IEC_60559_EXT__ is defined, the specific declarations in the headers will then depend on which features are supported by the implementation, as for declarations not controlled by a feature test macro at all. Thus, add a check of __STDC_WANT_IEC_60559_EXT__ for CR_DECIMAL_DIG in float.h, the only case of this change relevant to GCC. Bootstrapped with no regressions for x86_64-pc-linux-gnu. OK to commit? gcc/ 2020-11-14 Joseph Myers * ginclude/float.h (CR_DECIMAL_DIG): Also define for [__STDC_WANT_IEC_60559_EXT__]. gcc/testsuite/ 2020-11-14 Joseph Myers * gcc.dg/cr-decimal-dig-3.c: New test. diff --git a/gcc/ginclude/float.h b/gcc/ginclude/float.h index 9c4b0385568..0442f26ec56 100644 --- a/gcc/ginclude/float.h +++ b/gcc/ginclude/float.h @@ -250,7 +250,8 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #endif /* C2X */ -#ifdef __STDC_WANT_IEC_60559_BFP_EXT__ +#if (defined __STDC_WANT_IEC_60559_BFP_EXT__ \ + || defined __STDC_WANT_IEC_60559_EXT__) /* Number of decimal digits for which conversions between decimal character strings and binary formats, in both directions, are correctly rounded. */ diff --git a/gcc/testsuite/gcc.dg/cr-decimal-dig-3.c b/gcc/testsuite/gcc.dg/cr-decimal-dig-3.c new file mode 100644 index 00000000000..8e07b67dd52 --- /dev/null +++ b/gcc/testsuite/gcc.dg/cr-decimal-dig-3.c @@ -0,0 +1,14 @@ +/* Test C2x CR_DECIMAL_DIG: defined for __STDC_WANT_IEC_60559_EXT__. */ +/* { dg-do compile } */ +/* { dg-options "-std=c2x" } */ + +#define __STDC_WANT_IEC_60559_EXT__ +#include + +#ifndef CR_DECIMAL_DIG +#error "CR_DECIMAL_DIG not defined" +#endif + +#if CR_DECIMAL_DIG < DECIMAL_DIG + 3 +#error "CR_DECIMAL_DIG too small" +#endif