Skip to content

Commit

Permalink
patch 8.1.0941: macros for MS-Windows are inconsistent
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
brammool committed Feb 17, 2019
1 parent 78d21da commit 4f97475
Show file tree
Hide file tree
Showing 68 changed files with 537 additions and 539 deletions.
2 changes: 1 addition & 1 deletion src/GvimExt/gvimext.h
Expand Up @@ -31,7 +31,7 @@
# define STRICT
#endif

#define INC_OLE2 // WIN32, get ole2 from windows.h
#define INC_OLE2 // MS-Windows, get ole2 from windows.h

/* Visual Studio 2005 has 'deprecated' many of the standard CRT functions */
#if defined(_MSC_VER) && _MSC_VER >= 1400
Expand Down
2 changes: 1 addition & 1 deletion src/Make_bc5.mak
Expand Up @@ -405,7 +405,7 @@ DEFINES = $(DEFINES) -DFEAT_CSCOPE
!endif

!if ("$(GUI)"=="yes")
DEFINES = $(DEFINES) -DFEAT_GUI_W32 -DFEAT_CLIPBOARD
DEFINES = $(DEFINES) -DFEAT_GUI -DFEAT_CLIPBOARD
!if ("$(DEBUG)"=="yes")
TARGET = gvimd.exe
!else
Expand Down
2 changes: 1 addition & 1 deletion src/Make_cyg_ming.mak
Expand Up @@ -491,7 +491,7 @@ endif # RUBY

# See feature.h for a list of options.
# Any other defines can be included here.
DEF_GUI=-DFEAT_GUI_W32 -DFEAT_CLIPBOARD
DEF_GUI=-DFEAT_GUI -DFEAT_CLIPBOARD
DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \
-DHAVE_PATHDEF -DFEAT_$(FEATURES) -DHAVE_STDINT_H
ifeq ($(ARCH),x86-64)
Expand Down
24 changes: 12 additions & 12 deletions src/Make_ivc.mak
Expand Up @@ -92,8 +92,8 @@ LINK32_FLAGS= oldnames.lib kernel32.lib user32.lib gdi32.lib version.lib comdlg3
# ADD LINK32 oldnames.lib kernel32.lib user32.lib gdi32.lib version.lib comdlg32.lib comctl32.lib advapi32.lib shell32.lib ole32.lib uuid.lib /nologo /machine:I386 /nodefaultlib
# SUBTRACT LINK32 /incremental:yes

RSC_PROJ= /l 0x409 /d "FEAT_GUI_W32"
# ADD RSC /l 0x409 /d "FEAT_GUI_W32"
RSC_PROJ= /l 0x409 /d "FEAT_GUI"
# ADD RSC /l 0x409 /d "FEAT_GUI"

!IF "$(CFG)" == "Vim - Win32 Release gvim OLE"

Expand All @@ -105,8 +105,8 @@ INTDIR=.\oleRel
VIM=gvim
EXTRAS="$(INTDIR)/if_ole.obj" "$(INTDIR)/vim.res" "$(INTDIR)/gui.obj" "$(INTDIR)/gui_w32.obj" "$(INTDIR)/gui_beval.obj" "$(INTDIR)/os_w32exe.obj"

CPP_PROJ=$(CPP_PROJ) /Zi /O2 /D "NDEBUG" /D "FEAT_GUI_W32" /D "DYNAMIC_GETTEXT" /D "FEAT_OLE" /Fd.\oleRel/ /Fo.\oleRel/
# ADD CPP /Zi /O2 /D "NDEBUG" /D "FEAT_GUI_W32" /D "DYNAMIC_GETTEXT" /D "FEAT_OLE" /Fd.\oleRel/ /Fo.\oleRel/
CPP_PROJ=$(CPP_PROJ) /Zi /O2 /D "NDEBUG" /D "FEAT_GUI" /D "DYNAMIC_GETTEXT" /D "FEAT_OLE" /Fd.\oleRel/ /Fo.\oleRel/
# ADD CPP /Zi /O2 /D "NDEBUG" /D "FEAT_GUI" /D "DYNAMIC_GETTEXT" /D "FEAT_OLE" /Fd.\oleRel/ /Fo.\oleRel/

