Skip to content

Commit 399a36a

Browse files
committed
Prepare code to be built by MSVC:
o remove many WIN32_CLIENT_ONLY defines o add WIN32_ONLY_COMPILER define o add 3rd argument to open() for portability o add include/port/win32_msvc directory for system includes Magnus Hagander
1 parent 877e296 commit 399a36a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1151
-217
lines changed

configure

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15064,6 +15064,14 @@ case $LIBOBJS in
1506415064
*) LIBOBJS="$LIBOBJS rand.$ac_objext" ;;
1506515065
esac
1506615066

15067+
case $LIBOBJS in
15068+
"win32error.$ac_objext" | \
15069+
*" win32error.$ac_objext" | \
15070+
"win32error.$ac_objext "* | \
15071+
*" win32error.$ac_objext "* ) ;;
15072+
*) LIBOBJS="$LIBOBJS win32error.$ac_objext" ;;
15073+
esac
15074+
1506715075

1506815076
cat >>confdefs.h <<\_ACEOF
1506915077
#define HAVE_SYMLINK 1

configure.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.465 2006/05/30 13:52:24 momjian Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.466 2006/06/07 22:24:43 momjian Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -994,6 +994,7 @@ AC_LIBOBJ(gettimeofday)
994994
AC_LIBOBJ(kill)
995995
AC_LIBOBJ(open)
996996
AC_LIBOBJ(rand)
997+
AC_LIBOBJ(win32error)
997998
AC_DEFINE([HAVE_SYMLINK], 1,
998999
[Define to 1 if you have the `symlink' function.])
9991000
fi

src/backend/libpq/ip.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.34 2006/03/05 15:58:27 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.35 2006/06/07 22:24:43 momjian Exp $
1212
*
1313
* This file and the IPV6 implementation were initially provided by
1414
* Nigel Kukard <nkukard@lbsd.net>, Linux Based Systems Design
@@ -20,7 +20,6 @@
2020
/* This is intended to be used in both frontend and backend, so use c.h */
2121
#include "c.h"
2222

23-
#ifndef WIN32_CLIENT_ONLY
2423
#include <errno.h>
2524
#include <unistd.h>
2625
#include <sys/types.h>
@@ -33,7 +32,6 @@
3332
#endif
3433
#include <arpa/inet.h>
3534
#include <sys/file.h>
36-
#endif
3735

3836
#include "libpq/ip.h"
3937

src/backend/port/dynloader/win32.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
/* $PostgreSQL: pgsql/src/backend/port/dynloader/win32.c,v 1.7 2005/10/15 02:49:23 momjian Exp $ */
1+
/* $PostgreSQL: pgsql/src/backend/port/dynloader/win32.c,v 1.8 2006/06/07 22:24:43 momjian Exp $ */
22

3-
#include <windows.h>
4-
#include <stdio.h>
3+
#include "postgres.h"
54

65
char *dlerror(void);
76
int dlclose(void *handle);

src/backend/port/win32/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
# Makefile for backend/port/win32
55
#
66
# IDENTIFICATION
7-
# $PostgreSQL: pgsql/src/backend/port/win32/Makefile,v 1.7 2006/04/29 20:52:56 tgl Exp $
7+
# $PostgreSQL: pgsql/src/backend/port/win32/Makefile,v 1.8 2006/06/07 22:24:43 momjian Exp $
88
#
99
#-------------------------------------------------------------------------
1010

1111
subdir = src/backend/port/win32
1212
top_builddir = ../../../..
1313
include $(top_builddir)/src/Makefile.global
1414

15-
OBJS = shmem.o timer.o socket.o signal.o security.o error.o
15+
OBJS = shmem.o timer.o socket.o signal.o security.o
1616

1717
all: SUBSYS.o
1818

src/backend/postmaster/postmaster.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
*
3838
*
3939
* IDENTIFICATION
40-
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.484 2006/05/19 15:15:37 alvherre Exp $
40+
* $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.485 2006/06/07 22:24:44 momjian Exp $
4141
*
4242
* NOTES
4343
*
@@ -1121,7 +1121,7 @@ pmdaemonize(void)
11211121
ExitPostmaster(1);
11221122
}
11231123
#endif
1124-
i = open(NULL_DEV, O_RDWR);
1124+
i = open(NULL_DEV, O_RDWR, 0);
11251125
dup2(i, 0);
11261126
dup2(i, 1);
11271127
dup2(i, 2);

src/backend/postmaster/syslogger.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
*
2020
* IDENTIFICATION
21-
* $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.23 2006/03/05 15:58:36 momjian Exp $
21+
* $PostgreSQL: pgsql/src/backend/postmaster/syslogger.c,v 1.24 2006/06/07 22:24:44 momjian Exp $
2222
*
2323
*-------------------------------------------------------------------------
2424
*/
@@ -153,7 +153,7 @@ SysLoggerMain(int argc, char *argv[])
153153
*/
154154
if (redirection_done)
155155
{
156-
int fd = open(NULL_DEV, O_WRONLY);
156+
int fd = open(NULL_DEV, O_WRONLY, 0);
157157

158158
/*
159159
* The closes might look redundant, but they are not: we want to be

src/backend/utils/adt/float.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.124 2006/04/24 20:36:32 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/float.c,v 1.125 2006/06/07 22:24:44 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -80,6 +80,14 @@
8080
#define HAVE_FINITE 1
8181
#endif
8282

83+
/* Visual C++ etc lacks NAN, and won't accept 0.0/0.0. NAN definition from
84+
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/vclrfNotNumberNANItems.asp
85+
*/
86+
#if defined(WIN32) && !defined(NAN)
87+
static const uint32 nan[2] = {0xffffffff, 0x7fffffff};
88+
#define NAN (*(const double *) nan)
89+
#endif
90+
8391
/* not sure what the following should be, but better to make it over-sufficient */
8492
#define MAXFLOATWIDTH 64
8593
#define MAXDOUBLEWIDTH 128

src/backend/utils/fmgr/dfmgr.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.85 2006/05/31 20:58:09 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.86 2006/06/07 22:24:44 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
1515
#include "postgres.h"
1616

1717
#include <sys/stat.h>
1818

19+
#ifndef WIN32_ONLY_COMPILER
1920
#include "dynloader.h"
21+
#else
22+
#include "port/dynloader/win32.h"
23+
#endif
2024
#include "miscadmin.h"
2125
#include "utils/dynamic_loader.h"
2226

src/backend/utils/mb/encnames.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Encoding names and routines for work with it. All
33
* in this file is shared bedween FE and BE.
44
*
5-
* $PostgreSQL: pgsql/src/backend/utils/mb/encnames.c,v 1.29 2006/02/18 16:15:22 petere Exp $
5+
* $PostgreSQL: pgsql/src/backend/utils/mb/encnames.c,v 1.30 2006/06/07 22:24:44 momjian Exp $
66
*/
77
#ifdef FRONTEND
88
#include "postgres_fe.h"
@@ -13,9 +13,7 @@
1313
#include "utils/builtins.h"
1414
#endif
1515

16-
#ifndef WIN32_CLIENT_ONLY
1716
#include <unistd.h>
18-
#endif
1917

2018
#include "mb/pg_wchar.h"
2119
#include <ctype.h>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy