summaryrefslogtreecommitdiffstats
path: root/src/vim.h
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-02-17 17:44:42 +0100
committerBram Moolenaar <Bram@vim.org>2019-02-17 17:44:42 +0100
commit4f97475d326c2773a78561fb874e4f23c25cbcd9 (patch)
tree7e066bc70556dfbb415ddb9f364e8432e8aaf189 /src/vim.h
parent78d21dae9c3a39efb30316d3e38dce120bc1abbd (diff)
patch 8.1.0941: macros for MS-Windows are inconsistentv8.1.0941
Problem: Macros for MS-Windows are inconsistent, using "32", "3264 and others. Solution: Use MSWIN for all MS-Windows builds. Use FEAT_GUI_MSWIN for the GUI build. (Hirohito Higashi, closes #3932)
Diffstat (limited to 'src/vim.h')
-rw-r--r--src/vim.h55
1 files changed, 26 insertions, 29 deletions
diff --git a/src/vim.h b/src/vim.h
index be1ec1d317..3f7388e614 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -11,8 +11,17 @@
#include "protodef.h"
-/* use fastcall for Borland, when compiling for Win32 */
-#if defined(__BORLANDC__) && defined(WIN32) && !defined(DEBUG)
+// _WIN32 is defined as 1 when the compilation target is 32-bit or 64-bit.
+// Note: If you want to check for 64-bit use the _WIN64 macro.
+#if defined(WIN32) || defined(_WIN32)
+# define MSWIN
+# ifdef FEAT_GUI
+# define FEAT_GUI_MSWIN
+# endif
+#endif
+
+// use fastcall for Borland, when compiling for MS-Windows
+#if defined(__BORLANDC__) && defined(MSWIN) && !defined(DEBUG)
#if defined(FEAT_PERL) || \
defined(FEAT_PYTHON) || \
defined(FEAT_PYTHON3) || \
@@ -29,7 +38,7 @@
# endif
#endif
-#if defined(WIN32) || defined(_WIN64)
+#ifdef MSWIN
# include "vimio.h"
#endif
@@ -103,7 +112,7 @@
|| defined(FEAT_GUI_GTK) \
|| defined(FEAT_GUI_ATHENA) \
|| defined(FEAT_GUI_MAC) \
- || defined(FEAT_GUI_W32) \
+ || defined(FEAT_GUI_MSWIN) \
|| defined(FEAT_GUI_PHOTON)
# define FEAT_GUI_ENABLED /* also defined with NO_X11_INCLUDES */
# if !defined(FEAT_GUI) && !defined(NO_X11_INCLUDES)
@@ -124,22 +133,11 @@
# define _CRT_NONSTDC_NO_DEPRECATE
#endif
-#if defined(FEAT_GUI_W32)
-# define FEAT_GUI_MSWIN
-#endif
-#if defined(WIN32) || defined(_WIN64)
-# define MSWIN
-#endif
-/* Practically everything is common to both Win32 and Win64 */
-#if defined(WIN32) || defined(_WIN64)
-# define WIN3264
-#endif
-
/*
* VIM_SIZEOF_INT is used in feature.h, and the system-specific included files
* need items from feature.h. Therefore define VIM_SIZEOF_INT here.
*/
-#ifdef WIN3264
+#ifdef MSWIN
# define VIM_SIZEOF_INT 4
#endif
@@ -276,7 +274,7 @@
# include "os_amiga.h"
#endif
-#ifdef WIN3264
+#ifdef MSWIN
# include "os_win32.h"
#endif
@@ -456,8 +454,7 @@ typedef unsigned int u8char_T; // int is 32 bits or more
# include <sys/stat.h>
#endif
-#if defined(HAVE_ERRNO_H) \
- || defined(WIN32) || defined(_WIN64)
+#if defined(HAVE_ERRNO_H) || defined(MSWIN)
# include <errno.h>
#endif
@@ -509,7 +506,7 @@ typedef unsigned int u8char_T; // int is 32 bits or more
#ifndef HAVE_SELECT
# ifdef HAVE_SYS_POLL_H
# include <sys/poll.h>
-# elif defined(WIN32)
+# elif defined(MSWIN)
# define HAVE_SELECT
# else
# ifdef HAVE_POLL_H
@@ -1752,7 +1749,7 @@ void *vim_memset(void *, int, size_t);
#define MB_MAXBYTES 21
#if (defined(FEAT_PROFILE) || defined(FEAT_RELTIME)) && !defined(PROTO)
-# ifdef WIN3264
+# ifdef MSWIN
typedef LARGE_INTEGER proftime_T;
# else
typedef struct timeval proftime_T;
@@ -1769,7 +1766,7 @@ typedef int proftime_T; /* dummy for function prototypes */
#ifdef PROTO
typedef long time_T;
#else
-# ifdef WIN3264
+# ifdef MSWIN
typedef __time64_t time_T;
# else
typedef time_t time_T;
@@ -2005,7 +2002,7 @@ typedef int sock_T;
# define SELECT_MODE_WORD 1
# define SELECT_MODE_LINE 2
-# ifdef FEAT_GUI_W32
+# ifdef FEAT_GUI_MSWIN
# ifdef FEAT_OLE
# define WM_OLE (WM_APP+0)
# endif
@@ -2103,7 +2100,7 @@ typedef enum {
#endif
# if defined(FEAT_EVAL) \
- && (!defined(FEAT_GUI_W32) \
+ && (!defined(FEAT_GUI_MSWIN) \
|| !(defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))) \
&& !(defined(FEAT_GUI_MAC) && defined(MACOS_CONVERT))
/* Whether IME is supported by im_get_status() defined in mbyte.c.
@@ -2115,7 +2112,7 @@ typedef enum {
#if defined(FEAT_XIM) \
|| defined(IME_WITHOUT_XIM) \
- || (defined(FEAT_GUI_W32) \
+ || (defined(FEAT_GUI_MSWIN) \
&& (defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME))) \
|| defined(FEAT_GUI_MAC)
/* im_set_active() is available */
@@ -2129,7 +2126,7 @@ typedef enum {
/* This must come after including proto.h.
* For VMS this is defined in macros.h. */
-#if !defined(WIN3264) && !defined(VMS)
+#if !defined(MSWIN) && !defined(VMS)
# define mch_open(n, m, p) open((n), (m), (p))
# define mch_fopen(n, p) fopen((n), (p))
#endif
@@ -2169,7 +2166,7 @@ typedef enum {
#endif
/* stop using fastcall for Borland */
-#if defined(__BORLANDC__) && defined(WIN32) && !defined(DEBUG)
+#if defined(__BORLANDC__) && defined(MSWIN) && !defined(DEBUG)
#pragma option -p.
#endif
@@ -2461,7 +2458,7 @@ typedef enum {
# define MAX_OPEN_CHANNELS 0
#endif
-#if defined(WIN32)
+#if defined(MSWIN)
# define MAX_NAMED_PIPE_SIZE 65535
#endif
@@ -2579,7 +2576,7 @@ typedef enum {
# define ELAPSED_FUNC(v) elapsed(&v)
typedef struct timeval elapsed_T;
long elapsed(struct timeval *start_tv);
-#elif defined(WIN32)
+#elif defined(MSWIN)
# define ELAPSED_TICKCOUNT
# define ELAPSED_INIT(v) v = GetTickCount()
# define ELAPSED_FUNC(v) elapsed(v)