Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dFwcr-0001s5-Q2 for pgsql-hackers@arkaria.postgresql.org; Wed, 31 May 2017 05:56:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dFwcp-0000QO-Sj for pgsql-hackers@arkaria.postgresql.org; Wed, 31 May 2017 05:56:55 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dFwbG-000678-Tk for pgsql-hackers@postgresql.org; Wed, 31 May 2017 05:55:18 +0000 Received: from bay.acenet.us ([173.230.252.50]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dFwbD-0000RS-6q for pgsql-hackers@postgresql.org; Wed, 31 May 2017 05:55:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=anastigmatix.net; s=default; h=Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:From:Cc:References:To:Subject:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=JENYwlO3PU5L2r8rQ1BBs0qz7uXO+5a7Gtu2Tyl7Shk=; b=U9qTdM7x1h4c8tIKsIMZdHDYr nzRqjn7GwAFCm69rtznLEWWlrtylwnA9kPXyjPQQ7NBQ7a1Ie3GFjYy+U87us/9gThIYcv6EPmxab kUo0eA/8DbZOg4Vf/z16piyishCSWJKV0yPgImR1+8oTaX73czCw5S+lvDiqTVFAHB+N+cW6IT9l1 EQBsG33dd75ZOAB1EeQAelP1uMqPIFfj4ufQCzp5XldwrhSxSmctTVGZxrv9FLvo5a0wB/5VrIzek dCOPW3D88KVGMnRjXFgaEB44r1ePo249l5JNm5nJeY0RmB9PVTZSjPkVK8lAJz2Cq5Zv4FTZaHGDI JA2JB19cg==; Received: from [50.102.16.86] (port=48977) by bay.acenet.us with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89) (envelope-from ) id 1dFwb9-004CM6-OG; Wed, 31 May 2017 01:55:12 -0400 Subject: Re: [PATCH] quiet conversion warning in DatumGetFloat4 To: Tom Lane References: <592E4D04.1070609@anastigmatix.net> <5894.1496208390@sss.pgh.pa.us> Cc: PostgreSQL Hackers From: Chapman Flack Message-ID: <592E5ABF.8070706@anastigmatix.net> Date: Wed, 31 May 2017 01:55:11 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <5894.1496208390@sss.pgh.pa.us> Content-Type: multipart/mixed; boundary="------------060206020600090101090304" X-OutGoing-Spam-Status: No, score=-100.2 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bay.acenet.us X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - anastigmatix.net X-Get-Message-Sender-Via: bay.acenet.us: authenticated_id: chap+anastigmatix.net/only user confirmed/virtual account not confirmed X-Authenticated-Sender: bay.acenet.us: chap@anastigmatix.net X-Source: X-Source-Args: X-Source-Dir: X-Pg-Spam-Score: -2.0 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org This is a multi-part message in MIME format. --------------060206020600090101090304 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 05/31/17 01:26, Tom Lane wrote: > Hm. I think it would be better to use DatumGetInt32 here. Arguably, > direct use of GET_4_BYTES and its siblings should only appear in > DatumGetFoo macros. Like so? These are the 4 sites where {GET,SET}_n_BYTES got introduced in 14cca1b (for consistency, though only the GET_4 case produces warnings). -Chap --------------060206020600090101090304 Content-Type: text/x-patch; name="quiet-conversion-warning-getfloat4-v2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="quiet-conversion-warning-getfloat4-v2.patch" --- src/include/postgres.h 2017-05-31 01:36:16.621829183 -0400 +++ src/include/postgres.h 2017-05-31 01:45:51.303427115 -0400 @@ -679,7 +679,7 @@ float4 retval; } myunion; - myunion.value = GET_4_BYTES(X); + myunion.value = DatumGetInt32(X); return myunion.retval; } #else @@ -704,7 +704,7 @@ } myunion; myunion.value = X; - return SET_4_BYTES(myunion.retval); + return Int32GetDatum(myunion.retval); } #else extern Datum Float4GetDatum(float4 X); @@ -727,7 +727,7 @@ float8 retval; } myunion; - myunion.value = GET_8_BYTES(X); + myunion.value = DatumGetInt64(X); return myunion.retval; } #else @@ -753,7 +753,7 @@ } myunion; myunion.value = X; - return SET_8_BYTES(myunion.retval); + return Int64GetDatum(myunion.retval); } #else extern Datum Float8GetDatum(float8 X); --------------060206020600090101090304 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --------------060206020600090101090304--