RSC_PROJ=$(RSC_PROJ) /I ".\oleRel" /d "NDEBUG" /d "FEAT_OLE" /fo.\oleRel\vim.res
# ADD RSC /I ".\oleRel" /d "NDEBUG" /d "FEAT_OLE" /fo.\oleRel\vim.res
Expand All @@ -124,8 +124,8 @@ INTDIR=.\oleDbg
VIM=gvimd
EXTRAS="$(INTDIR)/if_ole.obj" "$(INTDIR)/vim.res" "$(INTDIR)/gui.obj" "$(INTDIR)/gui_w32.obj" "$(INTDIR)/gui_beval.obj" "$(INTDIR)/os_w32exe.obj"

CPP_PROJ=$(CPP_PROJ) /Zi /Od /D "_DEBUG" /D "FEAT_GUI_W32" /D "DYNAMIC_GETTEXT" /D "FEAT_OLE" /Fd.\oleDbg/ /Fo.\oleDbg/
# ADD CPP /Zi /Od /D "_DEBUG" /D "FEAT_GUI_W32" /D "DYNAMIC_GETTEXT" /D "FEAT_OLE" /Fd.\oleDbg/ /Fo.\oleDbg/
CPP_PROJ=$(CPP_PROJ) /Zi /Od /D "_DEBUG" /D "FEAT_GUI" /D "DYNAMIC_GETTEXT" /D "FEAT_OLE" /Fd.\oleDbg/ /Fo.\oleDbg/
# ADD CPP /Zi /Od /D "_DEBUG" /D "FEAT_GUI" /D "DYNAMIC_GETTEXT" /D "FEAT_OLE" /Fd.\oleDbg/ /Fo.\oleDbg/

RSC_PROJ=$(RSC_PROJ) /I .\oleDbg /d "_DEBUG" /d "FEAT_OLE" /fo.\oleDbg\vim.res
# ADD RSC /I .\oleDbg /d "_DEBUG" /d "FEAT_OLE" /fo.\oleDbg\vim.res
Expand All @@ -144,8 +144,8 @@ INTDIR=.\gRel
VIM=gvim
EXTRAS="$(INTDIR)/vim.res" "$(INTDIR)/gui.obj" "$(INTDIR)/gui_w32.obj" "$(INTDIR)/gui_beval.obj" "$(INTDIR)/os_w32exe.obj"

CPP_PROJ=$(CPP_PROJ) /Zi /O2 /D "NDEBUG" /D "FEAT_GUI_W32" /Fd.\gRel/ /Fo.\gRel/
# ADD CPP /Zi /O2 /D "NDEBUG" /D "FEAT_GUI_W32" /Fd.\gRel/ /Fo.\gRel/
CPP_PROJ=$(CPP_PROJ) /Zi /O2 /D "NDEBUG" /D "FEAT_GUI" /Fd.\gRel/ /Fo.\gRel/
# ADD CPP /Zi /O2 /D "NDEBUG" /D "FEAT_GUI" /Fd.\gRel/ /Fo.\gRel/

RSC_PROJ=$(RSC_PROJ) /d "NDEBUG" /fo.\gRel\vim.res
# ADD RSC /d "NDEBUG" /fo.\gRel\vim.res
Expand All @@ -163,8 +163,8 @@ INTDIR=.\gDbg
VIM=gvimd
EXTRAS="$(INTDIR)/vim.res" "$(INTDIR)/gui.obj" "$(INTDIR)/gui_w32.obj" "$(INTDIR)/gui_beval.obj" "$(INTDIR)/os_w32exe.obj"

CPP_PROJ=$(CPP_PROJ) /Zi /Od /D "_DEBUG" /D "FEAT_GUI_W32" /Fd.\gDbg/ /Fo.\gDbg/
# ADD CPP /Zi /Od /D "_DEBUG" /D "FEAT_GUI_W32" /Fd.\gDbg/ /Fo.\gDbg/
CPP_PROJ=$(CPP_PROJ) /Zi /Od /D "_DEBUG" /D "FEAT_GUI" /Fd.\gDbg/ /Fo.\gDbg/
# ADD CPP /Zi /Od /D "_DEBUG" /D "FEAT_GUI" /Fd.\gDbg/ /Fo.\gDbg/

RSC_PROJ=$(RSC_PROJ) /d "_DEBUG" /fo.\gDbg\vim.res
# ADD RSC /d "_DEBUG" /fo.\gDbg\vim.res
Expand Down Expand Up @@ -508,7 +508,7 @@ SOURCE=.\if_ole.cpp
# Begin Custom Build

"$(INTDIR)\if_ole.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\if_ole.h"
cl.exe /nologo /MT /W3 /GX /I ".\proto" /D "WIN32" /c /Zi /O2 /D "NDEBUG" /D "FEAT_GUI_W32" /D "FEAT_OLE" /Fd.\oleRel/ /Fo.\oleRel/ /I ".\oleRel" .\if_ole.cpp
cl.exe /nologo /MT /W3 /GX /I ".\proto" /D "WIN32" /c /Zi /O2 /D "NDEBUG" /D "FEAT_GUI" /D "FEAT_OLE" /Fd.\oleRel/ /Fo.\oleRel/ /I ".\oleRel" .\if_ole.cpp
@rem This is the default rule with /I "$(IntDir)" added

# End Custom Build
Expand All @@ -519,7 +519,7 @@ SOURCE=.\if_ole.cpp
# Begin Custom Build

"$(INTDIR)\if_ole.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\if_ole.h"
cl.exe /nologo /MT /W3 /GX /I ".\proto" /D "WIN32" /c /Zi /Od /D "_DEBUG" /D "FEAT_GUI_W32" /D "FEAT_OLE" /Fd.\oleDbg/ /Fo.\oleDbg/ /I ".\oleDbg" .\if_ole.cpp
cl.exe /nologo /MT /W3 /GX /I ".\proto" /D "WIN32" /c /Zi /Od /D "_DEBUG" /D "FEAT_GUI" /D "FEAT_OLE" /Fd.\oleDbg/ /Fo.\oleDbg/ /I ".\oleDbg" .\if_ole.cpp
@rem This is the default rule with /I "$(IntDir)" added

# End Custom Build
Expand Down
4 changes: 2 additions & 2 deletions src/Make_mvc.mak
Expand Up @@ -791,8 +791,8 @@ OBJ = $(OBJ) $(OUTDIR)\dimm_i.obj $(OUTDIR)\glbl_ime.obj

!if "$(GUI)" == "yes"
SUBSYSTEM = windows
CFLAGS = $(CFLAGS) -DFEAT_GUI_W32
RCFLAGS = $(RCFLAGS) -DFEAT_GUI_W32
CFLAGS = $(CFLAGS) -DFEAT_GUI
RCFLAGS = $(RCFLAGS) -DFEAT_GUI
VIM = g$(VIM)
GUI_INCL = \
gui.h
Expand Down
6 changes: 3 additions & 3 deletions src/beval.h
Expand Up @@ -43,7 +43,7 @@ typedef struct BalloonEvalStruct
int y;
unsigned int state; /* Button/Modifier key state */
# else
# if !defined(FEAT_GUI_W32)
# if !defined(FEAT_GUI_MSWIN)
Widget target; /* widget we are monitoring */
Widget balloonShell;
Widget balloonLabel;
Expand All @@ -63,7 +63,7 @@ typedef struct BalloonEvalStruct
BeState showState; /* tells us whats currently going on */
# endif
# endif
# if !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_W32)
# if !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MSWIN)
Dimension screen_width; /* screen width in pixels */
Dimension screen_height; /* screen height in pixels */
# endif
Expand All @@ -76,7 +76,7 @@ typedef struct BalloonEvalStruct
int *vts; // vartabstop setting for this buffer
#endif
char_u *msg;
#ifdef FEAT_GUI_W32
#ifdef FEAT_GUI_MSWIN
void *tofree;
#endif
} BalloonEval;
Expand Down
2 changes: 1 addition & 1 deletion src/blowfish.c
Expand Up @@ -34,7 +34,7 @@ typedef union {
char_u uc[8];
} block8;

#if defined(WIN3264)
#if defined(MSWIN)
/* MS-Windows is always little endian */
#else
# ifdef HAVE_CONFIG_H
Expand Down
56 changes: 28 additions & 28 deletions src/channel.c
Expand Up @@ -20,7 +20,7 @@
#endif

/* Note: when making changes here also adjust configure.ac. */
#ifdef WIN32
#ifdef MSWIN
/* WinSock API is separated from C API, thus we can't use read(), write(),
* errno... */
# define SOCK_ERRNO errno = WSAGetLastError()
Expand Down Expand Up @@ -65,7 +65,7 @@ static int safe_to_invoke_callback = 0;

static char *part_names[] = {"sock", "out", "err", "in"};

#ifdef WIN32
#ifdef MSWIN
static int
fd_read(sock_T fd, char *buf, size_t len)
{
Expand Down Expand Up @@ -234,7 +234,7 @@ ch_error(channel_T *ch, const char *fmt, ...)
}
}

#ifdef _WIN32
#ifdef MSWIN
# undef PERROR
# define PERROR(msg) (void)semsg("%s: %s", msg, strerror_win32(errno))

Expand Down Expand Up @@ -687,7 +687,7 @@ channel_open(
int sd = -1;
struct sockaddr_in server;
struct hostent *host;
#ifdef WIN32
#ifdef MSWIN
u_short port = port_in;
u_long val = 1;
#else
Expand All @@ -696,7 +696,7 @@ channel_open(
channel_T *channel;
int ret;

#ifdef WIN32
#ifdef MSWIN
channel_init_winsock();
#endif

Expand Down Expand Up @@ -758,7 +758,7 @@ channel_open(
{
/* Make connect() non-blocking. */
if (
#ifdef _WIN32
#ifdef MSWIN
ioctlsocket(sd, FIONBIO, &val) < 0
#else
fcntl(sd, F_SETFL, O_NONBLOCK) < 0
Expand Down Expand Up @@ -804,14 +804,14 @@ channel_open(

/* If connect() didn't finish then try using select() to wait for the
* connection to be made. For Win32 always use select() to wait. */
#ifndef WIN32
#ifndef MSWIN
if (errno != ECONNREFUSED)
#endif
{
struct timeval tv;
fd_set rfds;
fd_set wfds;
#ifndef WIN32
#ifndef MSWIN
int so_error = 0;
socklen_t so_error_len = sizeof(so_error);
struct timeval start_tv;
Expand All @@ -824,7 +824,7 @@ channel_open(

tv.tv_sec = waitnow / 1000;
tv.tv_usec = (waitnow % 1000) * 1000;
#ifndef WIN32
#ifndef MSWIN
gettimeofday(&start_tv, NULL);
#endif
ch_log(channel,
Expand All @@ -842,7 +842,7 @@ channel_open(
return NULL;
}

#ifdef WIN32
#ifdef MSWIN
/* On Win32: select() is expected to work and wait for up to
* "waitnow" msec for the socket to be open. */
if (FD_ISSET(sd, &wfds))
Expand Down Expand Up @@ -893,7 +893,7 @@ channel_open(
#endif
}

#ifndef WIN32
#ifndef MSWIN
if (waittime > 1 && elapsed_msec < waittime)
{
/* The port isn't ready but we also didn't get an error.
Expand Down Expand Up @@ -930,7 +930,7 @@ channel_open(

if (waittime >= 0)
{
#ifdef _WIN32
#ifdef MSWIN
val = 0;
ioctlsocket(sd, FIONBIO, &val);
#else
Expand Down Expand Up @@ -1029,7 +1029,7 @@ ch_close_part(channel_T *channel, ch_part_T part)
&& (part == PART_OUT || channel->CH_OUT_FD != *fd)
&& (part == PART_ERR || channel->CH_ERR_FD != *fd))
{
#ifdef WIN32
#ifdef MSWIN
if (channel->ch_named_pipe)
DisconnectNamedPipe((HANDLE)fd);
#endif
Expand Down Expand Up @@ -1427,7 +1427,7 @@ can_write_buf_line(channel_T *channel)
in_part->ch_block_write = 1;

/* TODO: Win32 implementation, probably using WaitForMultipleObjects() */
#ifndef WIN32
#ifndef MSWIN
{
# if defined(HAVE_SELECT)
struct timeval tval;
Expand Down Expand Up @@ -1759,7 +1759,7 @@ channel_get_all(channel_T *channel, ch_part_T part, int *outlen)
{
if (*p == NUL)
*p = NL;
#ifdef WIN32
#ifdef MSWIN
else if (*p == 0x1b)
{
// crush the escape sequence OSC 0/1/2: ESC ]0;
Expand Down Expand Up @@ -2064,7 +2064,7 @@ channel_parse_json(channel_T *channel, ch_part_T part)
(int)buflen);
reader.js_used = 0;
chanpart->ch_wait_len = buflen;
#ifdef WIN32
#ifdef MSWIN
chanpart->ch_deadline = GetTickCount() + 100L;
#else
gettimeofday(&chanpart->ch_deadline, NULL);
Expand All @@ -2079,7 +2079,7 @@ channel_parse_json(channel_T *channel, ch_part_T part)
else
{
int timeout;
#ifdef WIN32
#ifdef MSWIN
timeout = GetTickCount() > chanpart->ch_deadline;
#else
{
Expand Down Expand Up @@ -3198,7 +3198,7 @@ channel_wait(channel_T *channel, sock_T fd, int timeout)
if (timeout > 0)
ch_log(channel, "Waiting for up to %d msec", timeout);

# ifdef WIN32
# ifdef MSWIN
if (fd != channel->CH_SOCK_FD)
{
DWORD nread;
Expand Down Expand Up @@ -3554,7 +3554,7 @@ channel_read_json_block(
timeout = timeout_arg;
if (chanpart->ch_wait_len > 0)
{
#ifdef WIN32
#ifdef MSWIN
timeout = chanpart->ch_deadline - GetTickCount() + 1;
#else
{
Expand Down Expand Up @@ -3680,7 +3680,7 @@ common_channel_read(typval_T *argvars, typval_T *rettv, int raw, int blob)
free_job_options(&opt);
}

# if defined(WIN32) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) \
# if defined(MSWIN) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) \
|| defined(PROTO)
/*
* Lookup the channel from the socket. Set "partp" to the fd index.
Expand All @@ -3707,7 +3707,7 @@ channel_fd2channel(sock_T fd, ch_part_T *partp)
}
# endif

# if defined(WIN32) || defined(FEAT_GUI) || defined(PROTO)
# if defined(MSWIN) || defined(FEAT_GUI) || defined(PROTO)
/*
* Check the channels for anything that is ready to be read.
* The data is put in the read queue.
Expand Down Expand Up @@ -3772,7 +3772,7 @@ channel_set_nonblock(channel_T *channel, ch_part_T part)

if (fd != INVALID_FD)
{
#ifdef _WIN32
#ifdef MSWIN
u_long val = 1;

ioctlsocket(fd, FIONBIO, &val);
Expand Down Expand Up @@ -3853,7 +3853,7 @@ channel_send(
else
{
res = fd_write(fd, (char *)buf, len);
#ifdef WIN32
#ifdef MSWIN
if (channel->ch_named_pipe && res < 0)
{
DisconnectNamedPipe((HANDLE)fd);
Expand Down Expand Up @@ -4213,7 +4213,7 @@ channel_poll_check(int ret_in, void *fds_in)
}
# endif /* UNIX && !HAVE_SELECT */

# if (!defined(WIN32) && defined(HAVE_SELECT)) || defined(PROTO)
# if (!defined(MSWIN) && defined(HAVE_SELECT)) || defined(PROTO)

/*
* The "fd_set" type is hidden to avoid problems with the function proto.
Expand Down Expand Up @@ -4313,7 +4313,7 @@ channel_select_check(int ret_in, void *rfds_in, void *wfds_in)

return ret;
}
# endif /* !WIN32 && HAVE_SELECT */
# endif /* !MSWIN && HAVE_SELECT */

/*
* Execute queued up commands.
Expand Down Expand Up @@ -5039,7 +5039,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2)
break;
opt->jo_cwd = tv_get_string_buf_chk(item, opt->jo_cwd_buf);
if (opt->jo_cwd == NULL || !mch_isdir(opt->jo_cwd)
#ifndef WIN32 // Win32 directories don't have the concept of "executable"
#ifndef MSWIN // Win32 directories don't have the concept of "executable"
|| mch_access((char *)opt->jo_cwd, X_OK) != 0
#endif
)
Expand Down Expand Up @@ -5199,7 +5199,7 @@ job_free_contents(job_T *job)
#ifdef UNIX
vim_free(job->jv_termsig);
#endif
#ifdef WIN3264
#ifdef MSWIN
vim_free(job->jv_tty_type);
#endif
free_callback(job->jv_exit_cb, job->jv_exit_partial);
Expand Down Expand Up @@ -5971,7 +5971,7 @@ job_info(job_T *job, dict_T *dict)
#ifdef UNIX
dict_add_string(dict, "termsig", job->jv_termsig);
#endif
#ifdef WIN3264
#ifdef MSWIN
dict_add_string(dict, "tty_type", job->jv_tty_type);
#endif

Expand Down

0 comments on commit 4f97475

Please sign in to comment.