pg_dump warnings in MinGW build

Started by Jeff Janesover 11 years ago2 messages
#1Jeff Janes
jeff.janes@gmail.com
1 attachment(s)

Now that popen and pclose don't throw thousands of warnings when compiling
mingw builds, some other warnings stand out.

parallel.c: In function 'pgpipe':
parallel.c:1332:2: warning: overflow in implicit constant conversion
[-Woverflow]
parallel.c:1386:3: warning: overflow in implicit constant conversion
[-Woverflow]

I think the solution is to use the pgsocket typedef from
src/include/port.h, rather than int. Like attached.

But I'm far from being a typedef lawyer, so maybe I am all wet.

Cheers,

Jeff

Attachments:

pgpipe.patchapplication/octet-stream; name=pgpipe.patchDownload
diff --git a/src/bin/pg_dump/parallel.c b/src/bin/pg_dump/parallel.c
index caedbb8..edc8e42 100644
--- a/src/bin/pg_dump/parallel.c
+++ b/src/bin/pg_dump/parallel.c
@@ -36,7 +36,7 @@
 #ifdef WIN32
 static unsigned int tMasterThreadId = 0;
 static HANDLE termEvent = INVALID_HANDLE_VALUE;
-static int	pgpipe(int handles[2]);
+static int	pgpipe(pgsocket handles[2]);
 static int	piperead(int s, char *buf, int len);
 
 /*
@@ -527,7 +527,7 @@ ParallelBackupStart(ArchiveHandle *AH, RestoreOptions *ropt)
 #else
 		pid_t		pid;
 #endif
-		int			pipeMW[2],
+		pgsocket		pipeMW[2],
 					pipeWM[2];
 
 		if (pgpipe(pipeMW) < 0 || pgpipe(pipeWM) < 0)
@@ -1323,7 +1323,7 @@ readMessageFromPipe(int fd)
  * with recv/send.
  */
 static int
-pgpipe(int handles[2])
+pgpipe(pgsocket handles[2])
 {
 	SOCKET		s;
 	struct sockaddr_in serv_addr;
#2Bruce Momjian
bruce@momjian.us
In reply to: Jeff Janes (#1)
Re: pg_dump warnings in MinGW build

On Thu, May 15, 2014 at 10:52:43AM -0700, Jeff Janes wrote:

Now that popen and pclose don't throw thousands of warnings when compiling
mingw builds, some other warnings stand out.

parallel.c: In function 'pgpipe':
parallel.c:1332:2: warning: overflow in implicit constant conversion
[-Woverflow]
parallel.c:1386:3: warning: overflow in implicit constant conversion
[-Woverflow]

I think the solution is to use the pgsocket typedef from src/include/port.h,
rather than int. �Like attached.

But I'm far from being a typedef lawyer, so maybe I am all wet.

FYI, I am not sure if you saw that this was fixed in June as part of a
larger patch:

commit ac608fe758455804f26179ea7c556e7752e453e8
Author: Bruce Momjian <bruce@momjian.us>
Date: Mon Jun 16 15:24:38 2014 -0400

Use type pgsocket for Windows pipe emulation socket calls

This prevents several compiler warnings on Windows.

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

+ Everyone has their own god. +

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers