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