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++.
This commit is contained in:
Magnus Hagander 2017-04-11 15:21:25 +02:00
parent 6da56f3f84
commit a4777f3556
19 changed files with 25 additions and 29 deletions

View File

@ -958,7 +958,7 @@ CheckSCRAMAuth(Port *port, char *shadow_pass, char **logdetail)
*/ */
#ifdef ENABLE_GSS #ifdef ENABLE_GSS
#if defined(WIN32) && !defined(WIN32_ONLY_COMPILER) #if defined(WIN32) && !defined(_MSC_VER)
/* /*
* MIT Kerberos GSSAPI DLL doesn't properly export the symbols for MingW * MIT Kerberos GSSAPI DLL doesn't properly export the symbols for MingW
* that contain the OIDs required. Redefine here, values copied * that contain the OIDs required. Redefine here, values copied

View File

@ -85,7 +85,7 @@
#ifdef HAVE_UTIME_H #ifdef HAVE_UTIME_H
#include <utime.h> #include <utime.h>
#endif #endif
#ifdef WIN32_ONLY_COMPILER /* mstcpip.h is missing on mingw */ #ifdef _MSC_VER /* mstcpip.h is missing on mingw */
#include <mstcpip.h> #include <mstcpip.h>
#endif #endif

View File

@ -13,7 +13,7 @@
#include "postgres.h" #include "postgres.h"
#ifndef WIN32_ONLY_COMPILER #ifndef _MSC_VER
/* /*
* MingW defines an extern to this struct, but the actual struct isn't present * MingW defines an extern to this struct, but the actual struct isn't present
* in any library. It's trivial enough that we can safely define it * in any library. It's trivial enough that we can safely define it

View File

@ -35,7 +35,7 @@
#define log_error4(str, param, arg1) (fprintf(stderr, str, param, arg1), fputc('\n', stderr)) #define log_error4(str, param, arg1) (fprintf(stderr, str, param, arg1), fputc('\n', stderr))
#endif #endif
#ifdef WIN32_ONLY_COMPILER #ifdef _MSC_VER
#define getcwd(cwd,len) GetCurrentDirectory(len, cwd) #define getcwd(cwd,len) GetCurrentDirectory(len, cwd)
#endif #endif

View File

@ -40,7 +40,7 @@
#define EAI_MEMORY (-10) #define EAI_MEMORY (-10)
#define EAI_SYSTEM (-11) #define EAI_SYSTEM (-11)
#else /* WIN32 */ #else /* WIN32 */
#ifdef WIN32_ONLY_COMPILER #ifdef _MSC_VER
#ifndef WSA_NOT_ENOUGH_MEMORY #ifndef WSA_NOT_ENOUGH_MEMORY
#define WSA_NOT_ENOUGH_MEMORY (WSAENOBUFS) #define WSA_NOT_ENOUGH_MEMORY (WSAENOBUFS)
#endif #endif

View File

@ -38,14 +38,14 @@
* that doesn't match the msvc build. It gives a bunch of compiler warnings that we ignore, * that doesn't match the msvc build. It gives a bunch of compiler warnings that we ignore,
* but also defines a symbol that simply does not exist. Undefine it again. * but also defines a symbol that simply does not exist. Undefine it again.
*/ */
#ifdef WIN32_ONLY_COMPILER #ifdef _MSC_VER
#undef HAVE_GETADDRINFO #undef HAVE_GETADDRINFO
#endif #endif
#endif /* ENABLE_GSS */ #endif /* ENABLE_GSS */
#ifdef ENABLE_SSPI #ifdef ENABLE_SSPI
#define SECURITY_WIN32 #define SECURITY_WIN32
#if defined(WIN32) && !defined(WIN32_ONLY_COMPILER) #if defined(WIN32) && !defined(_MSC_VER)
#include <ntsecapi.h> #include <ntsecapi.h>
#endif #endif
#include <security.h> #include <security.h>

View File

