From patchwork Tue Jun 28 08:31:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 55471 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1FA4B3831C98 for ; Tue, 28 Jun 2022 08:32:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1FA4B3831C98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1656405139; bh=BJeXJqEu3fpr1gGXjKq/Tqcy2HzZR3gbiA8HffiGw5U=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=edE1K/tie7QajfZcAJRfhw619Vo/PlMt5p+yatGarptbV+Yiopa8RXy+/RsqXCjaY pfv+VrYBKnn0ij6DHFI2xGs3OFqPR0aZrJKkvHVJr6DDVtJMO3jOfZdl0DRIGj6PNK PbXmcrgxCiUrUJQCUCGqSjDBoCroAqH4+xKWeatY= 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.133.124]) by sourceware.org (Postfix) with ESMTPS id A20193857B8D for ; Tue, 28 Jun 2022 08:31:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A20193857B8D 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-14-fdJKpZ_sNtiHMP5uBlQFRw-1; Tue, 28 Jun 2022 04:31:10 -0400 X-MC-Unique: fdJKpZ_sNtiHMP5uBlQFRw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9BB273C0F36E; Tue, 28 Jun 2022 08:31:10 +0000 (UTC) Received: from localhost (unknown [10.33.36.212]) by smtp.corp.redhat.com (Postfix) with ESMTP id 64E3F2026D64; Tue, 28 Jun 2022 08:31:10 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: testsuite: Guard use of C99 std::log2 Date: Tue, 28 Jun 2022 09:31:09 +0100 Message-Id: <20220628083109.144301-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Tested x86_64-linux, poushed to trunk. -- >8 -- This prevents the test from failing if the only thing not supported is the text printed to the log about the size of the floating-point type. libstdc++-v3/ChangeLog: * testsuite/20_util/from_chars/4.cc: Only use log2 if C99 math functions are available. --- libstdc++-v3/testsuite/20_util/from_chars/4.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libstdc++-v3/testsuite/20_util/from_chars/4.cc b/libstdc++-v3/testsuite/20_util/from_chars/4.cc index dcd9f97c946..c27df4ffa5e 100644 --- a/libstdc++-v3/testsuite/20_util/from_chars/4.cc +++ b/libstdc++-v3/testsuite/20_util/from_chars/4.cc @@ -300,9 +300,11 @@ test_max_mantissa() if (Float_limits::is_iec559 && Float_limits::digits < UInt_limits::digits) { +#ifdef _GLIBCXX_USE_C99_MATH_TR1 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__); +#endif std::from_chars_result res; FloatT flt;