Re: [PATCH] PostgreSQL fails to build with 32bit MinGW-w64

Lars Kanis <kanis@comcard.de>

From: Lars Kanis <kanis@comcard.de>
To: NISHIYAMA Tomoaki <tomoakin@staff.kanazawa-u.ac.jp>
Cc: pgsql-hackers@postgresql.org
Date: 2011-11-24T11:29:30Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Remove troublesome Asserts in cost_mergejoin().

  2. Enable building with the Mingw64 compiler.

Attachments

> Isn't it better to check the value of macros itsef rather than checking for
> system dependent macros that does not directly relate to the issue?
> specifically for getaddrinfo.c case I think
> #if EAI_NODATA != EAI_NONAME
> is a better check than checking for
> #if !defined(__MINGW64_VERSION_MAJOR) && !defined(WIN32_ONLY_COMPILER)	/* MSVC/WIN64 duplicate */
Yes it's better and it works for all described test environments.

> For the win32.h, I really don't understand why _WINSOCKAPI_ was defined before
> <winsock2.h>
> some google suggests that defining _WINSOCKAPI_ before <windows.h> prevents
> inclusion of winsock.h but that does not have relation to inclusion of
> <winsock2.h> and if <winsock2.h> is included first, it should be ok.
> 
> If this guess is right, perhaps it could be better to remove the three lines.
> #if !defined(WIN64) || defined(WIN32_ONLY_COMPILER)
> #define _WINSOCKAPI_
> #endif
I only changed this for consistency. For me, it works without that define in all test
environments, too.

> +/* __MINGW64_VERSION_MAJOR is related to both 32/64 bit gcc compiles by
> + * mingw-w64, however it gots defined only after
> Why not use __MINGW32__, which is defined without including any headers?

At least in mingw32 v4.4.4 there is no crtdefs.h. I couldn't find a proper define that relates directly
to that issue, so attached is a somewhat cumbersome MINGW version check.

--
Regards,
Lars Kanis