@ -231,7 +231,7 @@ extern int pgrename(const char *from, const char *to);
extern int pgunlink(const char *path); extern int pgunlink(const char *path);
/* Include this first so later includes don't see these defines */ /* Include this first so later includes don't see these defines */
#ifdef WIN32_ONLY_COMPILER #ifdef _MSC_VER
#include <io.h> #include <io.h>
#endif #endif

View File

@ -96,7 +96,7 @@
/* gcc or compatible, including clang and icc */ /* gcc or compatible, including clang and icc */
#elif defined(__GNUC__) || defined(__INTEL_COMPILER) #elif defined(__GNUC__) || defined(__INTEL_COMPILER)
#include "port/atomics/generic-gcc.h" #include "port/atomics/generic-gcc.h"
#elif defined(WIN32_ONLY_COMPILER) #elif defined(_MSC_VER)
#include "port/atomics/generic-msvc.h" #include "port/atomics/generic-msvc.h"
#elif defined(__hpux) && defined(__ia64) && !defined(__GNUC__) #elif defined(__hpux) && defined(__ia64) && !defined(__GNUC__)
#include "port/atomics/generic-acc.h" #include "port/atomics/generic-acc.h"

View File

@ -113,14 +113,14 @@ pg_spin_delay_impl(void)
{ {
__asm__ __volatile__(" rep; nop \n"); __asm__ __volatile__(" rep; nop \n");
} }
#elif defined(WIN32_ONLY_COMPILER) && defined(__x86_64__) #elif defined(_MSC_VER) && defined(__x86_64__)
#define PG_HAVE_SPIN_DELAY #define PG_HAVE_SPIN_DELAY
static __forceinline void static __forceinline void
pg_spin_delay_impl(void) pg_spin_delay_impl(void)
{ {
_mm_pause(); _mm_pause();
} }
#elif defined(WIN32_ONLY_COMPILER) #elif defined(_MSC_VER)
#define PG_HAVE_SPIN_DELAY #define PG_HAVE_SPIN_DELAY
static __forceinline void static __forceinline void
pg_spin_delay_impl(void) pg_spin_delay_impl(void)

View File

@ -1,9 +1,5 @@
/* src/include/port/win32.h */ /* src/include/port/win32.h */
#if defined(_MSC_VER)
#define WIN32_ONLY_COMPILER
#endif
/* /*
* Make sure _WIN32_WINNT has the minimum required value. * Make sure _WIN32_WINNT has the minimum required value.
* Leave a higher value in place. When building with at least Visual * Leave a higher value in place. When building with at least Visual
@ -43,7 +39,7 @@
* The Mingw64 headers choke if this is already defined - they * The Mingw64 headers choke if this is already defined - they
* define it themselves. * define it themselves.
*/ */
#if !defined(__MINGW64_VERSION_MAJOR) || defined(WIN32_ONLY_COMPILER) #if !defined(__MINGW64_VERSION_MAJOR) || defined(_MSC_VER)
#define _WINSOCKAPI_ #define _WINSOCKAPI_
#endif #endif
#include <winsock2.h> #include <winsock2.h>
@ -233,7 +229,7 @@ int setitimer(int which, const struct itimerval * value, struct itimerval * ov
* with 64-bit offsets. * with 64-bit offsets.
*/ */
#define pgoff_t __int64 #define pgoff_t __int64
#ifdef WIN32_ONLY_COMPILER #ifdef _MSC_VER
#define fseeko(stream, offset, origin) _fseeki64(stream, offset, origin) #define fseeko(stream, offset, origin) _fseeki64(stream, offset, origin)
#define ftello(stream) _ftelli64(stream) #define ftello(stream) _ftelli64(stream)
#else #else
@ -256,7 +252,7 @@ typedef int gid_t;
#endif #endif
typedef long key_t; typedef long key_t;
#ifdef WIN32_ONLY_COMPILER #ifdef _MSC_VER
typedef int pid_t; typedef int pid_t;
#endif #endif
@ -416,7 +412,7 @@ extern int pgwin32_is_admin(void);
#define unsetenv(x) pgwin32_unsetenv(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 */
#ifdef WIN32_ONLY_COMPILER #ifdef _MSC_VER
#ifndef _WIN64 #ifndef _WIN64
typedef long ssize_t; typedef long ssize_t;
@ -446,7 +442,7 @@ typedef unsigned short mode_t;
/* Pulled from Makefile.port in mingw */ /* Pulled from Makefile.port in mingw */
#define DLSUFFIX ".dll" #define DLSUFFIX ".dll"
#endif /* WIN32_ONLY_COMPILER */ #endif /* _MSC_VER */
/* These aren't provided by either MingW or MSVC */ /* These aren't provided by either MingW or MSVC */
#define S_IRGRP 0 #define S_IRGRP 0

View File

@ -833,7 +833,7 @@ extern slock_t pg_atomic_cas(volatile slock_t *lock, slock_t with,
#endif #endif
#ifdef WIN32_ONLY_COMPILER #ifdef _MSC_VER
typedef LONG slock_t; typedef LONG slock_t;
#define HAS_TEST_AND_SET #define HAS_TEST_AND_SET

View File

@ -152,7 +152,7 @@ void *test_thread(void *arg)
/* build up connection name, and connect to database */ /* build up connection name, and connect to database */
#ifndef WIN32_ONLY_COMPILER #ifndef _MSC_VER
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum); snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
#else #else
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum); _snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);

