From patchwork Wed May 31 20:20:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 101583 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp3154797vqr; Wed, 31 May 2023 13:23:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4QS5FB5pF/LPayRcdHgV0oGeDkgFT+oWDHdXWnGq5EhmLN2c4kWTo0XwqYtlLIeEQZamrQ X-Received: by 2002:a17:907:724b:b0:96a:316f:8abf with SMTP id ds11-20020a170907724b00b0096a316f8abfmr6438656ejc.20.1685564627677; Wed, 31 May 2023 13:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685564627; cv=none; d=google.com; s=arc-20160816; b=DP/rLVh1Okbfzr6AFrow2zYM2DnY78zTGlF7AWkw0OV2svvB20Xqz1yV2YMGO8WBRK DHa9rDuHjNIg3hDnrYmqPuYDltXy46bWOvKPaK8+iMef71kFEdMEihZtEC3N4Gvc2drP e75r5y9GbGfc07LwqkkKeaE8Sio7BhHBRRb6vFzq3G5I7e3jl+1ZworRTdd/UthysU2p i31zZ6RA4E+R9One9otsITleFck8swCPF9uYT5Hbx6Eq4Azz5rZApoPwEL88ygNHFBcY OcKvQDdUNVyVv19raAwCIP9MN3Va87Jaucx2XUk7TOKLsj8PrMCwZ37GMFUPxG82XewV LfRw== 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=Slydt7BpcnebPiKAYejDgyPq76VMk14IBr2ETFmNeDs=; b=SoqSmBD+jlvBVP0WlwmcafOrRb5bHcjGakNKNUOKzqoKBpiKs2vP3pu4tOmDXharaB kf/jgV7DORVm3SBnyAHaSf6BjKdi9U8ZIHJOONGUECDdT7mHzKzDfHhCnyrMV+lYRmeX KCpJWjdAsb09puV4LUVlalBdxIMd/NzunFUY01N/6uCAJRAHAJfrlFldEu5jXDlGSNSb i4fA58MsqnNgTnBRkxKYe32R1Zyd4xjWPyKMiX9OAXzA8NsFDi9rzb0M9TiViXAc5IIz bi1usjcd0Ggzx7Ml/k85WGCR3uxPAaMiRR2GEphWVIBZIVJivoYJAH4iQ6BffDaK+rZA KLvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=CHzqVzTO; 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id jg20-20020a170907971400b00965e0507037si12961788ejc.671.2023.05.31.13.23.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 13:23:47 -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=CHzqVzTO; 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 58A17384DA58 for ; Wed, 31 May 2023 20:21:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 58A17384DA58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685564506; bh=Slydt7BpcnebPiKAYejDgyPq76VMk14IBr2ETFmNeDs=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=CHzqVzTOJMqvLEaZp8+LXvL/wIASVcgFiPQwYMTpTdNrFg/n93E47jqpa9Zh6bncq GDS1gRWtpkFyVJGFvwgXOtfJid7ySMfT51iwUQ0O/jjKMmcswTKB/nHBgMXq7B3ijB rMJFkEoVK1Ht0kAIVqUwg8tngdqiTbh9FhjR99RI= 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 C430C3857011 for ; Wed, 31 May 2023 20:20:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C430C3857011 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-517-KshNFMQ3Mx-PFlk3RkHE1A-1; Wed, 31 May 2023 16:20:51 -0400 X-MC-Unique: KshNFMQ3Mx-PFlk3RkHE1A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B104738009FB; Wed, 31 May 2023 20:20:50 +0000 (UTC) Received: from localhost (unknown [10.42.28.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48D6E2166B25; Wed, 31 May 2023 20:20:50 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Stop using _GLIBCXX_USE_C99_MATH_TR1 in Date: Wed, 31 May 2023 21:20:49 +0100 Message-Id: <20230531202049.20903-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.2 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?1767442614806832687?= X-GMAIL-MSGID: =?utf-8?q?1767442614806832687?= Tested x86_64-linux. Pushed to trunk. -- >8 -- Similar to the three commits r14-908, r14-909 and r14-910, the _GLIBCXX_USE_C99_MATH_TR1 macro is misleading when it is also used for , not only for 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 functions using -std=c++11 for the checks. Use the new macro defined by those checks in the C++11-specific parts of , and in , etc. The check that defines _GLIBCXX_NO_C99_ROUNDING_FUNCS is only needed for the C++11 checks, so remove that from GLIBCXX_CHECK_C99_TR1 and only do it for GLIBCXX_ENABLE_C99. libstdc++-v3/ChangeLog: * acinclude.m4 (GLIBCXX_ENABLE_C99): Add checks for C99 math functions and define _GLIBCXX_USE_C99_MATH_FUNCS. Move checks for C99 rounding functions to here. (GLIBCXX_CHECK_C99_TR1): Remove checks for C99 rounding functions from here. * config.h.in: Regenerate. * configure: Regenerate. * include/bits/random.h: Use _GLIBCXX_USE_C99_MATH_FUNCS instead of _GLIBCXX_USE_C99_MATH_TR1. * include/bits/random.tcc: Likewise. * include/c_compatibility/math.h: Likewise. * include/c_global/cmath: Likewise. * include/ext/random: Likewise. * include/ext/random.tcc: Likewise. * include/std/complex: Likewise. * testsuite/20_util/from_chars/4.cc: Likewise. * testsuite/20_util/from_chars/8.cc: Likewise. * testsuite/26_numerics/complex/proj.cc: Likewise. * testsuite/26_numerics/headers/cmath/60401.cc: Likewise. * testsuite/26_numerics/headers/cmath/types_std_c++0x.cc: Likewise. * testsuite/lib/libstdc++.exp (check_v3_target_cstdint): Likewise. * testsuite/util/testsuite_random.h: Likewise. --- libstdc++-v3/acinclude.m4 | 183 +++++++++++-- libstdc++-v3/config.h.in | 8 +- libstdc++-v3/configure | 245 ++++++++++++++---- libstdc++-v3/include/bits/random.h | 12 +- libstdc++-v3/include/bits/random.tcc | 14 +- libstdc++-v3/include/c_compatibility/math.h | 4 +- libstdc++-v3/include/c_global/cmath | 4 +- libstdc++-v3/include/ext/random | 4 +- libstdc++-v3/include/ext/random.tcc | 6 +- libstdc++-v3/include/std/complex | 2 +- .../testsuite/20_util/from_chars/4.cc | 2 +- .../testsuite/20_util/from_chars/8.cc | 2 +- .../testsuite/26_numerics/complex/proj.cc | 4 +- .../26_numerics/headers/cmath/60401.cc | 2 +- .../headers/cmath/types_std_c++0x.cc | 2 +- libstdc++-v3/testsuite/lib/libstdc++.exp | 2 +- .../testsuite/util/testsuite_random.h | 6 +- 17 files changed, 396 insertions(+), 106 deletions(-) diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index ca776974832..66194071b20 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -1245,8 +1245,8 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ 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], + # Check for the existence of generic macros used if C99 is enabled. + AC_CACHE_CHECK([for ISO C99 generic macro support in for C++11], glibcxx_cv_c99_math_cxx11, [ GCC_TRY_COMPILE_OR_LINK( [#include @@ -1269,10 +1269,165 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ ]) if test x"$glibcxx_cv_c99_math_cxx11" = x"yes"; then AC_DEFINE(_GLIBCXX11_USE_C99_MATH, 1, - [Define if C99 functions or macros in should be imported + [Define if C99 generic macros in should be imported in in namespace std for C++11.]) fi + # Check for the existence of functions. + AC_CACHE_CHECK([for ISO C99 function support for C++11 in ], + glibcxx_cv_c99_math_funcs, [ + AC_TRY_COMPILE([#include ], + [// Types + typedef double_t my_double_t; + typedef float_t my_float_t; + // Hyperbolic + acosh(0.0); + acoshf(0.0f); + acoshl(0.0l); + asinh(0.0); + asinhf(0.0f); + asinhl(0.0l); + atanh(0.0); + atanhf(0.0f); + atanhl(0.0l); + // Exponential and logarithmic + exp2(0.0); + exp2f(0.0f); + exp2l(0.0l); + expm1(0.0); + expm1f(0.0f); + expm1l(0.0l); + ilogb(0.0); + ilogbf(0.0f); + ilogbl(0.0l); + log1p(0.0); + log1pf(0.0f); + log1pl(0.0l); + log2(0.0); + log2f(0.0f); + log2l(0.0l); + logb(0.0); + logbf(0.0f); + logbl(0.0l); + scalbln(0.0, 0l); + scalblnf(0.0f, 0l); + scalblnl(0.0l, 0l); + scalbn(0.0, 0); + scalbnf(0.0f, 0); + scalbnl(0.0l, 0); + // Power and absolute-value + cbrt(0.0); + cbrtf(0.0f); + cbrtl(0.0l); + hypot(0.0, 0.0); + hypotf(0.0f, 0.0f); + hypotl(0.0l, 0.0l); + // Error and gamma + erf(0.0); + erff(0.0f); + erfl(0.0l); + erfc(0.0); + erfcf(0.0f); + erfcl(0.0l); + lgamma(0.0); + lgammaf(0.0f); + lgammal(0.0l); + tgamma(0.0); + tgammaf(0.0f); + tgammal(0.0l); + // Nearest integer + nearbyint(0.0); + nearbyintf(0.0f); + nearbyintl(0.0l); + rint(0.0); + rintf(0.0f); + rintl(0.0l); + round(0.0); + roundf(0.0f); + roundl(0.0l); + lrint(0.0); + lrintf(0.0f); + lrintl(0.0l); + lround(0.0); + lroundf(0.0f); + lroundl(0.0l); + #ifndef __APPLE__ /* see below */ + llrint(0.0); + llrintf(0.0f); + llrintl(0.0l); + llround(0.0); + llroundf(0.0f); + llroundl(0.0l); + #endif + trunc(0.0); + truncf(0.0f); + truncl(0.0l); + // Remainder + remainder(0.0, 0.0); + remainderf(0.0f, 0.0f); + remainderl(0.0l, 0.0l); + remquo(0.0, 0.0, 0); + remquof(0.0f, 0.0f, 0); + remquol(0.0l, 0.0l, 0); + // Manipulation + copysign(0.0, 0.0); + copysignf(0.0f, 0.0f); + copysignl(0.0l, 0.0l); + nan(""); + nanf(""); + nanl(""); + nextafter(0.0, 0.0); + nextafterf(0.0f, 0.0f); + nextafterl(0.0l, 0.0l); + nexttoward(0.0, 0.0); + nexttowardf(0.0f, 0.0f); + nexttowardl(0.0l, 0.0l); + // Max, min, positive difference + fdim(0.0, 0.0); + fdimf(0.0f, 0.0f); + fdiml(0.0l, 0.0l); + fmax(0.0, 0.0); + fmaxf(0.0f, 0.0f); + fmaxl(0.0l, 0.0l); + fmin(0.0, 0.0); + fminf(0.0f, 0.0f); + fminl(0.0l, 0.0l); + // FP Multiply-add + fma(0.0, 0.0, 0.0); + fmaf(0.0f, 0.0f, 0.0f); + fmal(0.0l, 0.0l, 0.0l); + ], + [glibcxx_cv_c99_math_funcs=yes], + [glibcxx_cv_c99_math_funcs=no]) + ]) + if test x"$glibcxx_cv_c99_math_funcs" = x"yes"; then + AC_DEFINE(_GLIBCXX_USE_C99_MATH_FUNCS, 1, + [Define if C99 functions in should be imported + in in namespace std for C++11.]) + + case "${target_os}" in + darwin*) + AC_CACHE_CHECK([for ISO C99 rounding functions in ], + glibcxx_cv_c99_math_llround, [ + AC_TRY_COMPILE([#include ], + [llrint(0.0); + llrintf(0.0f); + llrintl(0.0l); + llround(0.0); + llroundf(0.0f); + llroundl(0.0l); + ], + [glibcxx_cv_c99_math_llround=yes], + [glibcxx_cv_c99_math_llround=no]) + ]) + ;; + esac + if test x"$glibcxx_cv_c99_math_llround" = x"no"; then + AC_DEFINE(_GLIBCXX_NO_C99_ROUNDING_FUNCS, 1, + [Define if C99 llrint and llround functions are missing from .]) + fi + fi + # Check for the existence of complex math functions. # This is necessary even though libstdc++ uses the builtin versions # of these functions, because if the builtin cannot be used, a reference @@ -2152,28 +2307,6 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [ AC_DEFINE(_GLIBCXX_USE_C99_MATH_TR1, 1, [Define if C99 functions or macros in should be imported in in namespace std::tr1.]) - - case "${target_os}" in - darwin*) - AC_CACHE_CHECK([for ISO C99 rounding functions in ], - glibcxx_cv_c99_math_llround, [ - AC_TRY_COMPILE([#include ], - [llrint(0.0); - llrintf(0.0f); - llrintl(0.0l); - llround(0.0); - llroundf(0.0f); - llroundl(0.0l); - ], - [glibcxx_cv_c99_math_llround=yes], - [glibcxx_cv_c99_math_llround=no]) - ]) - ;; - esac - if test x"$glibcxx_cv_c99_math_llround" = x"no"; then - AC_DEFINE(_GLIBCXX_NO_C99_ROUNDING_FUNCS, 1, - [Define if C99 llrint and llround functions are missing from .]) - fi fi # Check for the existence of functions (NB: doesn't make diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h index f77005adec5..58b5dd77d9e 100644 --- a/libstdc++-v3/include/bits/random.h +++ b/libstdc++-v3/include/bits/random.h @@ -3901,7 +3901,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION double _M_p; double _M_q; -#if _GLIBCXX_USE_C99_MATH_TR1 +#if _GLIBCXX_USE_C99_MATH_FUNCS double _M_d1, _M_d2, _M_s1, _M_s2, _M_c, _M_a1, _M_a123, _M_s, _M_lf, _M_lp1p; #endif @@ -4015,7 +4015,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION friend bool operator==(const binomial_distribution& __d1, const binomial_distribution& __d2) -#ifdef _GLIBCXX_USE_C99_MATH_TR1 +#ifdef _GLIBCXX_USE_C99_MATH_FUNCS { return __d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd; } #else { return __d1._M_param == __d2._M_param; } @@ -4068,7 +4068,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION param_type _M_param; - // NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined. + // NB: Unused when _GLIBCXX_USE_C99_MATH_FUNCS is undefined. std::normal_distribution _M_nd; }; @@ -4595,7 +4595,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION double _M_mean; double _M_lm_thr; -#if _GLIBCXX_USE_C99_MATH_TR1 +#if _GLIBCXX_USE_C99_MATH_FUNCS double _M_lfm, _M_sm, _M_d, _M_scx, _M_1cx, _M_c2b, _M_cb; #endif }; @@ -4700,7 +4700,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION friend bool operator==(const poisson_distribution& __d1, const poisson_distribution& __d2) -#ifdef _GLIBCXX_USE_C99_MATH_TR1 +#ifdef _GLIBCXX_USE_C99_MATH_FUNCS { return __d1._M_param == __d2._M_param && __d1._M_nd == __d2._M_nd; } #else { return __d1._M_param == __d2._M_param; } @@ -4746,7 +4746,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION param_type _M_param; - // NB: Unused when _GLIBCXX_USE_C99_MATH_TR1 is undefined. + // NB: Unused when _GLIBCXX_USE_C99_MATH_FUNCS is undefined. std::normal_distribution _M_nd; }; diff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc index f092b5cd4cb..24a5987db0d 100644 --- a/libstdc++-v3/include/bits/random.tcc +++ b/libstdc++-v3/include/bits/random.tcc @@ -1267,7 +1267,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION poisson_distribution<_IntType>::param_type:: _M_initialize() { -#if _GLIBCXX_USE_C99_MATH_TR1 +#if _GLIBCXX_USE_C99_MATH_FUNCS if (_M_mean >= 12) { const double __m = std::floor(_M_mean); @@ -1295,7 +1295,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * A rejection algorithm when mean >= 12 and a simple method based * upon the multiplication of uniform random variates otherwise. - * NB: The former is available only if _GLIBCXX_USE_C99_MATH_TR1 + * NB: The former is available only if _GLIBCXX_USE_C99_MATH_FUNCS * is defined. * * Reference: @@ -1311,7 +1311,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { __detail::_Adaptor<_UniformRandomNumberGenerator, double> __aurng(__urng); -#if _GLIBCXX_USE_C99_MATH_TR1 +#if _GLIBCXX_USE_C99_MATH_FUNCS if (__param.mean() >= 12) { double __x; @@ -1479,7 +1479,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_easy = true; -#if _GLIBCXX_USE_C99_MATH_TR1 +#if _GLIBCXX_USE_C99_MATH_FUNCS if (_M_t * __p12 >= 8) { _M_easy = false; @@ -1550,7 +1550,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /** * A rejection algorithm when t * p >= 8 and a simple waiting time * method - the second in the referenced book - otherwise. - * NB: The former is available only if _GLIBCXX_USE_C99_MATH_TR1 + * NB: The former is available only if _GLIBCXX_USE_C99_MATH_FUNCS * is defined. * * Reference: @@ -1571,7 +1571,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __detail::_Adaptor<_UniformRandomNumberGenerator, double> __aurng(__urng); -#if _GLIBCXX_USE_C99_MATH_TR1 +#if _GLIBCXX_USE_C99_MATH_FUNCS if (!__param._M_easy) { double __x; @@ -3367,7 +3367,7 @@ namespace __detail __ret = __sum / __tmp; if (__builtin_expect(__ret >= _RealType(1), 0)) { -#if _GLIBCXX_USE_C99_MATH_TR1 +#if _GLIBCXX_USE_C99_MATH_FUNCS __ret = std::nextafter(_RealType(1), _RealType(0)); #else __ret = _RealType(1) diff --git a/libstdc++-v3/include/c_compatibility/math.h b/libstdc++-v3/include/c_compatibility/math.h index 1206117b741..cedb11d0f85 100644 --- a/libstdc++-v3/include/c_compatibility/math.h +++ b/libstdc++-v3/include/c_compatibility/math.h @@ -74,7 +74,7 @@ using std::islessgreater; using std::isunordered; #endif -#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99_MATH_TR1) +#if __cplusplus >= 201103L && defined(_GLIBCXX_USE_C99_MATH_FUNCS) using std::acosh; using std::asinh; using std::atanh; @@ -109,7 +109,7 @@ using std::scalbln; using std::scalbn; using std::tgamma; using std::trunc; -#endif // C++11 && _GLIBCXX_USE_C99_MATH_TR1 +#endif // C++11 && _GLIBCXX_USE_C99_MATH_FUNCS // The mathematical special functions are only added to the global namespace // by IS 29124, but not by C++17. diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath index 4dc029e4e26..c80ee7c8d72 100644 --- a/libstdc++-v3/include/c_global/cmath +++ b/libstdc++-v3/include/c_global/cmath @@ -1767,7 +1767,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus >= 201103L -#ifdef _GLIBCXX_USE_C99_MATH_TR1 +#ifdef _GLIBCXX_USE_C99_MATH_FUNCS #undef acosh #undef acoshf @@ -3539,7 +3539,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } #endif -#endif // _GLIBCXX_USE_C99_MATH_TR1 +#endif // _GLIBCXX_USE_C99_MATH_FUNCS #endif // C++11 #if __cplusplus >= 201703L diff --git a/libstdc++-v3/include/ext/random b/libstdc++-v3/include/ext/random index 62acb67e05b..5ae085a971f 100644 --- a/libstdc++-v3/include/ext/random +++ b/libstdc++-v3/include/ext/random @@ -1116,7 +1116,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { result_type __x = this->_M_ndx(__urng); result_type __y = this->_M_ndy(__urng); -#if _GLIBCXX_USE_C99_MATH_TR1 +#if _GLIBCXX_USE_C99_MATH_FUNCS return std::hypot(__x, __y); #else return std::sqrt(__x * __x + __y * __y); @@ -1132,7 +1132,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __px(__p.nu(), __p.sigma()), __py(result_type(0), __p.sigma()); result_type __x = this->_M_ndx(__px, __urng); result_type __y = this->_M_ndy(__py, __urng); -#if _GLIBCXX_USE_C99_MATH_TR1 +#if _GLIBCXX_USE_C99_MATH_FUNCS return std::hypot(__x, __y); #else return std::sqrt(__x * __x + __y * __y); diff --git a/libstdc++-v3/include/ext/random.tcc b/libstdc++-v3/include/ext/random.tcc index df80422bc8b..87ecce7b0d3 100644 --- a/libstdc++-v3/include/ext/random.tcc +++ b/libstdc++-v3/include/ext/random.tcc @@ -740,7 +740,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __px(__p.nu(), __p.sigma()), __py(result_type(0), __p.sigma()); result_type __x = this->_M_ndx(__px, __urng); result_type __y = this->_M_ndy(__py, __urng); -#if _GLIBCXX_USE_C99_MATH_TR1 +#if _GLIBCXX_USE_C99_MATH_FUNCS *__f++ = std::hypot(__x, __y); #else *__f++ = std::sqrt(__x * __x + __y * __y); @@ -1287,7 +1287,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } result_type __res = std::acos(__f); -#if _GLIBCXX_USE_C99_MATH_TR1 +#if _GLIBCXX_USE_C99_MATH_FUNCS __res = std::copysign(__res, __aurng() - result_type(0.5)); #else if (__aurng() < result_type(0.5)) @@ -1623,7 +1623,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } while (__sq == _RealType(0) || __sq > _RealType(1)); -#if _GLIBCXX_USE_C99_MATH_TR1 +#if _GLIBCXX_USE_C99_MATH_FUNCS // Yes, we do not just use sqrt(__sq) because hypot() is more // accurate. auto __norm = std::hypot(__ret[0], __ret[1]); diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index 40fc062e53d..f01a3af4371 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -2534,7 +2534,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return __complex_proj(__z.__rep()); } #endif -#elif defined _GLIBCXX_USE_C99_MATH_TR1 +#elif defined _GLIBCXX_USE_C99_MATH_FUNCS inline complex __complex_proj(const complex& __z) { diff --git a/libstdc++-v3/testsuite/20_util/from_chars/4.cc b/libstdc++-v3/testsuite/20_util/from_chars/4.cc index 63a32b511be..206e18daeb2 100644 --- a/libstdc++-v3/testsuite/20_util/from_chars/4.cc +++ b/libstdc++-v3/testsuite/20_util/from_chars/4.cc @@ -301,7 +301,7 @@ test_max_mantissa() if (Float_limits::is_iec559 && Float_limits::digits < UInt_limits::digits) { -#ifdef _GLIBCXX_USE_C99_MATH_TR1 +#ifdef _GLIBCXX_USE_C99_MATH_FUNCS std::printf("Testing %d-bit float, using %zu-bit integer\n", Float_limits::digits + (int)std::log2(Float_limits::max_exponent) + 1, sizeof(UIntT) * __CHAR_BIT__); diff --git a/libstdc++-v3/testsuite/20_util/from_chars/8.cc b/libstdc++-v3/testsuite/20_util/from_chars/8.cc index 865679cef8b..d37460a655c 100644 --- a/libstdc++-v3/testsuite/20_util/from_chars/8.cc +++ b/libstdc++-v3/testsuite/20_util/from_chars/8.cc @@ -286,7 +286,7 @@ test_max_mantissa() if (Float_limits::is_iec559 && Float_limits::digits < UInt_limits::digits) { -#ifdef _GLIBCXX_USE_C99_MATH_TR1 +#ifdef _GLIBCXX_USE_C99_MATH_FUNCS std::printf("Testing %d-bit float, using %zu-bit integer\n", Float_limits::digits + (int)std::log2(Float_limits::max_exponent) + 1, sizeof(UIntT) * __CHAR_BIT__); diff --git a/libstdc++-v3/testsuite/26_numerics/complex/proj.cc b/libstdc++-v3/testsuite/26_numerics/complex/proj.cc index b064e838b8e..b23b4a904dd 100644 --- a/libstdc++-v3/testsuite/26_numerics/complex/proj.cc +++ b/libstdc++-v3/testsuite/26_numerics/complex/proj.cc @@ -23,7 +23,7 @@ namespace test { -#ifdef _GLIBCXX_USE_C99_MATH_TR1 +#ifdef _GLIBCXX_USE_C99_MATH_FUNCS using std::copysign; #else bool copysign(float x, float y) @@ -405,7 +405,7 @@ main() normal ways to skip tests may not work: we don't have a test for C99_COMPLEX, and these macros may vary depending on -std=*, but macro tests wouldn't take them into account. */ -#if ! (_GLIBCXX_USE_C99_COMPLEX || _GLIBCXX_USE_C99_MATH_TR1) +#if ! (_GLIBCXX_USE_C99_COMPLEX || _GLIBCXX_USE_C99_MATH_FUNCS) if (true) return 0; #endif diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/60401.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/60401.cc index 5adcf993dc0..1351bbaf9c8 100644 --- a/libstdc++-v3/testsuite/26_numerics/headers/cmath/60401.cc +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/60401.cc @@ -28,7 +28,7 @@ namespace test Fabs = ::abs; -#ifdef _GLIBCXX_USE_C99_MATH_TR1 +#ifdef _GLIBCXX_USE_C99_MATH_FUNCS F acosh = ::acosh; F asinh = ::asinh; F atanh = ::atanh; diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x.cc index 13c1d0d0cd4..f81f08f8b3e 100644 --- a/libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x.cc +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/types_std_c++0x.cc @@ -21,7 +21,7 @@ void test01() { -#if _GLIBCXX_USE_C99_MATH_TR1 +#if _GLIBCXX_USE_C99_MATH_FUNCS typedef std::double_t my_double_t; typedef std::float_t my_float_t; diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp index 7d9471a1ded..c83147ce99a 100644 --- a/libstdc++-v3/testsuite/lib/libstdc++.exp +++ b/libstdc++-v3/testsuite/lib/libstdc++.exp @@ -1071,7 +1071,7 @@ proc check_v3_target_cstdint { } { # Return 1 if the C99 math facilities are available, 0 otherwise. proc check_v3_target_cmath { } { return [check_v3_target_prop_cached et_c99_math { - set cond "defined _GLIBCXX_USE_C99_MATH_TR1" + set cond "defined _GLIBCXX_USE_C99_MATH_FUNCS" return [v3_check_preprocessor_condition cmath $cond] }] } diff --git a/libstdc++-v3/testsuite/util/testsuite_random.h b/libstdc++-v3/testsuite/util/testsuite_random.h index 763707bbfac..a0c6bfda3ac 100644 --- a/libstdc++-v3/testsuite/util/testsuite_random.h +++ b/libstdc++-v3/testsuite/util/testsuite_random.h @@ -83,7 +83,7 @@ namespace __gnu_test return 0.0; } -#ifdef _GLIBCXX_USE_C99_MATH_TR1 +#ifdef _GLIBCXX_USE_C99_MATH_FUNCS inline double binomial_pdf(int k, int n, double p) { @@ -141,7 +141,7 @@ namespace __gnu_test return p * std::pow(1 - p, k); } -#ifdef _GLIBCXX_USE_C99_MATH_TR1 +#ifdef _GLIBCXX_USE_C99_MATH_FUNCS inline double negative_binomial_pdf(int k, int n, double p) { @@ -179,7 +179,7 @@ namespace __gnu_test return 1.0 / (b - a + 1.0); } -#ifdef _GLIBCXX_USE_C99_MATH_TR1 +#ifdef _GLIBCXX_USE_C99_MATH_FUNCS inline double lbincoef(int n, int k) {