Re: msys inet_pton strangeness - Mailing list pgsql-hackers

From Alexander Lakhin
Subject Re: msys inet_pton strangeness
Date
Msg-id ab4eed8b-fb56-01d0-ef79-9c34e5fc03eb@gmail.com
Whole thread Raw
In response to Re: msys inet_pton strangeness  (Thomas Munro <thomas.munro@gmail.com>)
Responses Re: msys inet_pton strangeness
List pgsql-hackers
Hello Thomas and Andrew,

28.09.2024 23:52, Thomas Munro wrote:
> On Sun, Sep 29, 2024 at 6:26 AM Andrew Dunstan <andrew@dunslane.net> wrote:
>> We should have included ws2tcpip.h, which includes this:
>>
>> #define InetPtonA inet_pton
>> WINSOCK_API_LINKAGE INT WSAAPI InetPtonA(INT Family, LPCSTR pStringBuf, PVOID pAddr);
>>
>> It's conditioned on (_WIN32_WINNT >= 0x0600), but that should be true.
> Can you print out the value to be sure?  I can't imagine they'd set it
> lower themselves or make it go backwards in an upgrade, but perhaps
> it's somehow not being set at all, and then we do:
>
> #if defined(_MSC_VER) && _MSC_VER >= 1900
> #define MIN_WINNT 0x0600
> #else
> #define MIN_WINNT 0x0501
> #endif
>
> In 16 we don't do that anymore, we just always set it to 0x0A00
> (commit 495ed0ef2d72).  And before 15, we didn't want that function
> yet (commit c1932e542863).

FWIW, I'm observing the same here.
For a trivial test.c (compiled with the same command line as
fe-secure-common.c) like:
"===_WIN32"
_WIN32;
"===_WIN32_WINNT";
_WIN32_WINNT;

with gcc -E (from mingw-w64-ucrt-x86_64-gcc 14.2.0-1), I get:
"===_WIN32"
1;
"===_WIN32_WINNT";
_WIN32_WINNT;

That is, _WIN32_WINNT is not defined, but with #include <windows.h> above,
I see:
"===_WIN32_WINNT";
0x603

With #include "postgres_fe.h" (as in fe-secure-common.c) I get:
"===_WIN32_WINNT";
0x0501;

Best regards,
Alexander



pgsql-hackers by date:

Previous
From: Yugo Nagata
Date:
Subject: Re: Add has_large_object_privilege function
Next
From: vignesh C
Date:
Subject: Re: Logical Replication of sequences