View File

@ -153,7 +153,7 @@ void *test_thread(void *arg)
/* build up connection name, and connect to database */ /* build up connection name, and connect to database */
#ifndef WIN32_ONLY_COMPILER #ifndef _MSC_VER
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum); snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
#else #else
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum); _snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);

View File

@ -103,7 +103,7 @@ void *test_thread(void *arg)
EXEC SQL END DECLARE SECTION; EXEC SQL END DECLARE SECTION;
/* build up connection name, and connect to database */ /* build up connection name, and connect to database */
#ifndef WIN32_ONLY_COMPILER #ifndef _MSC_VER
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum); snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
#else #else
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum); _snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);

View File

@ -104,7 +104,7 @@ void *test_thread(void *arg)
EXEC SQL END DECLARE SECTION; EXEC SQL END DECLARE SECTION;
/* build up connection name, and connect to database */ /* build up connection name, and connect to database */
#ifndef WIN32_ONLY_COMPILER #ifndef _MSC_VER
snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum); snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);
#else #else
_snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum); _snprintf(l_connection, sizeof(l_connection), "thread_%03ld", threadnum);

View File

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

View File

@ -37,7 +37,7 @@
#endif #endif
#define near #define near
#include <shlobj.h> #include <shlobj.h>
#ifdef WIN32_ONLY_COMPILER /* mstcpip.h is missing on mingw */ #ifdef _MSC_VER /* mstcpip.h is missing on mingw */
#include <mstcpip.h> #include <mstcpip.h>
#endif #endif
#else #else

View File

@ -53,7 +53,7 @@
#ifdef ENABLE_SSPI #ifdef ENABLE_SSPI
#define SECURITY_WIN32 #define SECURITY_WIN32
#if defined(WIN32) && !defined(WIN32_ONLY_COMPILER) #if defined(WIN32) && !defined(_MSC_VER)
#include <ntsecapi.h> #include <ntsecapi.h>
#endif #endif
#include <security.h> #include <security.h>

View File

@ -51,7 +51,7 @@
<!-- Run ECPG and the Visual C++ compiler on the files. Don't bother with dependency check between the steps --> <!-- Run ECPG and the Visual C++ compiler on the files. Don't bother with dependency check between the steps -->
<Exec WorkingDirectory="%(Pgc.RelativeDir)" Command="$(OUTDIR)ecpg\ecpg -I ../../include --regression $(ECPGPARAM) -o %(Pgc.Filename).c %(Pgc.Filename).pgc" /> <Exec WorkingDirectory="%(Pgc.RelativeDir)" Command="$(OUTDIR)ecpg\ecpg -I ../../include --regression $(ECPGPARAM) -o %(Pgc.Filename).c %(Pgc.Filename).pgc" />
<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" /> <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" />
</Target> </Target>
<!-- Clean up all output files --> <!-- Clean up all output files -->