Skip to content

Commit a4777f3

Browse files
committed
Remove symbol WIN32_ONLY_COMPILER
This used to mean "Visual C++ except in those parts where Borland C++ was supported where it meant one of those". Now that we don't support Borland C++ anymore, simplify by using _MSC_VER which is the normal way to detect Visual C++.
1 parent 6da56f3 commit a4777f3

File tree

19 files changed

+25
-29
lines changed

19 files changed

+25
-29
lines changed

src/backend/libpq/auth.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ CheckSCRAMAuth(Port *port, char *shadow_pass, char **logdetail)
958958
*/
959959
#ifdef ENABLE_GSS
960960

961-
#if defined(WIN32) && !defined(WIN32_ONLY_COMPILER)
961+
#if defined(WIN32) && !defined(_MSC_VER)
962962
/*
963963
* MIT Kerberos GSSAPI DLL doesn't properly export the symbols for MingW
964964
* that contain the OIDs required. Redefine here, values copied

src/backend/libpq/pqcomm.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
#ifdef HAVE_UTIME_H
8686
#include <utime.h>
8787
#endif
88-
#ifdef WIN32_ONLY_COMPILER /* mstcpip.h is missing on mingw */
88+
#ifdef _MSC_VER /* mstcpip.h is missing on mingw */
8989
#include <mstcpip.h>
9090
#endif
9191

src/backend/port/win32/mingwcompat.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#include "postgres.h"
1515

16-
#ifndef WIN32_ONLY_COMPILER
16+
#ifndef _MSC_VER
1717
/*
1818
* MingW defines an extern to this struct, but the actual struct isn't present
1919
* in any library. It's trivial enough that we can safely define it

src/common/exec.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#define log_error4(str, param, arg1) (fprintf(stderr, str, param, arg1), fputc('\n', stderr))
3636
#endif
3737

38-
#ifdef WIN32_ONLY_COMPILER
38+
#ifdef _MSC_VER
3939
#define getcwd(cwd,len) GetCurrentDirectory(len, cwd)
4040
#endif
4141

src/include/getaddrinfo.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#define EAI_MEMORY (-10)
4141
#define EAI_SYSTEM (-11)
4242
#else /* WIN32 */
43-
#ifdef WIN32_ONLY_COMPILER
43+
#ifdef _MSC_VER
4444
#ifndef WSA_NOT_ENOUGH_MEMORY
4545
#define WSA_NOT_ENOUGH_MEMORY (WSAENOBUFS)
4646
#endif

src/include/libpq/libpq-be.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@
3838
* that doesn't match the msvc build. It gives a bunch of compiler warnings that we ignore,
3939
* but also defines a symbol that simply does not exist. Undefine it again.
4040
*/
41-
#ifdef WIN32_ONLY_COMPILER
41+
#ifdef _MSC_VER
4242
#undef HAVE_GETADDRINFO
4343
#endif
4444
#endif /* ENABLE_GSS */
4545

4646
#ifdef ENABLE_SSPI
4747
#define SECURITY_WIN32
48-
#if defined(WIN32) && !defined(WIN32_ONLY_COMPILER)
48+
#if defined(WIN32) && !defined(_MSC_VER)
4949
#include <ntsecapi.h>
5050
#endif
5151
#include <security.h>

src/include/port.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ extern int pgrename(const char *from, const char *to);
231231
extern int pgunlink(const char *path);
232232

233233
/* Include this first so later includes don't see these defines */
234-
#ifdef WIN32_ONLY_COMPILER
234+
#ifdef _MSC_VER
235235
#include <io.h>
236236
#endif
237237

src/include/port/atomics.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
/* gcc or compatible, including clang and icc */
9797
#elif defined(__GNUC__) || defined(__INTEL_COMPILER)
9898
#include "port/atomics/generic-gcc.h"
99-
#elif defined(WIN32_ONLY_COMPILER)
99+
#elif defined(_MSC_VER)
100100
#include "port/atomics/generic-msvc.h"
101101
#elif defined(__hpux) && defined(__ia64) && !defined(__GNUC__)
102102
#include "port/atomics/generic-acc.h"

src/include/port/atomics/arch-x86.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ pg_spin_delay_impl(void)
113113
{
114114
__asm__ __volatile__(" rep; nop \n");
115115
}
116-
#elif defined(WIN32_ONLY_COMPILER) && defined(__x86_64__)
116+
#elif defined(_MSC_VER) && defined(__x86_64__)
117117
#define PG_HAVE_SPIN_DELAY
118118
static __forceinline void
119119
pg_spin_delay_impl(void)
120120
{
121121
_mm_pause();
122122
}
123-
#elif defined(WIN32_ONLY_COMPILER)
123+
#elif defined(_MSC_VER)
124124
#define PG_HAVE_SPIN_DELAY
125125
static __forceinline void
126126
pg_spin_delay_impl(void)

src/include/port/win32.h

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
/* src/include/port/win32.h */
22

3-
#if defined(_MSC_VER)
4-
#define WIN32_ONLY_COMPILER
5-
#endif
6-
73
/*
84
* Make sure _WIN32_WINNT has the minimum required value.
95
* Leave a higher value in place. When building with at least Visual
@@ -43,7 +39,7 @@
4339
* The Mingw64 headers choke if this is already defined - they
4440
* define it themselves.
4541
*/
46-
#if !defined(__MINGW64_VERSION_MAJOR) || defined(WIN32_ONLY_COMPILER)
42+
#if !defined(__MINGW64_VERSION_MAJOR) || defined(_MSC_VER)
4743
#define _WINSOCKAPI_
4844
#endif
4945
#include <winsock2.h>
@@ -233,7 +229,7 @@ int setitimer(int which, const struct itimerval * value, struct itimerval * ov
233229
* with 64-bit offsets.
234230
*/
235231
#define pgoff_t __int64
236-
#ifdef WIN32_ONLY_COMPILER
232+
#ifdef _MSC_VER
237233
#define fseeko(stream, offset, origin) _fseeki64(stream, offset, origin)
238234
#define ftello(stream) _ftelli64(stream)
239235
#else
@@ -256,7 +252,7 @@ typedef int gid_t;
256252
#endif
257253
typedef long key_t;
258254

259-
#ifdef WIN32_ONLY_COMPILER
255+
#ifdef _MSC_VER
260256
typedef int pid_t;
261257
#endif
262258

@@ -416,7 +412,7 @@ extern int pgwin32_is_admin(void);
416412
#define unsetenv(x) pgwin32_unsetenv(x)
417413

418414
/* Things that exist in MingW headers, but need to be added to MSVC */
419-
#ifdef WIN32_ONLY_COMPILER
415+
#ifdef _MSC_VER
420416

421417
#ifndef _WIN64
422418
typedef long ssize_t;
@@ -446,7 +442,7 @@ typedef unsigned short mode_t;
446442
/* Pulled from Makefile.port in mingw */
447443
#define DLSUFFIX ".dll"
448444

449-
#endif /* WIN32_ONLY_COMPILER */
445+
#endif /* _MSC_VER */
450446

451447
/* These aren't provided by either MingW or MSVC */
452448
#define S_IRGRP 0

src/include/storage/s_lock.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ extern slock_t pg_atomic_cas(volatile slock_t *lock, slock_t with,
833833
#endif
834834

835835

836-
#ifdef WIN32_ONLY_COMPILER
836+
#ifdef _MSC_VER
837837
typedef LONG slock_t;
838838

839839
#define HAS_TEST_AND_SET

src/interfaces/ecpg/test/expected/thread-thread.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ void *test_thread(void *arg)
152152

153153

154154
/* build up connection name, and connect to database */
155-
#ifndef WIN32_ONLY_COMPILER
155+
#ifndef _MSC_VER
156156
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
157157
#else
158158
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);

src/interfaces/ecpg/test/expected/thread-thread_implicit.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ void *test_thread(void *arg)
153153

154154

155155
/* build up connection name, and connect to database */
156-
#ifndef WIN32_ONLY_COMPILER
156+
#ifndef _MSC_VER
157157
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
158158
#else
159159
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);

