Re: [HACKERS] longstanding mingw warning

2011-08-10 Thread Magnus Hagander
On Wed, Aug 10, 2011 at 17:25, Andrew Dunstan  wrote:
>
>
> On 08/10/2011 08:08 AM, Magnus Hagander wrote:
>>
>> On Tue, Jul 26, 2011 at 15:20, Andrew Dunstan  wrote:
>>>
>>> Why do we get this warning on Mingw?:
>>>
>>>   x86_64-w64-mingw32-gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
>>> -Wdeclaration-after-statement -Wendif-labels -Wformat-security
>>> -fno-strict-aliasing -fwrapv -g -I../../../../src/include
>>> -I/home/pgrunner/bf/root/HEAD/pgsql.3896/../pgsql/src/include
>>> -I../pgsql/src/include/port/win32 -DEXEC_BACKEND
>>>  -I/c/prog/mingwdep/include
>>>
>>> "-I/home/pgrunner/bf/root/HEAD/pgsql.3896/../pgsql/src/include/port/win32"
>>> -DBUILDING_DLL  -c -o mingwcompat.o
>>>
>>> /home/pgrunner/bf/root/HEAD/pgsql.3896/../pgsql/src/backend/port/win32/mingwcompat.c
>>>
>>>
>>> c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.3896/../pgsql/src/backend/port/win32/mingwcompat.c:60:1:
>>> warning: 'RegisterWaitForSingleObject' redeclared without dllimport
>>> attribute: previous dllimport ignored
>>>
>>>
>>> Can we get rid of it?
>>
>> I don't recall this warning specifically - I wonder if it's specific
>> to certain version(s) of mingw? It's in mingwcompat.c simply because
>> the mingw API headers were broken. That warning sounds to me like you
>> suddenly have RegisterWaitForSingleObject present in the system
>> headers - can you check that it is?
>>
>> If it is in the system headers, we need some way to check when it
>> appeared, and then add the function only if it isn't there. Either by
>> autoconf, or if we can make a simple hardcoded ifdef (since the file
>> is only ever compiled on mingw).
>>
>
> In some versions of the headers it's declared unconditionally, in others
> it's declared if __WIN32_WINNT > 0x0500 which we are these days. But it
> looks like we're trying to override the builtin, not just supply a
> declaration.
>

The original reason it was put there was that it was missing from
*both* the header *and* the library. Thus just providing the
declaration didn't solve the problem. If mingw has now added it to
both headers and library, then yes, it will currently try to override
the builtin - but only because the builtin didn't exist at the time.

So we need to detect whether the builtin exists in the installed
version of mingw, and just not include our version *at all* when it
does exist. This can be done either through autoconf or if there's a
mingw header somewhere that changed when they did add it (like a
version number?)

-- 
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

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


Re: [HACKERS] longstanding mingw warning

2011-08-10 Thread Andrew Dunstan



On 08/10/2011 08:08 AM, Magnus Hagander wrote:

On Tue, Jul 26, 2011 at 15:20, Andrew Dunstan  wrote:

Why do we get this warning on Mingw?:

   x86_64-w64-mingw32-gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -g -I../../../../src/include
-I/home/pgrunner/bf/root/HEAD/pgsql.3896/../pgsql/src/include
-I../pgsql/src/include/port/win32 -DEXEC_BACKEND  -I/c/prog/mingwdep/include
"-I/home/pgrunner/bf/root/HEAD/pgsql.3896/../pgsql/src/include/port/win32"
-DBUILDING_DLL  -c -o mingwcompat.o
/home/pgrunner/bf/root/HEAD/pgsql.3896/../pgsql/src/backend/port/win32/mingwcompat.c

c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.3896/../pgsql/src/backend/port/win32/mingwcompat.c:60:1:
warning: 'RegisterWaitForSingleObject' redeclared without dllimport
attribute: previous dllimport ignored


Can we get rid of it?

I don't recall this warning specifically - I wonder if it's specific
to certain version(s) of mingw? It's in mingwcompat.c simply because
the mingw API headers were broken. That warning sounds to me like you
suddenly have RegisterWaitForSingleObject present in the system
headers - can you check that it is?

If it is in the system headers, we need some way to check when it
appeared, and then add the function only if it isn't there. Either by
autoconf, or if we can make a simple hardcoded ifdef (since the file
is only ever compiled on mingw).



In some versions of the headers it's declared unconditionally, in others 
it's declared if __WIN32_WINNT > 0x0500 which we are these days. But it 
looks like we're trying to override the builtin, not just supply a 
declaration.


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


Re: [HACKERS] longstanding mingw warning

2011-08-10 Thread Magnus Hagander
On Tue, Jul 26, 2011 at 15:20, Andrew Dunstan  wrote:
>
> Why do we get this warning on Mingw?:
>
>   x86_64-w64-mingw32-gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
> -Wdeclaration-after-statement -Wendif-labels -Wformat-security
> -fno-strict-aliasing -fwrapv -g -I../../../../src/include
> -I/home/pgrunner/bf/root/HEAD/pgsql.3896/../pgsql/src/include
> -I../pgsql/src/include/port/win32 -DEXEC_BACKEND  -I/c/prog/mingwdep/include
> "-I/home/pgrunner/bf/root/HEAD/pgsql.3896/../pgsql/src/include/port/win32"
> -DBUILDING_DLL  -c -o mingwcompat.o
> /home/pgrunner/bf/root/HEAD/pgsql.3896/../pgsql/src/backend/port/win32/mingwcompat.c
>
> c:/mingw/msys/1.0/home/pgrunner/bf/root/HEAD/pgsql.3896/../pgsql/src/backend/port/win32/mingwcompat.c:60:1:
> warning: 'RegisterWaitForSingleObject' redeclared without dllimport
> attribute: previous dllimport ignored
>
>
> Can we get rid of it?

I don't recall this warning specifically - I wonder if it's specific
to certain version(s) of mingw? It's in mingwcompat.c simply because
the mingw API headers were broken. That warning sounds to me like you
suddenly have RegisterWaitForSingleObject present in the system
headers - can you check that it is?

If it is in the system headers, we need some way to check when it
appeared, and then add the function only if it isn't there. Either by
autoconf, or if we can make a simple hardcoded ifdef (since the file
is only ever compiled on mingw).

-- 
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

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