From patchwork Mon Feb 20 11:23:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathaniel Shead X-Patchwork-Id: 59388 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1252075wrn; Mon, 20 Feb 2023 03:24:27 -0800 (PST) X-Google-Smtp-Source: AK7set8QNHANtATn446A1V1MLfZAehF0BjFY4CISusF6iTfSbFdNn1k9WjsBcQ+5Qa0HYqM6i7lQ X-Received: by 2002:a05:6402:215:b0:4aa:9fc2:216 with SMTP id t21-20020a056402021500b004aa9fc20216mr1021217edv.9.1676892267159; Mon, 20 Feb 2023 03:24:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676892267; cv=none; d=google.com; s=arc-20160816; b=JuFxJ30Q3mTLnDGb5fr6K38LVq8ItAD4tEYf7NX02slxkoJlN7S5ZNx5Z1Au+KZKjX arZjVTchRQ7KasypbdCNkFCrom2RiUA0I6m8F/CHYvkzXnevQ1L2kY/jBSBScYUaLwQ2 JeLX0Unm9knB4h2e+abd8IdAKZZNJEGeghwftqhqfyjWP8mNjIKstx6cxrhWZ/FWPgAf Nb8ZUWbVjeWheDVNAABLHkGCAHcSFmtBEuwQ3IDit16yXaMh2aaVgnuVJ9zyXWsfylIg sa/0KKANeU5DG1JYGjoseoFzLBVJK1O0R4X0TcJLlUXdYhHUBh3jVB1JhUQeIyUIh82z FtmA== 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-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=71HN327wAbJkbG1PLZ7FcijtS2pHixdQszTDjZbBVbA=; b=QZP22W1g6tBc7qnsCWZv81BYobAqM3FncXR4I4/VdpFtdei1eoPAEQShyL2DEaU/kC JssaqrrHRPCFueoGWKRIRxAlIprd0EA2ZF7uzU1LKrDtucfcgaqlC1FNkqKop+H8uHV1 qGGMqMgt5h7/jmR2BMo/gq3ed3l/FEb34HfwZ8VoOMYCteT1MYfmuNOG0Q0XM/Ei2t54 oZ/2YWlk2288LFcZxvrn7HGAHwLdr6bO307k1rLZtvNSyWnV2SeS1oLNeRtnst5ClQck MhqEJIX2SOQd2ze9cmSf+04iJk+ymZG7vUqa5JXrCEByfm4xBTvQLIv8syifv8J0lLYZ qajA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b="KlNlTqN/"; 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 y18-20020a056402135200b004accf1f8965si6785946edw.56.2023.02.20.03.24.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 03:24:27 -0800 (PST) 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="KlNlTqN/"; 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 6B741385781F for ; Mon, 20 Feb 2023 11:24:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6B741385781F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676892257; bh=71HN327wAbJkbG1PLZ7FcijtS2pHixdQszTDjZbBVbA=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=KlNlTqN/Gj860CunhTDNVkX7lusDoanaYL4rtiLVUQ0NLFyl2cABtCq2CMaWw+8yA 2lkhZTvdVNTt4XziCSLgHAHIHUNxy2/hH4dLvaxUIOBfdhbk1jXRJbK1U/CVod/Y2Q eqk2UwpLMkdbxZitzeJoUBAgA+SermyhbMhzb4BA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by sourceware.org (Postfix) with ESMTPS id 4B3F53858D1E; Mon, 20 Feb 2023 11:23:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4B3F53858D1E Received: by mail-pj1-x102e.google.com with SMTP id b14-20020a17090a8c8e00b002349579949aso976071pjo.5; Mon, 20 Feb 2023 03:23:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=71HN327wAbJkbG1PLZ7FcijtS2pHixdQszTDjZbBVbA=; b=DqB71PNOG95LdoaRUxqhgU8NwFYELodnhCNwkmt4gmTJNoVT4ymKyKTHa0A8/0gph+ 66L7emtGmoG24MDYS+dayYDq/hxZJ7YuE/L//GaspJpNkAxTYI+ZRgU52EgVZ6GOgr5s +B4gqH9u7/3hicdt+E4QcfLqxnZ15KXLXIsVu5iJV7E7Bf88+lHf+8LD+S9+UqS3cLcK HrOkQ8kjL0Q3UabxyyvsuztSCzkh83QMR/P3J2tO7bEu4VZoml9v/6OgKPWz5cM/MsF+ dipEq49LrziTMDPtpV+HF4KwoyT6sRKZ18wVfIfncQ4bmCkiugGphl8rbv0ZHXA1fMm2 YMBg== X-Gm-Message-State: AO0yUKWjTAGGiZo5Q7o/9v4rySWWkTJMnxkGCHaNX+Jig2kJSDBZy3fv hLwjiu1Ih1tQMLNZ3SePJiFwW3KWbSE= X-Received: by 2002:a17:90b:4ac3:b0:233:f354:e7df with SMTP id mh3-20020a17090b4ac300b00233f354e7dfmr2219134pjb.18.1676892209864; Mon, 20 Feb 2023 03:23:29 -0800 (PST) Received: from Thaum.localdomain ([203.166.251.199]) by smtp.gmail.com with ESMTPSA id mv5-20020a17090b198500b002311c4596f6sm1515528pjb.54.2023.02.20.03.23.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 03:23:29 -0800 (PST) Date: Mon, 20 Feb 2023 22:23:25 +1100 To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] libstdc++: Add missing functions to [PR79700] Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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: Nathaniel Shead via Gcc-patches From: Nathaniel Shead Reply-To: Nathaniel Shead 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?1758348985965148065?= X-GMAIL-MSGID: =?utf-8?q?1758348985965148065?= The comments on PR79700 mentioned that it was somewhat ambiguous whether these functions were supposed to exist for C++11 or not. I chose to add them there, since other resources (such as cppreference) seem to think that C++11 should be the standard these functions were introduced, and I don't know of any reason to do otherwise. Tested on x86_64-linux. -- 8< -- This patch adds the -f and -l variants of the C89 functions to under namespace std (so std::sqrtf, std::fabsl, etc.) for C++11 and up. libstdc++-v3/ChangeLog: PR libstdc++/79700 * include/c_global/cmath (acosf, acosl, asinf, asinl, atanf, atanl, atan2f, atan2l, ceilf, ceill, cosf, cosl, coshf, coshl, expf, expl, fabsf, fabsl, floorf, floorl, fmodf, fmodl, frexpf, frexpl, ldexpf, ldexpl, logf, logl, log10f, log10l, modff, modfl, powf, powl, sinf, sinl, sinhf, sinhl, sqrtf, sqrtl, tanf, tanl, tanhf, tanhl): Add aliases in namespace std. * testsuite/26_numerics/headers/cmath/functions_std_c++17.cc: Add checks for existence of above names. Signed-off-by: Nathaniel Shead Signed-off-by: Nathaniel Shead --- libstdc++-v3/include/c_global/cmath | 111 ++++++++++++++++++ .../headers/cmath/functions_std_c++17.cc | 45 +++++++ 2 files changed, 156 insertions(+) diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath index 568eb354c2d..eaebde33dee 100644 --- a/libstdc++-v3/include/c_global/cmath +++ b/libstdc++-v3/include/c_global/cmath @@ -1767,6 +1767,117 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #if __cplusplus >= 201103L +#undef acosf +#undef acosl +#undef asinf +#undef asinl +#undef atanf +#undef atanl +#undef atan2f +#undef atan2l +#undef ceilf +#undef ceill +#undef cosf +#undef cosl +#undef coshf +#undef coshl +#undef expf +#undef expl +#undef fabsf +#undef fabsl +#undef floorf +#undef floorl +#undef fmodf +#undef fmodl +#undef frexpf +#undef frexpl +#undef ldexpf +#undef ldexpl +#undef logf +#undef logl +#undef log10f +#undef log10l +#undef modff +#undef modfl +#undef powf +#undef powl +#undef sinf +#undef sinl +#undef sinhf +#undef sinhl +#undef sqrtf +#undef sqrtl +#undef tanf +#undef tanl +#undef tanhf +#undef tanhl + + using ::acosf; + using ::acosl; + + using ::asinf; + using ::asinl; + + using ::atanf; + using ::atanl; + + using ::atan2f; + using ::atan2l; + + using ::ceilf; + using ::ceill; + + using ::cosf; + using ::cosl; + + using ::coshf; + using ::coshl; + + using ::expf; + using ::expl; + + using ::fabsf; + using ::fabsl; + + using ::floorf; + using ::floorl; + + using ::fmodf; + using ::fmodl; + + using ::frexpf; + using ::frexpl; + + using ::ldexpf; + using ::ldexpl; + + using ::logf; + using ::logl; + + using ::log10f; + using ::log10l; + + using ::modff; + using ::modfl; + + using ::powf; + using ::powl; + + using ::sinf; + using ::sinl; + + using ::sinhf; + using ::sinhl; + + using ::sqrtf; + using ::sqrtl; + + using ::tanf; + using ::tanl; + + using ::tanhf; + using ::tanhl; + #ifdef _GLIBCXX_USE_C99_MATH_TR1 #undef acosh diff --git a/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc index 3b4ada1a756..c6ec636c183 100644 --- a/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc +++ b/libstdc++-v3/testsuite/26_numerics/headers/cmath/functions_std_c++17.cc @@ -44,6 +44,51 @@ namespace gnu using std::tan; using std::tanh; + using std::acosf; + using std::acosl; + using std::asinf; + using std::asinl; + using std::atanf; + using std::atanl; + using std::atan2f; + using std::atan2l; + using std::ceilf; + using std::ceill; + using std::cosf; + using std::cosl; + using std::coshf; + using std::coshl; + using std::expf; + using std::expl; + using std::fabsf; + using std::fabsl; + using std::floorf; + using std::floorl; + using std::fmodf; + using std::fmodl; + using std::frexpf; + using std::frexpl; + using std::ldexpf; + using std::ldexpl; + using std::logf; + using std::logl; + using std::log10f; + using std::log10l; + using std::modff; + using std::modfl; + using std::powf; + using std::powl; + using std::sinf; + using std::sinl; + using std::sinhf; + using std::sinhl; + using std::sqrtf; + using std::sqrtl; + using std::tanf; + using std::tanl; + using std::tanhf; + using std::tanhl; + using std::assoc_laguerre; using std::assoc_laguerref; using std::assoc_laguerrel;