From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684228300; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gKW1aXaTtr91rAXpjjdjcViPR07mtx+KZQQkPiSYqGc=; b=U0z96dORLkw58J6cqjadSw/PyhgL1JMMiC2SkimI+suS1bqFmHQ4f1J9DxpnlmEeufItpt 7Fv958c5clvJIl4m3ytzOdrr4hpgpoQGxWZAi+iNQG7MOr4sqjvPvyTR0/Q7vMc6ccMDch uJTEvLY1f0Izal8rjWxATsGYiS0JG08= 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) From: Jonathan Wakely 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 Content-Type: text/plain Content-Transfer-Encoding: 8bit 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 List-Id: 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 -- 2.40.1