Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1au5PP-0004AC-0O for pgsql-hackers@arkaria.postgresql.org; Sat, 23 Apr 2016 21:48:11 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1au5PO-00050a-Dy for pgsql-hackers@arkaria.postgresql.org; Sat, 23 Apr 2016 21:48:10 +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 1au5O3-0003VW-Ar for pgsql-hackers@postgresql.org; Sat, 23 Apr 2016 21:46:47 +0000 Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1au5Nz-00037j-QC for pgsql-hackers@postgresql.org; Sat, 23 Apr 2016 21:46:46 +0000 Received: from mfilter22-d.gandi.net (mfilter22-d.gandi.net [217.70.178.150]) by relay4-d.mail.gandi.net (Postfix) with ESMTP id 88C06172098; Sat, 23 Apr 2016 23:46:41 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter22-d.gandi.net Received: from relay4-d.mail.gandi.net ([IPv6:::ffff:217.70.183.196]) by mfilter22-d.gandi.net (mfilter22-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id 6UXYljWgjkKy; Sat, 23 Apr 2016 23:46:39 +0200 (CEST) X-Originating-IP: 98.122.164.227 Received: from [192.168.10.146] (unknown [98.122.164.227]) (Authenticated sender: adsend@dunslane.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id D404817209F; Sat, 23 Apr 2016 23:46:37 +0200 (CEST) Subject: Re: VS 2015 support in src/tools/msvc To: Christian Ullrich , Michael Paquier References: <5707AC9E.7070309@dunslane.net> <5707C80F.9050709@chrullrich.net> <5707D7DC.2030508@dunslane.net> <5707E074.4030102@chrullrich.net> <0B77CFCB-0F90-4CAB-8509-7EB391C06D59@chrullrich.net> <570A6A14.6040303@dunslane.net> <570A9FCE.5040201@chrullrich.net> <570ABFA0.4090403@2ndquadrant.com> <57192C59.9090903@dunslane.net> <571BD6D4.9@dunslane.net> Cc: Petr Jelinek , Robert Haas , Tom Lane , Magnus Hagander , PostgreSQL mailing lists From: Andrew Dunstan Message-ID: <571BED3C.5070209@dunslane.net> Date: Sat, 23 Apr 2016 17:46:36 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) 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 On 04/23/2016 05:30 PM, Christian Ullrich wrote: > * Andrew Dunstan wrote: > >> On 04/22/2016 01:21 AM, Michael Paquier wrote: > >>>>> 5. It also complains about us casting a pid_t to a HANDLE in >>>>> pg_basebackup.c. Not sure what to do about that. >>>> The thing that's being cast is not a PID, but a HANDLE to a process. >>>> pid_t is a typedef for int (in port/win32.h), therefore is always 32 >>>> bits, while HANDLE is actually void*. However, Microsoft guarantees >>>> that kernel32 HANDLEs (this includes those to threads and processes) >>>> fit into 32 bits on AMD64. > >>> Yes, when casting things this way I think that a comment would be fine >>> in the code. We could do that as separate patches actually. >> >> We are already casting the pid_t to HANDLE and still getting a warning. >> Apparently we need to do something on win64 like >> >> (HANDLE) ((int64) bgchild) > > Ah, OK, it warns about a cast to a larger type because the value might > get sign extended. Not unreasonable. > > In this case, I would prefer this: > > diff --git a/src/include/port/win32.h b/src/include/port/win32.h > index ba8cf9d..b4086f1 100644 > --- a/src/include/port/win32.h > +++ b/src/include/port/win32.h > @@ -256,7 +256,7 @@ typedef int gid_t; > typedef long key_t; > > #ifdef WIN32_ONLY_COMPILER > -typedef int pid_t; > +typedef intptr_t pid_t; > #endif > > /* > > With this change, pg_basebackup -X stream works the same when built > for 64 and 32 bits. > That's a change that will have a pretty wide effect. Everything up to now has been pretty low risk, but this worries me rather more. Maybe it's safe, but I'd like to hear others' comments. cheers andrew -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers