Thanks to visit codestin.com
Credit goes to github.com

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 5 additions & 9 deletions
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

0 commit comments

Comments
 (0)