From patchwork Tue May 16 09:11:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 94565 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp284608vqo; Tue, 16 May 2023 02:13:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6e4l2+RY/Sjf4HA9flaJk/Bs62H3BPfsTBKn4Cg6HUDlzxXxhrBLkjLJbBwM/gBhJfleeH X-Received: by 2002:a17:907:1c14:b0:95e:d74d:c4e6 with SMTP id nc20-20020a1709071c1400b0095ed74dc4e6mr44377104ejc.25.1684228416876; Tue, 16 May 2023 02:13:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684228416; cv=none; d=google.com; s=arc-20160816; b=ZhoVI91WcX/ez8AaX/cTV5c61uxYnMXLATSnuQTHuva2B8HV7d4wDEC1p/ZjcpZf7U ZCxBJ7FJnNn8gLyJp8YRaupeWWxV08NbHu0anUmsbYU130i2IvdBRbE+FvgyXT9gNEis pNni33T70ZWFfPo9DXmT5SQRVUq/plfZNE/5880/HDMwaBfG1ufjGEiTa/0dHzLOGqNE z2QoB9peV9e0IcN65ZMGluz32TCbj2ItySUTztGaSpZxmmiD1Pt8e9TCyAuEuLv+Djyy vPQEE3GF/I3UmEhl5RmjyLfPwURNDqw6ckWOveAjHqo+HmKJLrUvC/8Ymm4fNKR/14Wm Ocbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=LXbU9XirQ8+0A/rfv2aXhCRjnj3T+2nRg8bduS9Hk1s=; b=T9piO0D2d8pNS78pe7pWB+cRE/95+Cqlf2fIhB01yuiHQISNTIGomDUe5Ugq3vMcVU y+18y0wj9oKPEOVSdsykwY5zlO9H3bKUjjX8AniNDEibdXaBNnbrO13eU11O+u8HA81M H/9fG8OL8tmNkT7j2OEr3r7m6xuFRmO42tDIXcZiAnUXt5KJsOY1WAWjtxJoB/S0u13h f0lc15BpoFWu78vcC4r/4npUYhTHGmQOkY3SWktYWZgevDTt148dgM4dNzOHnJDbPZQ8 vRhiABjdUWVi+rpSn0gOq/SU5YmdK5Q5OD5lobpna4yZaGNAMBxfL1bza/NxauR3d8r0 RaCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="eGlaCjD/"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id et21-20020a170907295500b0095389804380si11875804ejc.220.2023.05.16.02.13.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 02:13:36 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="eGlaCjD/"; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A678938560B4 for ; Tue, 16 May 2023 09:12:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A678938560B4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684228347; bh=LXbU9XirQ8+0A/rfv2aXhCRjnj3T+2nRg8bduS9Hk1s=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=eGlaCjD/UeaRF9tqXU8+RBNKmcX8x/R55lAKlwVokNkZRM3r3u4ON7gdY/SDSsm91 nMr071lhgdbeYKttHu8yrvN0IRDyYrXCzMQRQzkY9fPrMTzMxIE0+DbZob0JCRTmFt V6T7wTQTZbzZ0HTff806wmabtfigOB/ZcFbEFsXg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 8B415385770E for ; Tue, 16 May 2023 09:11:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8B415385770E Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-45-TovUKMJUNcKMXvSe9NAF2A-1; Tue, 16 May 2023 05:11:34 -0400 X-MC-Unique: TovUKMJUNcKMXvSe9NAF2A-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0080985A5B1; Tue, 16 May 2023 09:11:34 +0000 (UTC) Received: from localhost (unknown [10.42.28.178]) by smtp.corp.redhat.com (Postfix) with ESMTP id 97FD24021CD; Tue, 16 May 2023 09:11:33 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed 1/3] libstdc++: Stop using _GLIBCXX_USE_C99_COMPLEX_TR1 in Date: Tue, 16 May 2023 10:11:30 +0100 Message-Id: <20230516091132.1698684-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766041496568475103?= X-GMAIL-MSGID: =?utf-8?q?1766041496568475103?= Tested powerpc64le-linux. Pushed to trunk. -- >8 -- The _GLIBCXX_USE_C99_COMPLEX_TR1 macro (and the comments about it in acinclude.m4 and config.h) are misleading when it is also used for , not only . It is also wrong, because the configure checks for TR1 use -std=c++98 and a target might define cacos etc. for C++11 but not for C++98. Add a separate configure check for the inverse trigonometric functions that are covered by _GLIBCXX_USE_C99_COMPLEX_TR1, but using -std=c++11 for the checks. Use the result of that separate check in . libstdc++-v3/ChangeLog: * acinclude.m4 (GLIBCXX_USE_C99): Check for complex inverse trig functions in C++11 mode and define _GLIBCXX_USE_C99_COMPLEX_ARC. * config.h.in: Regenerate. * configure: Regenerate. * doc/doxygen/user.cfg.in (PREDEFINED): Add new macro. * include/std/complex: Check _GLIBCXX_USE_C99_COMPLEX_ARC instead of _GLIBCXX_USE_C99_COMPLEX_TR1. --- libstdc++-v3/acinclude.m4 | 37 +++++++++++++++++++ libstdc++-v3/config.h.in | 5 +++ libstdc++-v3/configure | 53 ++++++++++++++++++++++++++++ libstdc++-v3/doc/doxygen/user.cfg.in | 1 + libstdc++-v3/include/std/complex | 14 ++++---- 5 files changed, 103 insertions(+), 7 deletions(-) diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 0ce3b8b5b31..84b12adbc24 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -1200,6 +1200,43 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ requires corresponding C99 library functions to be present.]) fi + # Check for the existence of complex inverse trigonometric + # math functions used by for C++11 and later. + ac_c99_complex_arc=no; + if test x"$ac_has_complex_h" = x"yes"; then + AC_MSG_CHECKING([for ISO C99 support for inverse trig functions in ]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ float float_type; float_type tmpf; + cacosf(tmpf); + casinf(tmpf); + catanf(tmpf); + cacoshf(tmpf); + casinhf(tmpf); + catanhf(tmpf); + typedef __complex__ double double_type; double_type tmpd; + cacos(tmpd); + casin(tmpd); + catan(tmpd); + cacosh(tmpd); + casinh(tmpd); + catanh(tmpd); + typedef __complex__ long double ld_type; ld_type tmpld; + cacosl(tmpld); + casinl(tmpld); + catanl(tmpld); + cacoshl(tmpld); + casinhl(tmpld); + catanhl(tmpld); + ],[ac_c99_complex_arc=yes], [ac_c99_complex_arc=no]) + fi + AC_MSG_RESULT($ac_c99_complex_arc) + if test x"$ac_c99_complex_arc" = x"yes"; then + AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX_ARC, 1, + [Define if C99 inverse trig functions in should be + used in . Using compiler builtins for these functions + requires corresponding C99 library functions to be present.]) + fi + # Check for the existence in of vscanf, et. al. AC_CACHE_CHECK([for ISO C99 support in for C++11], glibcxx_cv_c99_stdio_cxx11, [ diff --git a/libstdc++-v3/doc/doxygen/user.cfg.in b/libstdc++-v3/doc/doxygen/user.cfg.in index 14981c96f95..210e13400b9 100644 --- a/libstdc++-v3/doc/doxygen/user.cfg.in +++ b/libstdc++-v3/doc/doxygen/user.cfg.in @@ -2352,6 +2352,7 @@ PREDEFINED = __cplusplus=202002L \ _GLIBCXX_USE_NOEXCEPT=noexcept \ _GLIBCXX_USE_WCHAR_T \ _GLIBCXX_USE_LONG_LONG \ + _GLIBCXX_USE_C99_COMPLEX_ARC \ _GLIBCXX_USE_C99_STDINT_TR1 \ _GLIBCXX_USE_SCHED_YIELD \ _GLIBCXX_USE_NANOSLEEP \ diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index 0f5f14c3ddb..40fc062e53d 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -2021,7 +2021,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return std::complex<_Tp>(__pi_2 - __t.real(), -__t.imag()); } -#if _GLIBCXX_USE_C99_COMPLEX_TR1 +#if _GLIBCXX_USE_C99_COMPLEX_ARC #if defined(__STDCPP_FLOAT16_T__) && defined(_GLIBCXX_FLOAT_IS_IEEE_BINARY32) inline __complex__ _Float16 __complex_acos(__complex__ _Float16 __z) @@ -2177,7 +2177,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif #endif -#if _GLIBCXX_USE_C99_COMPLEX_TR1 +#if _GLIBCXX_USE_C99_COMPLEX_ARC inline __complex__ float __complex_acos(__complex__ float __z) { return __builtin_cacosf(__z); } @@ -2213,7 +2213,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return std::complex<_Tp>(__t.imag(), -__t.real()); } -#if _GLIBCXX_USE_C99_COMPLEX_TR1 +#if _GLIBCXX_USE_C99_COMPLEX_ARC inline __complex__ float __complex_asin(__complex__ float __z) { return __builtin_casinf(__z); } @@ -2257,7 +2257,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Tp(0.25) * log(__num / __den)); } -#if _GLIBCXX_USE_C99_COMPLEX_TR1 +#if _GLIBCXX_USE_C99_COMPLEX_ARC inline __complex__ float __complex_atan(__complex__ float __z) { return __builtin_catanf(__z); } @@ -2293,7 +2293,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + std::sqrt(_Tp(0.5) * (__z - _Tp(1.0)))); } -#if _GLIBCXX_USE_C99_COMPLEX_TR1 +#if _GLIBCXX_USE_C99_COMPLEX_ARC inline __complex__ float __complex_acosh(__complex__ float __z) { return __builtin_cacoshf(__z); } @@ -2332,7 +2332,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return std::log(__t + __z); } -#if _GLIBCXX_USE_C99_COMPLEX_TR1 +#if _GLIBCXX_USE_C99_COMPLEX_ARC inline __complex__ float __complex_asinh(__complex__ float __z) { return __builtin_casinhf(__z); } @@ -2376,7 +2376,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Tp(0.5) * atan2(_Tp(2.0) * __z.imag(), __x)); } -#if _GLIBCXX_USE_C99_COMPLEX_TR1 +#if _GLIBCXX_USE_C99_COMPLEX_ARC inline __complex__ float __complex_atanh(__complex__ float __z) { return __builtin_catanhf(__z); } From patchwork Tue May 16 09:11:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 94573 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp285425vqo; Tue, 16 May 2023 02:15:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6JTaLtMhKbuTYTCY4Io0VO/9hLrFifwzvtyIEGbZiwnXcw0RJo6IkG1crexKdM669743SS X-Received: by 2002:a05:6402:685:b0:50b:f7b2:79d0 with SMTP id f5-20020a056402068500b0050bf7b279d0mr30118103edy.31.1684228516974; Tue, 16 May 2023 02:15:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684228516; cv=none; d=google.com; s=arc-20160816; b=SF3lVhgwzPMtq97/4v2wXHEGx0xgoG+DKm0LNq/ec2NcxHoyI/QV9oMGvNOD+uLQqI pSFgEh/b/3u22Re8uPDgnUuwSHohqB+l4vAHKRabfRn9dtMDt2FpDn6834EZx6Rj2EF5 OR8F6XDF1HtMWdAsvdiln5ZI1zmXL2s1vQzKrjpJ2PHWD8Gw3TBDoFMUrXTi3E4IjQj8 /2JTL2af4y+61gyo1/R+3QDn3uHiVaIgBjIbPWAj9PgL+L1rOs7L9JdbLau0FS37vcYr lXFDSPHLpAE4T1QXiuAv/Rq4uv7csntaKIBZ4ajsCM/3zAbMCkpH850eLA6djUt/iEK0 JxKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=Uvm39XoZ+HcnyXjyEqY0pWX7Ikc0WjN9zpjOriS6738=; b=NUUy5gAwOcDF9eUvckTH+6EgrTCxHV3kmzqIzCSl5lFWyED4b6XPgi7dxoMw3a9fUC +BScsyAiaej0ZGG8IkYCe0F3tPF4uKKDIt3ugaOLiLt/mOhKhuf96H05GTm72F47577U qZyGKyprDrmB7/y8AymuyPiiyvjjqc6iV1c386sXaNg5b+g5oQ6a5vJF3hGk7J9n4fVh cWSmLxO81UYkZTvy4EnYo3uTCVyU1AxsIfTk48+PTmDCxZNvtmG+CMSWjCGNyg4LeYxz HkX9TJpYgO8BVFfCzmj7cjS9axy0/y/hEIjsF9QpJIaI06dCofLbeX4DwqtCglT3EYf7 EIBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Q4OczPg1; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id g21-20020aa7d1d5000000b005068469d3a3si14713230edp.254.2023.05.16.02.15.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 02:15:16 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Q4OczPg1; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 17543386D626 for ; Tue, 16 May 2023 09:13:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 17543386D626 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684228398; bh=Uvm39XoZ+HcnyXjyEqY0pWX7Ikc0WjN9zpjOriS6738=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=Q4OczPg1BkU+/858hpIkGba30/6EI6h8Ktiu8epKOgK9m9zu1r5OalazVSg0RsNdN iUHIEuGlYbRz2wrYHf5AkFJyM0vt9hBLYlf/wav9+71yznRClilahGrHyurxveTa78 89gFBf/SJDWTixJ1v3IqWRN9ru3/URbw+rwmxAGk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 89BAA385773C for ; Tue, 16 May 2023 09:11:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 89BAA385773C Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-121-I98e23EFPaa4xBf7mBcXZQ-1; Tue, 16 May 2023 05:11:35 -0400 X-MC-Unique: I98e23EFPaa4xBf7mBcXZQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8D0F6101A554; Tue, 16 May 2023 09:11:35 +0000 (UTC) Received: from localhost (unknown [10.42.28.178]) by smtp.corp.redhat.com (Postfix) with ESMTP id 12B8640C206F; Tue, 16 May 2023 09:11:34 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed 2/3] libstdc++: Stop using _GLIBCXX_USE_C99_STDINT_TR1 in Date: Tue, 16 May 2023 10:11:31 +0100 Message-Id: <20230516091132.1698684-2-jwakely@redhat.com> In-Reply-To: <20230516091132.1698684-1-jwakely@redhat.com> References: <20230516091132.1698684-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766041601500089198?= X-GMAIL-MSGID: =?utf-8?q?1766041601500089198?= Tested powerpc64le-linux. Pushed to trunk. -- >8 -- The _GLIBCXX_USE_C99_STDINT_TR1 macro (and the comments about it in acinclude.m4 and config.h) are misleading when it is also used for , not only . It is also wrong, because the configure checks for TR1 use -std=c++98 and a target might define uint32_t etc. for C++11 but not for C++98. Add a separate configure check for the types using -std=c++11 for the checks. Use the result of that separate check in and most other places that still depend on the macro (many uses of that macro have been removed already). The remaining uses of the STDINT_TR1 macro are really for TR1, or are in the src/c++11/compatibility-*.cc files, where we don't want/need to change the condition they depend on (if those symbols were only exported when types were available for -std=c++98, then that's the condition we should continue to use for whether to export the compat symbols now). Make similar changes for the related _GLIBCXX_USE_C99_INTTYPES_TR1 and _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1 macros, adding new macros for non-TR1 uses. libstdc++-v3/ChangeLog: * acinclude.m4 (GLIBCXX_USE_C99): Check for types in C++11 mode and define _GLIBCXX_USE_C99_STDINT. Check for features in C++11 mode and define _GLIBCXX_USE_C99_INTTYPES and _GLIBCXX_USE_C99_INTTYPES_WCHAR_T. * config.h.in: Regenerate. * configure: Regenerate. * doc/doxygen/user.cfg.in (PREDEFINED): Add new macros. * include/bits/chrono.h: Check _GLIBCXX_USE_C99_STDINT instead of _GLIBCXX_USE_C99_STDINT_TR1. * include/c_compatibility/inttypes.h: Check _GLIBCXX_USE_C99_INTTYPES and _GLIBCXX_USE_C99_INTTYPES_WCHAR_T instead of _GLIBCXX_USE_C99_INTTYPES_TR1 and _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1. * include/c_compatibility/stdatomic.h: Check _GLIBCXX_USE_C99_STDINT instead of _GLIBCXX_USE_C99_STDINT_TR1. * include/c_compatibility/stdint.h: Likewise. * include/c_global/cinttypes: Check _GLIBCXX_USE_C99_INTTYPES and _GLIBCXX_USE_C99_INTTYPES_WCHAR_T instead of _GLIBCXX_USE_C99_INTTYPES_TR1 and _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1. * include/c_global/cstdint: Check _GLIBCXX_USE_C99_STDINT instead of _GLIBCXX_USE_C99_STDINT_TR1. * include/std/atomic: Likewise. * src/c++11/cow-stdexcept.cc: Likewise. * testsuite/29_atomics/headers/stdatomic.h/c_compat.cc: Likewise. * testsuite/lib/libstdc++.exp (check_v3_target_cstdint): Likewise. --- libstdc++-v3/acinclude.m4 | 142 +++++++++++++ libstdc++-v3/config.h.in | 12 ++ libstdc++-v3/configure | 196 ++++++++++++++++++ libstdc++-v3/doc/doxygen/user.cfg.in | 3 + libstdc++-v3/include/bits/chrono.h | 2 +- .../include/c_compatibility/inttypes.h | 6 +- .../include/c_compatibility/stdatomic.h | 4 +- libstdc++-v3/include/c_compatibility/stdint.h | 4 +- libstdc++-v3/include/c_global/cinttypes | 6 +- libstdc++-v3/include/c_global/cstdint | 6 +- libstdc++-v3/include/std/atomic | 2 +- libstdc++-v3/src/c++11/cow-stdexcept.cc | 4 +- .../headers/stdatomic.h/c_compat.cc | 2 +- libstdc++-v3/testsuite/lib/libstdc++.exp | 2 +- 14 files changed, 372 insertions(+), 19 deletions(-) diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 84b12adbc24..0c01b526ebf 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -1103,6 +1103,148 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ ]) fi + # Check for the existence of types. + AC_CACHE_CHECK([for ISO C99 support in for C++11], + glibcxx_cv_c99_stdint, [ + AC_TRY_COMPILE([#define __STDC_LIMIT_MACROS + #define __STDC_CONSTANT_MACROS + #include ], + [typedef int8_t my_int8_t; + my_int8_t i8 = INT8_MIN; + i8 = INT8_MAX; + typedef int16_t my_int16_t; + my_int16_t i16 = INT16_MIN; + i16 = INT16_MAX; + typedef int32_t my_int32_t; + my_int32_t i32 = INT32_MIN; + i32 = INT32_MAX; + typedef int64_t my_int64_t; + my_int64_t i64 = INT64_MIN; + i64 = INT64_MAX; + typedef int_fast8_t my_int_fast8_t; + my_int_fast8_t if8 = INT_FAST8_MIN; + if8 = INT_FAST8_MAX; + typedef int_fast16_t my_int_fast16_t; + my_int_fast16_t if16 = INT_FAST16_MIN; + if16 = INT_FAST16_MAX; + typedef int_fast32_t my_int_fast32_t; + my_int_fast32_t if32 = INT_FAST32_MIN; + if32 = INT_FAST32_MAX; + typedef int_fast64_t my_int_fast64_t; + my_int_fast64_t if64 = INT_FAST64_MIN; + if64 = INT_FAST64_MAX; + typedef int_least8_t my_int_least8_t; + my_int_least8_t il8 = INT_LEAST8_MIN; + il8 = INT_LEAST8_MAX; + typedef int_least16_t my_int_least16_t; + my_int_least16_t il16 = INT_LEAST16_MIN; + il16 = INT_LEAST16_MAX; + typedef int_least32_t my_int_least32_t; + my_int_least32_t il32 = INT_LEAST32_MIN; + il32 = INT_LEAST32_MAX; + typedef int_least64_t my_int_least64_t; + my_int_least64_t il64 = INT_LEAST64_MIN; + il64 = INT_LEAST64_MAX; + typedef intmax_t my_intmax_t; + my_intmax_t im = INTMAX_MAX; + im = INTMAX_MIN; + typedef intptr_t my_intptr_t; + my_intptr_t ip = INTPTR_MAX; + ip = INTPTR_MIN; + typedef uint8_t my_uint8_t; + my_uint8_t ui8 = UINT8_MAX; + ui8 = UINT8_MAX; + typedef uint16_t my_uint16_t; + my_uint16_t ui16 = UINT16_MAX; + ui16 = UINT16_MAX; + typedef uint32_t my_uint32_t; + my_uint32_t ui32 = UINT32_MAX; + ui32 = UINT32_MAX; + typedef uint64_t my_uint64_t; + my_uint64_t ui64 = UINT64_MAX; + ui64 = UINT64_MAX; + typedef uint_fast8_t my_uint_fast8_t; + my_uint_fast8_t uif8 = UINT_FAST8_MAX; + uif8 = UINT_FAST8_MAX; + typedef uint_fast16_t my_uint_fast16_t; + my_uint_fast16_t uif16 = UINT_FAST16_MAX; + uif16 = UINT_FAST16_MAX; + typedef uint_fast32_t my_uint_fast32_t; + my_uint_fast32_t uif32 = UINT_FAST32_MAX; + uif32 = UINT_FAST32_MAX; + typedef uint_fast64_t my_uint_fast64_t; + my_uint_fast64_t uif64 = UINT_FAST64_MAX; + uif64 = UINT_FAST64_MAX; + typedef uint_least8_t my_uint_least8_t; + my_uint_least8_t uil8 = UINT_LEAST8_MAX; + uil8 = UINT_LEAST8_MAX; + typedef uint_least16_t my_uint_least16_t; + my_uint_least16_t uil16 = UINT_LEAST16_MAX; + uil16 = UINT_LEAST16_MAX; + typedef uint_least32_t my_uint_least32_t; + my_uint_least32_t uil32 = UINT_LEAST32_MAX; + uil32 = UINT_LEAST32_MAX; + typedef uint_least64_t my_uint_least64_t; + my_uint_least64_t uil64 = UINT_LEAST64_MAX; + uil64 = UINT_LEAST64_MAX; + typedef uintmax_t my_uintmax_t; + my_uintmax_t uim = UINTMAX_MAX; + uim = UINTMAX_MAX; + typedef uintptr_t my_uintptr_t; + my_uintptr_t uip = UINTPTR_MAX; + uip = UINTPTR_MAX; + ],[glibcxx_cv_c99_stdint=yes], + [glibcxx_cv_c99_stdint=no]) + ]) + if test x"$glibcxx_cv_c99_stdint" = x"yes"; then + AC_DEFINE(_GLIBCXX_USE_C99_STDINT, 1, + [Define if C99 types in should be imported in + in namespace std for C++11.]) + fi + + # Check for the existence of functions (NB: doesn't make + # sense if the glibcxx_cv_c99_stdint check fails, per C99, 7.8/1). + ac_c99_inttypes=no; + if test x"$glibcxx_cv_c99_stdint" = x"yes"; then + AC_MSG_CHECKING([for ISO C99 support for C++11 in ]) + AC_TRY_COMPILE([#include ], + [intmax_t i, numer, denom, base; + const char* s; + char** endptr; + intmax_t ret = imaxabs(i); + imaxdiv_t dret = imaxdiv(numer, denom); + ret = strtoimax(s, endptr, base); + uintmax_t uret = strtoumax(s, endptr, base); + ],[ac_c99_inttypes=yes], [ac_c99_inttypes=no]) + AC_MSG_RESULT($ac_c99_inttypes) + fi + if test x"$ac_c99_inttypes" = x"yes"; then + AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES, 1, + [Define if C99 functions in should be imported in + in namespace std in C++11.]) + fi + + # Check for the existence of wchar_t functions (NB: doesn't + # make sense if the glibcxx_cv_c99_stdint check fails, per C99, 7.8/1). + ac_c99_inttypes_wchar_t=no; + if test x"$glibcxx_cv_c99_stdint" = x"yes"; then + AC_MSG_CHECKING([for wchar_t ISO C99 support for C++11 in ]) + AC_TRY_COMPILE([#include ], + [intmax_t base; + const wchar_t* s; + wchar_t** endptr; + intmax_t ret = wcstoimax(s, endptr, base); + uintmax_t uret = wcstoumax(s, endptr, base); + ],[ac_c99_inttypes_wchar_t=yes], + [ac_c99_inttypes_wchar_t=no]) + AC_MSG_RESULT($ac_c99_inttypes_wchar_t) + fi + if test x"$ac_c99_inttypes_wchar_t" = x"yes"; then + AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_WCHAR_T, 1, + [Define if wchar_t C99 functions in should be + imported in in namespace std in C++11.]) + fi + # Check for the existence of functions used if C99 is enabled. AC_CACHE_CHECK([for ISO C99 support in for C++11], glibcxx_cv_c99_math_cxx11, [ diff --git a/libstdc++-v3/doc/doxygen/user.cfg.in b/libstdc++-v3/doc/doxygen/user.cfg.in index 210e13400b9..0905e0f48f2 100644 --- a/libstdc++-v3/doc/doxygen/user.cfg.in +++ b/libstdc++-v3/doc/doxygen/user.cfg.in @@ -2353,6 +2353,9 @@ PREDEFINED = __cplusplus=202002L \ _GLIBCXX_USE_WCHAR_T \ _GLIBCXX_USE_LONG_LONG \ _GLIBCXX_USE_C99_COMPLEX_ARC \ + _GLIBCXX_USE_C99_INTTYPES \ + _GLIBCXX_USE_C99_INTTYPES_WCHAR_T \ + _GLIBCXX_USE_C99_STDINT \ _GLIBCXX_USE_C99_STDINT_TR1 \ _GLIBCXX_USE_SCHED_YIELD \ _GLIBCXX_USE_NANOSLEEP \ diff --git a/libstdc++-v3/include/bits/chrono.h b/libstdc++-v3/include/bits/chrono.h index fb99fe5eed7..81b92d724f7 100644 --- a/libstdc++-v3/include/bits/chrono.h +++ b/libstdc++-v3/include/bits/chrono.h @@ -884,7 +884,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// @} /// @cond undocumented -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 +#ifdef _GLIBCXX_USE_C99_STDINT # define _GLIBCXX_CHRONO_INT64_T int64_t #elif defined __INT64_TYPE__ # define _GLIBCXX_CHRONO_INT64_T __INT64_TYPE__ diff --git a/libstdc++-v3/include/c_compatibility/inttypes.h b/libstdc++-v3/include/c_compatibility/inttypes.h index 9c2b7d6c68d..070fcbcc1f2 100644 --- a/libstdc++-v3/include/c_compatibility/inttypes.h +++ b/libstdc++-v3/include/c_compatibility/inttypes.h @@ -48,7 +48,7 @@ # endif # endif -#ifdef _GLIBCXX_USE_C99_INTTYPES_TR1 +#ifdef _GLIBCXX_USE_C99_INTTYPES namespace std { @@ -72,13 +72,13 @@ namespace std using ::strtoimax; using ::strtoumax; -#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1 +#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T using ::wcstoimax; using ::wcstoumax; #endif } // namespace -#endif _GLIBCXX_USE_C99_INTTYPES_TR1 +#endif _GLIBCXX_USE_C99_INTTYPES #else diff --git a/libstdc++-v3/include/c_compatibility/stdatomic.h b/libstdc++-v3/include/c_compatibility/stdatomic.h index b565a1c1ab1..0b633262d08 100644 --- a/libstdc++-v3/include/c_compatibility/stdatomic.h +++ b/libstdc++-v3/include/c_compatibility/stdatomic.h @@ -62,7 +62,7 @@ using std::atomic_char8_t; using std::atomic_char16_t; using std::atomic_char32_t; using std::atomic_wchar_t; -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 +#ifdef _GLIBCXX_USE_C99_STDINT using std::atomic_int8_t; using std::atomic_uint8_t; using std::atomic_int16_t; @@ -92,7 +92,7 @@ using std::atomic_intptr_t; using std::atomic_uintptr_t; using std::atomic_size_t; using std::atomic_ptrdiff_t; -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 +#ifdef _GLIBCXX_USE_C99_STDINT using std::atomic_intmax_t; using std::atomic_uintmax_t; #endif diff --git a/libstdc++-v3/include/c_compatibility/stdint.h b/libstdc++-v3/include/c_compatibility/stdint.h index c264e979a0a..85948a5ada1 100644 --- a/libstdc++-v3/include/c_compatibility/stdint.h +++ b/libstdc++-v3/include/c_compatibility/stdint.h @@ -56,7 +56,7 @@ # endif # endif -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 +#ifdef _GLIBCXX_USE_C99_STDINT namespace std { @@ -97,7 +97,7 @@ namespace std using ::uintptr_t; } // namespace -#endif // _GLIBCXX_USE_C99_STDINT_TR1 +#endif // _GLIBCXX_USE_C99_STDINT #else diff --git a/libstdc++-v3/include/c_global/cinttypes b/libstdc++-v3/include/c_global/cinttypes index 8a9de63af79..06fc34d7d6e 100644 --- a/libstdc++-v3/include/c_global/cinttypes +++ b/libstdc++-v3/include/c_global/cinttypes @@ -50,7 +50,7 @@ # endif #endif -#ifdef _GLIBCXX_USE_C99_INTTYPES_TR1 +#ifdef _GLIBCXX_USE_C99_INTTYPES namespace std { @@ -68,13 +68,13 @@ namespace std using ::strtoimax; using ::strtoumax; -#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1 +#if defined(_GLIBCXX_USE_WCHAR_T) && _GLIBCXX_USE_C99_INTTYPES_WCHAR_T using ::wcstoimax; using ::wcstoumax; #endif } // namespace std -#endif // _GLIBCXX_USE_C99_INTTYPES_TR1 +#endif // _GLIBCXX_USE_C99_INTTYPES #endif // C++11 diff --git a/libstdc++-v3/include/c_global/cstdint b/libstdc++-v3/include/c_global/cstdint index 64e8574badc..97a30d5e004 100644 --- a/libstdc++-v3/include/c_global/cstdint +++ b/libstdc++-v3/include/c_global/cstdint @@ -47,7 +47,7 @@ namespace std { -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 +#ifdef _GLIBCXX_USE_C99_STDINT using ::int8_t; using ::int16_t; using ::int32_t; @@ -83,7 +83,7 @@ namespace std using ::uintmax_t; using ::uintptr_t; -#else // !_GLIBCXX_USE_C99_STDINT_TR1 +#else // !_GLIBCXX_USE_C99_STDINT using intmax_t = __INTMAX_TYPE__; using uintmax_t = __UINTMAX_TYPE__; @@ -138,7 +138,7 @@ namespace std using uintptr_t = __UINTPTR_TYPE__; #endif -#endif // _GLIBCXX_USE_C99_STDINT_TR1 +#endif // _GLIBCXX_USE_C99_STDINT } // namespace std #endif // C++11 diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic index b502027e4a4..111df2a978b 100644 --- a/libstdc++-v3/include/std/atomic +++ b/libstdc++-v3/include/std/atomic @@ -1103,7 +1103,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// atomic_char32_t typedef atomic atomic_char32_t; -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 +#ifdef _GLIBCXX_USE_C99_STDINT // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2441. Exact-width atomic typedefs should be provided diff --git a/libstdc++-v3/src/c++11/cow-stdexcept.cc b/libstdc++-v3/src/c++11/cow-stdexcept.cc index 652f248a54e..8d1cc4605d4 100644 --- a/libstdc++-v3/src/c++11/cow-stdexcept.cc +++ b/libstdc++-v3/src/c++11/cow-stdexcept.cc @@ -198,7 +198,7 @@ _GLIBCXX_END_NAMESPACE_VERSION // declared transaction-safe, so we just don't provide transactional clones // in this case. #if _GLIBCXX_USE_WEAK_REF -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 +#ifdef _GLIBCXX_USE_C99_STDINT #include @@ -461,5 +461,5 @@ CTORDTOR(15underflow_error, std::underflow_error, runtime_error) } -#endif // _GLIBCXX_USE_C99_STDINT_TR1 +#endif // _GLIBCXX_USE_C99_STDINT #endif // _GLIBCXX_USE_WEAK_REF diff --git a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/c_compat.cc b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/c_compat.cc index 8dd7054a997..3364c60a225 100644 --- a/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/c_compat.cc +++ b/libstdc++-v3/testsuite/29_atomics/headers/stdatomic.h/c_compat.cc @@ -70,7 +70,7 @@ static_assert(is_same); static_assert(is_same); #include -#ifdef _GLIBCXX_USE_C99_STDINT_TR1 +#ifdef _GLIBCXX_USE_C99_STDINT static_assert(is_same); static_assert(is_same); static_assert(is_same); diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index 490abd108fa..7d9471a1ded 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -1063,7 +1063,7 @@ proc check_v3_target_parallel_mode { } { # Return 1 if the C99 stdint facilities are available, 0 otherwise. proc check_v3_target_cstdint { } { return [check_v3_target_prop_cached et_cstdint { - set cond "defined _GLIBCXX_USE_C99_STDINT_TR1" + set cond "defined _GLIBCXX_USE_C99_STDINT" return [v3_check_preprocessor_condition cstdint $cond] }] } From patchwork Tue May 16 09:11:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 94568 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp284691vqo; Tue, 16 May 2023 02:13:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7c5aGH3b43RNUotidMahT63M9unf0bIlCQZhL/WGeYAPqw16OLaOmg0jtfqimJeHlE/R1l X-Received: by 2002:a17:907:97c4:b0:966:4669:7e8d with SMTP id js4-20020a17090797c400b0096646697e8dmr29317667ejc.16.1684228426200; Tue, 16 May 2023 02:13:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684228426; cv=none; d=google.com; s=arc-20160816; b=oSU2C9sAgskMFuH3YxBTDXPfm97HgifiPfHptMPoadp30CECOs9TPj61rIo4jILlAf +tzxTeRizpm2h8cnazO4bCLBOWRhemNMK+KwDjBgfJqVBgB+5qxK/maqLc4G0dWjCcN5 Be4NmtQ8sMUdTKC/4LOP75T7RO4b2c/P07FrP3rhACCsVHyqnSQgWfFiBGR974AQlxlR Huqkfii4nFlOnCqrl57H2LgS1NfJZ4LVFnX8sg7ZCtbLSs8nbl7YpILovCv9qk8NxxHp ujzVIGs1odI8jwgVCKD+8FYWunutM1Tx8prswVq5CgmT6H9tQrc0soLkVTOe4GV5p6bo auIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:dmarc-filter:delivered-to:dkim-signature :dkim-filter; bh=gKW1aXaTtr91rAXpjjdjcViPR07mtx+KZQQkPiSYqGc=; b=YE+XwTZPuzUItu5T7wqhTVXUn3ZKpjyctoHICrGeb+zM8Hb+yqreZYH1+Y5GW2jsjT vOmLAcGFHZeoaHFwM5agyFSs1hD3HjQdv5yKHB0LhB1LagXzoG7TTqSZ3oLd2ylIeoxj S7zEgdHYwvSliR9plUQC4uBTG9EgTm3NtkWylROnsOSz/L/FsPiuV84xvWg/+d+EYNrM eGyX/7mOEmseW7p9S8w1kvuePVVaSsagc5cvUAO/G9HmTgKC4h4b9yRAmIR14Ca6dgR8 lWOuWRGx3vCxQawQsKdj7YN9srNovDKuOFPwdSScGmZXvTUjpHZAuHyyj4YPOfj39Vk+ 885Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=sSNGQ8X+; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id gx24-20020a170906f1d800b0094ecdc54e21si1136542ejb.917.2023.05.16.02.13.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 02:13:46 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=sSNGQ8X+; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 21CE03853560 for ; Tue, 16 May 2023 09:12:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 21CE03853560 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684228351; bh=gKW1aXaTtr91rAXpjjdjcViPR07mtx+KZQQkPiSYqGc=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=sSNGQ8X+PZMsY5/DZsuJR1b8LV2X3YDRonSsOyUivHLK1DKKQSlb5SM5KNyX6YImq XzRckU3ICf3Y0ramXRU5N/HdGJzMbn5awcSHoIU6ho61gKFfrczpc2BCQMa+gQYPqD cWHH5MK5L7CRVwnR9XCqJPZkj6m0I3eDuIvQl5w4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 76F613857356 for ; Tue, 16 May 2023 09:11:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 76F613857356 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-461-RWhXobr_MPycel7XRQ88xw-1; Tue, 16 May 2023 05:11:37 -0400 X-MC-Unique: RWhXobr_MPycel7XRQ88xw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BB09A87DC03; Tue, 16 May 2023 09:11:36 +0000 (UTC) Received: from localhost (unknown [10.42.28.178]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E2B2C15BA0; Tue, 16 May 2023 09:11:36 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed 3/3] libstdc++: Stop using TR1 macros in and Date: Tue, 16 May 2023 10:11:32 +0100 Message-Id: <20230516091132.1698684-3-jwakely@redhat.com> In-Reply-To: <20230516091132.1698684-1-jwakely@redhat.com> References: <20230516091132.1698684-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766041506228045563?= X-GMAIL-MSGID: =?utf-8?q?1766041506228045563?= Tested powerpc64le-linux. Pushed to trunk. -- >8 -- As with the two commits before this, the _GLIBCXX_USE_C99_CTYPE_TR1 and _GLIBCXX_USE_C99_FENV_TR1 macros are misleading when they are also used for and , not only for TR1 headers. It is also wrong, because the configure checks for TR1 use -std=c++98 and a target might define the C99 features for C++11 but not for C++98. Add separate configure checks for the and features using -std=c++11 for the checks. Use the new macros defined by those checks in the C++11-specific parts of , , and . libstdc++-v3/ChangeLog: * acinclude.m4 (GLIBCXX_USE_C99): Check for isblank in C++11 mode and define _GLIBCXX_USE_C99_CTYPE. Check for functions in C++11 mode and define _GLIBCXX_USE_C99_FENV. * config.h.in: Regenerate. * configure: Regenerate. * include/c_compatibility/fenv.h: Check _GLIBCXX_USE_C99_FENV instead of _GLIBCXX_USE_C99_FENV_TR1. * include/c_global/cfenv: Likewise. * include/c_global/cctype: Check _GLIBCXX_USE_C99_CTYPE instead of _GLIBCXX_USE_C99_CTYPE_TR1. --- libstdc++-v3/acinclude.m4 | 46 ++++++++++ libstdc++-v3/config.h.in | 8 ++ libstdc++-v3/configure | 97 +++++++++++++++++++++ libstdc++-v3/include/c_compatibility/fenv.h | 4 +- libstdc++-v3/include/c_global/cctype | 4 +- libstdc++-v3/include/c_global/cfenv | 4 +- 6 files changed, 157 insertions(+), 6 deletions(-) diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 0c01b526ebf..988c532c4e2 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -1476,6 +1476,52 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ fi fi + # Check for the existence of functions. + AC_CACHE_CHECK([for ISO C99 support for C++11 in ], + glibcxx_cv_c99_ctype, [ + AC_TRY_COMPILE([#include ], + [int ch; + int ret; + ret = isblank(ch); + ],[glibcxx_cv_c99_ctype=yes], + [glibcxx_cv_c99_ctype=no]) + ]) + if test x"$glibcxx_cv_c99_ctype" = x"yes"; then + AC_DEFINE(_GLIBCXX_USE_C99_CTYPE, 1, + [Define if C99 functions in should be imported in + in namespace std for C++11.]) + fi + + # Check for the existence of functions. + AC_CHECK_HEADERS(fenv.h, ac_has_fenv_h=yes, ac_has_fenv_h=no) + ac_c99_fenv=no; + if test x"$ac_has_fenv_h" = x"yes"; then + AC_MSG_CHECKING([for ISO C99 support for C++11 in ]) + AC_TRY_COMPILE([#include ], + [int except, mode; + fexcept_t* pflag; + fenv_t* penv; + int ret; + ret = feclearexcept(except); + ret = fegetexceptflag(pflag, except); + ret = feraiseexcept(except); + ret = fesetexceptflag(pflag, except); + ret = fetestexcept(except); + ret = fegetround(); + ret = fesetround(mode); + ret = fegetenv(penv); + ret = feholdexcept(penv); + ret = fesetenv(penv); + ret = feupdateenv(penv); + ],[ac_c99_fenv=yes], [ac_c99_fenv=no]) + AC_MSG_RESULT($ac_c99_fenv) + fi + if test x"$ac_c99_fenv" = x"yes"; then + AC_DEFINE(_GLIBCXX_USE_C99_FENV, 1, + [Define if C99 functions in should be imported in + in namespace std for C++11.]) + fi + gcc_no_link="$ac_save_gcc_no_link" LIBS="$ac_save_LIBS" CXXFLAGS="$ac_save_CXXFLAGS" diff --git a/libstdc++-v3/include/c_compatibility/fenv.h b/libstdc++-v3/include/c_compatibility/fenv.h index 70ce3f834f4..83e930f12d1 100644 --- a/libstdc++-v3/include/c_compatibility/fenv.h +++ b/libstdc++-v3/include/c_compatibility/fenv.h @@ -38,7 +38,7 @@ #if __cplusplus >= 201103L -#if _GLIBCXX_USE_C99_FENV_TR1 +#if _GLIBCXX_USE_C99_FENV #undef feclearexcept #undef fegetexceptflag @@ -74,7 +74,7 @@ namespace std using ::feupdateenv; } // namespace -#endif // _GLIBCXX_USE_C99_FENV_TR1 +#endif // _GLIBCXX_USE_C99_FENV #endif // C++11 diff --git a/libstdc++-v3/include/c_global/cctype b/libstdc++-v3/include/c_global/cctype index bd667fba15d..e6ff1204df6 100644 --- a/libstdc++-v3/include/c_global/cctype +++ b/libstdc++-v3/include/c_global/cctype @@ -78,7 +78,7 @@ namespace std #if __cplusplus >= 201103L -#ifdef _GLIBCXX_USE_C99_CTYPE_TR1 +#ifdef _GLIBCXX_USE_C99_CTYPE #undef isblank @@ -87,7 +87,7 @@ namespace std using ::isblank; } // namespace std -#endif // _GLIBCXX_USE_C99_CTYPE_TR1 +#endif // _GLIBCXX_USE_C99_CTYPE #endif // C++11 diff --git a/libstdc++-v3/include/c_global/cfenv b/libstdc++-v3/include/c_global/cfenv index 6704dc5423e..3a1d9c4a6aa 100644 --- a/libstdc++-v3/include/c_global/cfenv +++ b/libstdc++-v3/include/c_global/cfenv @@ -41,7 +41,7 @@ # include #endif -#ifdef _GLIBCXX_USE_C99_FENV_TR1 +#ifdef _GLIBCXX_USE_C99_FENV #undef feclearexcept #undef fegetexceptflag @@ -77,7 +77,7 @@ namespace std using ::feupdateenv; } // namespace std -#endif // _GLIBCXX_USE_C99_FENV_TR1 +#endif // _GLIBCXX_USE_C99_FENV #endif // C++11