Commit: patch 9.1.1706: MS-Windows: Compile error when building with if_ruby

9 views
Skip to first unread message

Christian Brabandt

unread,
Aug 27, 2025, 6:15:13 PMAug 27
to vim...@googlegroups.com
patch 9.1.1706: MS-Windows: Compile error when building with if_ruby

Commit: https://github.com/vim/vim/commit/2635e83d46d51e3e896d2f433503deb8c7a65b82
Author: Foxe Chen <chen...@gmail.com>
Date: Wed Aug 27 23:53:41 2025 +0200

patch 9.1.1706: MS-Windows: Compile error when building with if_ruby

Problem: MS-Windows: Compile error when building with if_ruby
(Christian Robinson, after v9.1.1704)
Solution: Do not define gettimeofday() if ruby interface is compiled in
(Foxe Chen).

fixes: #18143
closes: #18144

Signed-off-by: Foxe Chen <chen...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/proto/time.pro b/src/proto/time.pro
index d9739b418..9d6d9e962 100644
--- a/src/proto/time.pro
+++ b/src/proto/time.pro
@@ -20,7 +20,7 @@ void f_timer_pause(typval_T *argvars, typval_T *rettv);
void f_timer_start(typval_T *argvars, typval_T *rettv);
void f_timer_stop(typval_T *argvars, typval_T *rettv);
void f_timer_stopall(typval_T *argvars, typval_T *rettv);
-#if defined(MSWIN) || defined(__MINGW32__)
+#if (defined(MSWIN) || defined(__MINGW32__)) && !defined(FEAT_RUBY)
int gettimeofday(struct timeval *tv, char *dummy);
#endif
void time_push(void *tv_rel, void *tv_start);
diff --git a/src/time.c b/src/time.c
index d45179948..830a94cd6 100644
--- a/src/time.c
+++ b/src/time.c
@@ -127,7 +127,8 @@ get_ctime(time_t thetime, int add_newline)
return buf;
}

-#if defined(MSWIN) || defined(__MINGW32__)
+// Ruby has its own version of gettimeofday
+#if (defined(MSWIN) || defined(__MINGW32__)) && !defined(FEAT_RUBY)
/*
* Windows doesn't have gettimeofday(), although it does have struct timeval.
*/
diff --git a/src/version.c b/src/version.c
index 595c100f0..df58dfd3c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -724,6 +724,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1706,
/**/
1705,
/**/

Cesar Romani

unread,
Aug 28, 2025, 6:59:55 PMAug 28
to vim...@googlegroups.com
But I'm getting the following error:

term.c: In function 'handle_osc':
term.c:5715:9: error: implicit declaration of function 'gettimeofday'
[-Wimplicit-function-declaration]
5715 | gettimeofday(&osc_state.start, NULL);
| ^~~~~~~~~~~~
Error by compiling gvim.exe

I'm building vim with MinGW64 on Windows 10.

--
Cesar

Reply all
Reply to author
Forward
0 new messages