Re: Re: popen and pclose redefinitions causing many warning in Windows build

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Noah Misch <noah(at)leadboat(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: popen and pclose redefinitions causing many warning in Windows build
Date: 2014-05-26 12:50:42
Message-ID: CAB7nPqSzq1XxTzp62Q+afqnd9XPcdLW4+UTpnj1yqKG2F9-oiA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, May 23, 2014 at 10:43 PM, Alvaro Herrera
<alvherre(at)2ndquadrant(dot)com> 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../../../../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" -DBUILDING_DLL -c -o mingwcompat.o /home/pgrunner/bf/root/HEAD/pgsql.5100/../pgsql/src/backend/port/win32/mingwcompat.c
> c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.5100/../pgsql/src/backend/port/win32/mingwcompat.c:60:1: warning: 'RegisterWaitForSingleObject' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes]
> RegisterWaitForSingleObject(PHANDLE phNewWaitObject,
> ^
This one is also an old warning, looking at the buildfarm it is
present as well in REL9_2_STABLE... In mingw-w64
RegisterWaitForSingleObject is already defined in winbase.h here:
http://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-headers/include/winbase.h
What do you think about adding a #ifndef _WINBASE_ block that includes
LoadKernel32 and RegisterWaitForSingleObject in mingwcompat.c?

> 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.

> 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. -I/home/pgrunner/bf/root/HEAD/pgsql.5100/../pgsql/contrib/pg_stat_statements -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 pg_stat_statements.o /home/pgrunner/bf/root/HEAD/pgsql.5100/../pgsql/contrib/pg_stat_statements/pg_stat_statements.c
> c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.5100/../pgsql/contrib/pg_stat_statements/pg_stat_statements.c: In function 'pgss_ProcessUtility':
> c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.5100/../pgsql/contrib/pg_stat_statements/pg_stat_statements.c:998:4: warning: unknown conversion type character 'l' in format [-Wformat=]
> sscanf(completionTag, "COPY " UINT64_FORMAT, &rows) != 1)
> ^
> c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.5100/../pgsql/contrib/pg_stat_statements/pg_stat_statements.c:998:4: warning: too many arguments for format [-Wformat-extra-args]
Hm... After a little bit of googling, I found that:
http://sourceforge.net/p/mingw/bugs/1315/
This seems to be part of the standard of Microsoft, making sscanf not
accept ISO-C99 format specifiers. Looking more into the code, this is
a pretty old warning introduced by a5495cd of 2009. This code is btw
correct as the number of rows returned by a COPY is uint64. Any idea
what would be doable here?

Regards,
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2014-05-26 13:59:49 Re: Allowing line-continuation in pgbench custom scripts
Previous Message Albe Laurenz 2014-05-26 10:33:12 Re: IMPORT FOREIGN SCHEMA statement