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

From: Lars Kanis <kanis(at)comcard(dot)de>
To: NISHIYAMA Tomoaki <tomoakin(at)staff(dot)kanazawa-u(dot)ac(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] PostgreSQL fails to build with 32bit MinGW-w64
Date: 2011-11-24 11:29:30
Message-ID: 3782366.IDImt4Siyk@c1170lx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> 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

Attachment Content-Type Size
fix-mingw-w64-32bit_v2.patch text/x-patch 2.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Shulgin 2011-11-24 11:32:17 Re: Making TEXT NUL-transparent
Previous Message Florian Weimer 2011-11-24 10:59:09 Re: Making TEXT NUL-transparent