From patchwork Tue Jan 5 22:43:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Ellcey X-Patchwork-Id: 563647 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9D56F14029E for ; Wed, 6 Jan 2016 09:44:20 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=WkILtKUc; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :date:to:subject:mime-version:content-type :content-transfer-encoding:message-id; q=dns; s=default; b=jOaD8 pEAaC73HCA5JO5y/NHNJV8qSrMND6a3UlQSO2rhI9y+urgf8U0DB1G4+8h1mOOfu AjxvkS9jkdjYo1FU+VXCU+ONvOr2sN0f+A7/wNKxo9cgScvyWe2Rdbp4up0fTFfr WapkkV5HHiZ3658DPBhwpewkKCBAeBOWcsmLZQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :date:to:subject:mime-version:content-type :content-transfer-encoding:message-id; s=default; bh=vNkTOtGKV9b 8JhvkIdN1v7eVwx8=; b=WkILtKUc8R2AOk5vk3EU9NcE8pnkZ9k4l16tiHwfb1I szoMK2EOGffrgavIdeJj6kZiISSPHWW5ojW0cMGWiNV5lK7+3+Zm4QXiOjVpDDRX 8bgqmno6I7pwJn+4Ef/nS88EQaRDjpkeVoPsRjA1pjDKKLXPCcM/0xAEN+25QXpw = Received: (qmail 21715 invoked by alias); 5 Jan 2016 22:44:07 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 21686 invoked by uid 89); 5 Jan 2016 22:44:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, BAYES_20, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=__val, UD:tcc, UD:random.tcc, random.tcc X-Spam-User: qpsmtpd, 2 recipients X-HELO: mailapp01.imgtec.com Received: from mailapp01.imgtec.com (HELO mailapp01.imgtec.com) (195.59.15.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 05 Jan 2016 22:44:05 +0000 Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Websense Email Security Gateway with ESMTPS id 86BA6FF8CD6BE; Tue, 5 Jan 2016 22:43:58 +0000 (GMT) Received: from BAMAIL02.ba.imgtec.org (10.20.40.28) by hhmail02.hh.imgtec.org (10.100.10.20) with Microsoft SMTP Server (TLS) id 14.3.235.1; Tue, 5 Jan 2016 22:44:02 +0000 Received: from ubuntu-sellcey.mips.com (10.20.3.214) by bamail02.ba.imgtec.org (10.20.40.28) with Microsoft SMTP Server id 14.3.174.1; Tue, 5 Jan 2016 14:43:59 -0800 Received: by ubuntu-sellcey.mips.com (sSMTP sendmail emulation); Tue, 05 Jan 2016 14:43:59 -0800 From: "Steve Ellcey " Date: Tue, 5 Jan 2016 14:43:59 -0800 To: , Subject: [Patch] Fix libstdc++ build when using uclibc instead of glibc User-Agent: Heirloom mailx 12.5 6/20/10 MIME-Version: 1.0 Message-ID: <6ecc7322-9335-4197-9508-34af9946c491@BAMAIL02.ba.imgtec.org> While trying to build GCC with uclibc instead of glibc I ran into a build failure in libstdc++. uclibc doesn't seem to provide the isfinite function like glibc does so that means that libstdc++ doesn't have std::isfinite. This in turn caused include/ext/random.tcc to not compile because it uses std::isfinite. I can easily see how this might be considered a uclibc bug but given that it is the only build problem I ran into I was hoping we could fix it in libstdc++ by using __builtin_finite instead of std::isfinite. This fixes my uclibc build and also worked for glibc with no regressions. OK to checkin? Steve Ellcey sellcey@imgtec.com 2016-01-05 Steve Ellcey * include/ext/random.tcc: Use __builtin_finite instead of std::isfinite. diff --git a/libstdc++-v3/include/ext/random.tcc b/libstdc++-v3/include/ext/random.tcc index a9c5a2b..3467823 100644 --- a/libstdc++-v3/include/ext/random.tcc +++ b/libstdc++-v3/include/ext/random.tcc @@ -1570,7 +1570,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __t; }); __norm = std::sqrt(__sum); } - while (__norm == _RealType(0) || ! std::isfinite(__norm)); + while (__norm == _RealType(0) || ! __builtin_finite(__norm)); std::transform(__ret.begin(), __ret.end(), __ret.begin(), [__norm](_RealType __val){ return __val / __norm; });