diff src/vim.h @ 15868:7fad90423bd2 v8.1.0941

patch 8.1.0941: macros for MS-Windows are inconsistent commit https://github.com/vim/vim/commit/4f97475d326c2773a78561fb874e4f23c25cbcd9 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 17 17:44:42 2019 +0100 patch 8.1.0941: macros for MS-Windows are inconsistent 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)
author Bram Moolenaar <Bram@vim.org>
date Sun, 17 Feb 2019 17:45:08 +0100
parents 9745c25da3bc
children cdb9cbe731b3
line wrap: on
line diff
--- 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
 # 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
 #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
 #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)