From patchwork Thu Feb 9 17:57:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 140416 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]) by ozlabs.org (Postfix) with SMTP id 67E96B6F13 for ; Fri, 10 Feb 2012 04:57:56 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1329415076; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:From:To:Cc:Subject:References:Date:In-Reply-To: Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=VG4zQgFycz4zvMjqHaFZ9HrPy58=; b=NWdGXZpNEUuQPsiIfcm54N6Rbg4+FJuJsHt8zRQtT5S/xSKdnS1qZMVT1APklv d+T1gffjPar1mAfUy0tAp+3SVw5+RmdYI3slX0BGbxuuxngdcsmuHfQ4upz5DMBC IiHg3/9u5cM4xT0EQbPj8sp8v/LzLSSzA+ZLUmW+sdS8E= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID:User-Agent:MIME-Version:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=uNOrDJ5FE9mkzjDDyFaOvE0LJWAWXUkqoKm/vV4W0D6rUlIDwv7vt1SGy8iKb+ VFIMYwiiQVKOO/nNTGKSoP3AKwZ9IT3sYZh5Hcv4+QHPSf5eoqIjZEqg+K/jVFrb dtZRKnRdI6p8DGcXmxT2V0l97QRdDj927rMzVFT07Nbgg=; Received: (qmail 23793 invoked by alias); 9 Feb 2012 17:57:51 -0000 Received: (qmail 23784 invoked by uid 22791); 9 Feb 2012 17:57:50 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 09 Feb 2012 17:57:36 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id 48B88804; Thu, 9 Feb 2012 18:57:35 +0100 (CET) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id OOtxZiPtpDLz; Thu, 9 Feb 2012 18:57:33 +0100 (CET) Received: from manam.CeBiTec.Uni-Bielefeld.DE (manam.CeBiTec.Uni-Bielefeld.DE [129.70.161.120]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 66643803; Thu, 9 Feb 2012 18:57:33 +0100 (CET) Received: (from ro@localhost) by manam.CeBiTec.Uni-Bielefeld.DE (8.14.5+Sun/8.14.5/Submit) id q19HvWeN007862; Thu, 9 Feb 2012 18:57:32 +0100 (MET) From: Rainer Orth To: Ian Lance Taylor Cc: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: Re: Go patch committed: Provide matherr function References: Date: Thu, 09 Feb 2012 18:57:32 +0100 In-Reply-To: (Ian Lance Taylor's message of "Thu, 09 Feb 2012 09:53:19 -0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes 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 Ian Lance Taylor writes: >> Unfortunately, this breaks the libgo build on Solaris 8 and 9: >> >> /vol/gcc/src/hg/trunk/local/libgo/runtime/go-matherr.c: In function 'matherr': >> /vol/gcc/src/hg/trunk/local/libgo/runtime/go-matherr.c:38:17: error: 'NAN' undeclared (first use in this function) >> /vol/gcc/src/hg/trunk/local/libgo/runtime/go-matherr.c:38:17: note: each undeclared identifier is reported only once for each function it appears in >> /vol/gcc/src/hg/trunk/local/libgo/runtime/go-matherr.c:68:28: error: 'INFINITY' undeclared (first use in this function) >> make[4]: *** [go-matherr.lo] Error 1 >> >> I couldn't find an appproprite replacement in the system headers. > > Hmmm, INFINITY and NAN are in C99. True, but full C99 support was only introduced in Solaris 10. > Does it work to do something like > > #ifndef INFINITY > #define INFINITY (1.0 / 0.0) > #endif > > #ifndef NAN > #define NAN (0.0 / 0.0) > #endif > > ? I could give it a try once the current bootstraps are finished. For the moment I've shamelessly adapted the following from the __GNUC__ section of Solaris 11 : > Another possibility for NAN would to call nan(), if that is available. It's not, unfortunately. Rainer diff --git a/libgo/runtime/go-matherr.c b/libgo/runtime/go-matherr.c --- a/libgo/runtime/go-matherr.c +++ b/libgo/runtime/go-matherr.c @@ -24,6 +24,14 @@ #define PI 3.14159265358979323846264338327950288419716939937510582097494459 +#ifndef INFINITY +#define INFINITY (__builtin_inff ()) +#endif + +#ifndef NAN +#define NAN (__builtin_nanf ("")) +#endif + int matherr (struct exception* e) {