[PATCH] Borland C Compiler compatibility issues

Started by Pavel Golubover 16 years ago3 messages
#1Pavel Golub
pavel@microolap.com
1 attachment(s)

Here the patch to /src/include/pg_config_os.h attached improving
Borland C++ Compiler compatibility.

Issues described here:
http://pgolub.wordpress.com/2009/04/13/building-postgresql-client-library-using-borland-c-compiler-bcc-under-winxp/

This patch defines missing constants needed by /port/dirent.c and /port/open.c

--
Nullus est in vitae sensus ipsa vera est sensus.

Attachments:

pg_config_os.patchapplication/octet-stream; name=pg_config_os.patchDownload
--- E:\pgsql\src\include\pg_config_os.h	Wed Jan 21 09:30:02 2009 UTC
+++ E:\pgsql\src\include\pg_config_os.h	Sat Apr 18 08:18:08 2009 UTC
@@ -297,7 +297,7 @@
 #define putenv(x) pgwin32_putenv(x)
 #define unsetenv(x) pgwin32_unsetenv(x)
 
-/* Things that exist in MingW headers, but need to be added to MSVC */
+/* Things that exist in MingW headers, but need to be added to MSVC & BCC*/
 #ifdef WIN32_ONLY_COMPILER
 typedef long ssize_t;
 #ifndef __BORLANDC__
@@ -335,4 +335,22 @@
 /* Pulled from Makefile.port in mingw */
 #define DLSUFFIX ".dll"
 
+#ifdef __BORLANDC__
+
+/* in /port/dirent.c */
+#if !defined (INVALID_FILE_ATTRIBUTES)
+#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
+#endif
+
+/* in /port/open.c */
+#ifndef O_RANDOM
+#define O_RANDOM                0x0010  // File access is primarily random
+#define O_SEQUENTIAL            0x0020  // File access is primarily sequential
+#define O_TEMPORARY             0x0040  // Temporary file bit
+#define O_SHORT_LIVED           0x1000  // Temporary storage file, try not to flush
+#define _O_SHORT_LIVED          O_SHORT_LIVED
+#endif
+
+#endif
+
 #endif
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Pavel Golub (#1)
Re: [PATCH] Borland C Compiler compatibility issues

Pavel Golub <pavel@microolap.com> writes:

Here the patch to /src/include/pg_config_os.h attached improving
Borland C++ Compiler compatibility.

Applied along with your other two patches. Please note in future that
pg_config_os.h is a derived file --- this patch should have been against
src/include/port/win32.h.

regards, tom lane

#3Pavel Golub
pavel@microolap.com
In reply to: Tom Lane (#2)
Re: [PATCH] Borland C Compiler compatibility issues

On Mon, Apr 20, 2009 at 1:38 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

Pavel Golub <pavel@microolap.com> writes:

Here the patch to /src/include/pg_config_os.h attached improving
Borland C++ Compiler compatibility.

Applied along with your other two patches.  Please note in future that
pg_config_os.h is a derived file --- this patch should have been against
src/include/port/win32.h.

                       regards, tom lane

Oops. My bad. Thanks.

--
Nullus est in vitae sensus ipsa vera est sensus.