src/interfaces/ecpg/test/thread/thread.pgc

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void *test_thread(void *arg)
103103
EXEC SQL END DECLARE SECTION;
104104

105105
/* build up connection name, and connect to database */
106-
#ifndef WIN32_ONLY_COMPILER
106+
#ifndef _MSC_VER
107107
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
108108
#else
109109
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);

src/interfaces/ecpg/test/thread/thread_implicit.pgc

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void *test_thread(void *arg)
104104
EXEC SQL END DECLARE SECTION;
105105

106106
/* build up connection name, and connect to database */
107-
#ifndef WIN32_ONLY_COMPILER
107+
#ifndef _MSC_VER
108108
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
109109
#else
110110
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);

src/interfaces/libpq/fe-auth.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
* GSSAPI authentication system.
5050
*/
5151

52-
#if defined(WIN32) && !defined(WIN32_ONLY_COMPILER)
52+
#if defined(WIN32) && !defined(_MSC_VER)
5353
/*
5454
* MIT Kerberos GSSAPI DLL doesn't properly export the symbols for MingW
5555
* that contain the OIDs required. Redefine here, values copied

src/interfaces/libpq/fe-connect.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#endif
3838
#define near
3939
#include <shlobj.h>
40-
#ifdef WIN32_ONLY_COMPILER /* mstcpip.h is missing on mingw */
40+
#ifdef _MSC_VER /* mstcpip.h is missing on mingw */
4141
#include <mstcpip.h>
4242
#endif
4343
#else

src/interfaces/libpq/libpq-int.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
#ifdef ENABLE_SSPI
5555
#define SECURITY_WIN32
56-
#if defined(WIN32) && !defined(WIN32_ONLY_COMPILER)
56+
#if defined(WIN32) && !defined(_MSC_VER)
5757
#include <ntsecapi.h>
5858
#endif
5959
#include <security.h>

src/tools/msvc/ecpg_regression.proj

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
<!-- Run ECPG and the Visual C++ compiler on the files. Don't bother with dependency check between the steps -->
5353
<Exec WorkingDirectory="%(Pgc.RelativeDir)" Command="$(OUTDIR)ecpg\ecpg -I ../../include --regression $(ECPGPARAM) -o %(Pgc.Filename).c %(Pgc.Filename).pgc" />
54-
<Exec WorkingDirectorY="%(Pgc.RelativeDir)" Command="cl /nologo %(Pgc.FileName).c /TC /MD$(DEBUGLIB) /DENABLE_THREAD_SAFETY /DWIN32 /DWIN32_ONLY_COMPILER /I. /I..\..\include /I..\..\..\libpq /I..\..\..\..\include /link /defaultlib:$(OUTDIR)libecpg\libecpg.lib /defaultlib:$(OUTDIR)libecpg_compat\libecpg_compat.lib /defaultlib:$(OUTDIR)libpgtypes\libpgtypes.lib" />
54+
<Exec WorkingDirectorY="%(Pgc.RelativeDir)" Command="cl /nologo %(Pgc.FileName).c /TC /MD$(DEBUGLIB) /DENABLE_THREAD_SAFETY /DWIN32 /D_MSC_VER /I. /I..\..\include /I..\..\..\libpq /I..\..\..\..\include /link /defaultlib:$(OUTDIR)libecpg\libecpg.lib /defaultlib:$(OUTDIR)libecpg_compat\libecpg_compat.lib /defaultlib:$(OUTDIR)libpgtypes\libpgtypes.lib" />
5555
</Target>
5656

5757
<!-- Clean up all output files -->

0 commit comments

Comments
 (0)