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

NISHIYAMA Tomoaki <tomoakin@staff.kanazawa-u.ac.jp>

From: NISHIYAMA Tomoaki <tomoakin@staff.kanazawa-u.ac.jp>
To: pgsql-hackers@postgresql.org
Cc: NISHIYAMA Tomoaki <tomoakin@staff.kanazawa-u.ac.jp>, Andrew Dunstan <andrew@dunslane.net>
Date: 2011-12-03T08:24:44Z
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

Hi,

A new patch:
check for the presence of crtdefs.h in configure

-#if _MSC_VER >= 1400 || defined(WIN64)
+#if _MSC_VER >= 1400 || HAVE_CRTDEFS_H
 #define errcode __msvc_errcode
 #include <crtdefs.h>
 #undef errcode

Perhaps there is no guarantee that mingw (not -w64) may not have crtdefs.h in the future versions.
the 3 lines
 #define errcode __msvc_errcode
 #include <crtdefs.h>
 #undef errcode
should be valid as far as crtdefs.h exists and errcode is not defined previously.
Because this is the first system include file, we can be sure errcode is not 
defined by this point.
So, I believe its better to just test for the presence of crtdefs.h rather than
try to figure out the name of compiler.

check for fseeko and ftello macro definition before defining to avoid
warning in mingw-w64 4.7.0 20110827

This patch was tested to build successfully on
mingw gcc version 4.6.1
mingw-w64 i686-w64-mingw32 gcc version 4.5.4 20110812
mingw-w64 x86_64-w64-mingw32 gcc version 4.7.0 20110827