On Mon, May 26, 2014 at 09:50:42PM +0900, Michael Paquier wrote:
> > x86_64-w64-mingw32-gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith 
> > -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute 
> > -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard 
> > -g -I/home/pgrunner/bf/root/HEAD/pgsql.5100/../pgsql/src/interfaces/libpq 
> > -I../../../src/include 
> > -I/home/pgrunner/bf/root/HEAD/pgsql.5100/../pgsql/src/include 
> > -I../pgsql/src/include/port/win32 -DEXEC_BACKEND 
> > -I/c/prog/3p64/include/libxml2  -I/c/prog/3p64/include 
> > -I/c/prog/3p64/openssl/include 
> > "-I/home/pgrunner/bf/root/HEAD/pgsql.5100/../pgsql/src/include/port/win32"  
> > -c -o parallel.o 
> > /home/pgrunner/bf/root/HEAD/pgsql.5100/../pgsql/src/bin/pg_dump/parallel.c
> > c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.5100/../pgsql/src/bin/pg_dump/parallel.c:
> >  In function 'pgpipe':
> > c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.5100/../pgsql/src/bin/pg_dump/parallel.c:1332:2:
> >  warning: overflow in implicit constant conversion [-Woverflow]
> >   handles[0] = handles[1] = INVALID_SOCKET;
> >   ^
> > c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.5100/../pgsql/src/bin/pg_dump/parallel.c:1386:3:
> >  warning: overflow in implicit constant conversion [-Woverflow]
> >    handles[1] = INVALID_SOCKET;
> >    ^
> In mingw-w64, SOCKET_INVALID is defined as ~0:
> http://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-headers/include/psdk_inc/_socket_types.h
> Is this overflow caused because SOCKET_INVALID corresponds to a 64b
> value in mingw-w64?
> Looking at the code this exists since 9.3.

I think this is caused because the variable is not defined as SOCKET. 
The attached patch fixes this.  This should prevent the warning.

-- 
  Bruce Momjian  <br...@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +
diff --git a/src/bin/pg_dump/parallel.c b/src/bin/pg_dump/parallel.c
new file mode 100644
index caedbb8..cd6ef7a
*** a/src/bin/pg_dump/parallel.c
--- b/src/bin/pg_dump/parallel.c
***************
*** 36,42 ****
  #ifdef WIN32
  static unsigned int tMasterThreadId = 0;
  static HANDLE termEvent = INVALID_HANDLE_VALUE;
! static int	pgpipe(int handles[2]);
  static int	piperead(int s, char *buf, int len);
  
  /*
--- 36,42 ----
  #ifdef WIN32
  static unsigned int tMasterThreadId = 0;
  static HANDLE termEvent = INVALID_HANDLE_VALUE;
! static int	pgpipe(SOCKET handles[2]);
  static int	piperead(int s, char *buf, int len);
  
  /*
*************** readMessageFromPipe(int fd)
*** 1323,1329 ****
   * with recv/send.
   */
  static int
! pgpipe(int handles[2])
  {
  	SOCKET		s;
  	struct sockaddr_in serv_addr;
--- 1323,1329 ----
   * with recv/send.
   */
  static int
! pgpipe(SOCKET handles[2])
  {
  	SOCKET		s;
  	struct sockaddr_in serv_addr;
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to