Commit: patch 9.1.1662: Issues with proto files: missing or inconsistent prototypes.

2 views
Skip to first unread message

Christian Brabandt

unread,
Aug 20, 2025, 4:15:16 PM8/20/25
to vim...@googlegroups.com
patch 9.1.1662: Issues with proto files: missing or inconsistent prototypes.

Commit: https://github.com/vim/vim/commit/d839a5b3b02cf284c831cd400a7e2169b44f471b
Author: Hirohito Higashi <h.eas...@gmail.com>
Date: Wed Aug 20 22:08:13 2025 +0200

patch 9.1.1662: Issues with proto files: missing or inconsistent prototypes.

Problem: Issues with proto files: missing or inconsistent prototypes.
Solution: Update ifdefs, move typedefs, fix prototype declaration
(Hirohito Higashi)

This change focuses on fixes and tweaks found while working on #18045 for
the proto/*.pro files.

The following fixes and tweaks have been made:

- Fixed a prototype declaration where the variable name differed from
the function definition.
- Removed a prototype declaration without a function body.
- Fixed a problem where a prototype declaration was not created for a
function definition enclosed in a #if directive because it lacked ||
defined(PROTO).
- Moved typedef struct soundcb_S soundcb_T; from proto/sound.pro to
vim.h.
- Other small tweaks.

The make proto mechanism remains unchanged.

closes: #18058

Signed-off-by: Hirohito Higashi <h.eas...@gmail.com>
Signed-off-by: Yegappan Lakshmanan <yega...@yahoo.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/cmdexpand.c b/src/cmdexpand.c
index 416a7a7b3..4bde81c62 100644
--- a/src/cmdexpand.c
+++ b/src/cmdexpand.c
@@ -3541,7 +3541,7 @@ ExpandGeneric(
regmatch_T *regmatch,
char_u ***matches,
int *numMatches,
- char_u *((*func)(expand_T *, int)),
+ char_u *(*func)(expand_T *, int),
// returns a string from the list
int escaped)
{
@@ -3572,7 +3572,7 @@ ExpandGenericExt(
regmatch_T *regmatch,
char_u ***matches,
int *numMatches,
- char_u *((*func)(expand_T *, int)),
+ char_u *(*func)(expand_T *, int),
// returns a string from the list
int escaped,
int sortStartIdx)
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 2e3af0421..476deda93 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -2695,7 +2695,7 @@ global_event_filter(GdkXEvent *xev,
}
#endif // !USE_GNOME_SESSION

-#ifdef FEAT_SOCKETSERVER
+#if defined(FEAT_SOCKETSERVER) || defined(PROTO)

/*
* Callback for new events from the socket server listening socket
diff --git a/src/indent.c b/src/indent.c
index 7a2c16d3c..4e2614943 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -474,7 +474,7 @@ get_indent_str(
return count;
}

-#ifdef FEAT_VARTABS
+#if defined(FEAT_VARTABS) || defined(PROTO)
/*
* Count the size (in window cells) of the indent in line "ptr", using
* variable tabstops.
diff --git a/src/locale.c b/src/locale.c
index ccdb479a8..f25af6d57 100644
--- a/src/locale.c
+++ b/src/locale.c
@@ -212,7 +212,7 @@ set_lang_var(void)
}
#endif

-#if defined(HAVE_LOCALE_H) || defined(X_LOCALE)
+#if defined(HAVE_LOCALE_H) || defined(X_LOCALE) || defined(PROTO)
/*
* Setup to use the current locale (for ctype() and many other things).
*/
diff --git a/src/macros.h b/src/macros.h
index c11bfa5f7..56d0a3142 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -168,7 +168,7 @@
# undef HAVE_LSTAT // VMS does not have lstat()
# define mch_stat(n, p) stat(vms_fixfilename(n), (p))
#else
-# ifndef MSWIN
+# if !defined(MSWIN) && !defined(PROTO)
# define mch_access(n, p) access((n), (p))
# endif

diff --git a/src/misc2.c b/src/misc2.c
index 9b8147cbb..368b99b88 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -771,7 +771,7 @@ copy_option_part(
return len;
}

-#ifndef HAVE_MEMSET
+#if !defined(HAVE_MEMSET) && !defined(PROTO)
void *
vim_memset(void *ptr, int c, size_t size)
{
@@ -2609,7 +2609,7 @@ free_username(void)
}
#endif

-#ifndef HAVE_QSORT
+#if !defined(HAVE_QSORT) && !defined(PROTO)
/*
* Our own qsort(), for systems that don't have it.
* It's simple and slow. From the K&R C book.
@@ -2676,7 +2676,7 @@ qsort(
* (history removed, not very interesting. See the "screen" sources.)
*/

-#if !defined(HAVE_SETENV) && !defined(HAVE_PUTENV)
+#if !defined(HAVE_SETENV) && !defined(HAVE_PUTENV) && !defined(PROTO)

#define EXTRASIZE 5 // increment to add to env. size

diff --git a/src/option.c b/src/option.c
index 2ec959c72..2aa06027a 100644
--- a/src/option.c
+++ b/src/option.c
@@ -4748,7 +4748,7 @@ did_set_winwidth(optset_T *args UNUSED)
return errmsg;
}

-#ifdef FEAT_WAYLAND_CLIPBOARD
+#if defined(FEAT_WAYLAND_CLIPBOARD) || defined(PROTO)
/*
* Process the new 'wlsteal' option value.
*/
@@ -4761,7 +4761,7 @@ did_set_wlsteal(optset_T *args UNUSED)
}
#endif

-#ifdef FEAT_WAYLAND
+#if defined(FEAT_WAYLAND) || defined(PROTO)
/*
* Process the new 'wltimeoutlen' option value.
*/
@@ -8915,7 +8915,7 @@ option_set_callback_func(char_u *optval UNUSED, callback_T *optcb UNUSED)
#endif
}

-#if defined(FEAT_TABPANEL)
+#if defined(FEAT_TABPANEL) || defined(PROTO)
/*
* Process the new 'showtabpanel' option value.
*/
diff --git a/src/optionstr.c b/src/optionstr.c
index bbae33973..cbc0a9e4f 100644
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -3616,7 +3616,7 @@ did_set_rulerformat(optset_T *args)
}
#endif

-#if defined(FEAT_TABPANEL)
+#if defined(FEAT_TABPANEL) || defined(PROTO)
/*
* Process the new 'tabpanelopt' option value.
*/
@@ -5068,7 +5068,7 @@ restore_shm_value(void)
* Export the environment variable $MYVIMDIR to the first item in runtimepath
*/
void
-export_myvimdir()
+export_myvimdir(void)
{
int dofree = FALSE;
char_u *p;
diff --git a/src/os_mswin.c b/src/os_mswin.c
index eefb41d99..d376af86c 100644
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -108,7 +108,6 @@ int WSInitialized = FALSE; // WinSock is initialized
#endif


-#ifndef PROTO
/*
* Save the instance handle of the exe/dll.
*/
@@ -117,7 +116,6 @@ SaveInst(HINSTANCE hInst)
{
g_hinst = hInst;
}
-#endif

#if defined(FEAT_GUI_MSWIN) || defined(PROTO)
/*
diff --git a/src/os_unix.c b/src/os_unix.c
index b1b7b33dc..cf195e62e 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -147,7 +147,7 @@ Window x11_window = 0;
Display *x11_display = NULL;
#endif

-#ifdef FEAT_SOCKETSERVER
+#if defined(FEAT_SOCKETSERVER) || defined(PROTO)
# include <sys/socket.h>
# include <sys/un.h>

@@ -1829,7 +1829,7 @@ xopen_message(long elapsed_msec)
# endif
#endif

-#if defined(FEAT_X11)
+#if defined(FEAT_X11) || defined(PROTO)
/*
* A few functions shared by X11 title and clipboard code.
*/
@@ -1900,7 +1900,7 @@ x_connect_to_server(void)
return TRUE;
}

-#if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD)
+#if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD) || defined(PROTO)
# if defined(USING_SETJMP)
/*
* An X IO Error handler, used to catch error while opening the display.
@@ -3252,7 +3252,7 @@ mch_copy_sec(char_u *from_file, char_u *to_file)
}
#endif // HAVE_SMACK

-#ifdef FEAT_XATTR
+#if defined(FEAT_XATTR) || defined(PROTO)
/*
* Copy extended attributes from_file to to_file
*/
@@ -9134,7 +9134,7 @@ mch_create_anon_file(void)
return fd;
}

-#ifdef FEAT_SOCKETSERVER
+#if defined(FEAT_SOCKETSERVER) || defined(PROTO)

/*
* Initialize socket server called "name" (the socket filename). If "name" is a
diff --git a/src/os_win32.c b/src/os_win32.c
index 6bd03bd1c..056a5a223 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -2118,7 +2118,7 @@ test_mswin_event(char_u *event, dict_T *args)
}
#endif // FEAT_EVAL

-#ifdef MCH_CURSOR_SHAPE
+#if defined(MCH_CURSOR_SHAPE) || defined(PROTO)
/*
* Set the shape of the cursor.
* 'thickness' can be from 1 (thin) to 99 (block)
diff --git a/src/profiler.c b/src/profiler.c
index 00da9b648..4f16d811d 100644
--- a/src/profiler.c
+++ b/src/profiler.c
@@ -172,7 +172,7 @@ profile_zero(proftime_T *tm)

# endif // FEAT_PROFILE || FEAT_RELTIME

-#if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME) && defined(FEAT_PROFILE)
+#if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME) && defined(FEAT_PROFILE) || defined(PROTO)
# if defined(HAVE_MATH_H)
# include <math.h>
# endif
diff --git a/src/proto/cmdexpand.pro b/src/proto/cmdexpand.pro
index 501b5e642..a2f6a16d4 100644
--- a/src/proto/cmdexpand.pro
+++ b/src/proto/cmdexpand.pro
@@ -17,8 +17,8 @@ char_u *addstar(char_u *fname, int len, int context);
void set_expand_context(expand_T *xp);
void set_cmd_context(expand_T *xp, char_u *str, int len, int col, int use_ccline);
int expand_cmdline(expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches);
-int ExpandGeneric(char_u *pat, expand_T *xp, regmatch_T *regmatch, char_u ***matches, int *numMatches, char_u *((*func)(expand_T *, int)), int escaped);
-int ExpandGenericExt(char_u *pat, expand_T *xp, regmatch_T *regmatch, char_u ***matches, int *numMatches, char_u *((*func)(expand_T *, int)), int escaped, int sortStartIdx);
+int ExpandGeneric(char_u *pat, expand_T *xp, regmatch_T *regmatch, char_u ***matches, int *numMatches, char_u *(*func)(expand_T *, int), int escaped);
+int ExpandGenericExt(char_u *pat, expand_T *xp, regmatch_T *regmatch, char_u ***matches, int *numMatches, char_u *(*func)(expand_T *, int), int escaped, int sortStartIdx);
void globpath(char_u *path, char_u *file, garray_T *ga, int expand_options, int dirs);
int wildmenu_translate_key(cmdline_info_T *cclp, int key, expand_T *xp, int did_wild_list);
int wildmenu_process_key(cmdline_info_T *cclp, int key, expand_T *xp);
diff --git a/src/proto/gui_gtk_x11.pro b/src/proto/gui_gtk_x11.pro
index 5e7452d4d..37ae5ec5a 100644
--- a/src/proto/gui_gtk_x11.pro
+++ b/src/proto/gui_gtk_x11.pro
@@ -15,7 +15,7 @@ void gui_mch_show_tabline(int showit);
int gui_mch_showing_tabline(void);
void gui_mch_update_tabline(void);
void gui_mch_set_curtab(int nr);
-void gui_gtk_set_selection_targets(GdkAtom);
+void gui_gtk_set_selection_targets(GdkAtom selection);
void gui_gtk_set_dnd_targets(void);
int gui_mch_init(void);
void gui_mch_forked(void);
diff --git a/src/proto/if_python.pro b/src/proto/if_python.pro
index ee78990af..90d878a99 100644
--- a/src/proto/if_python.pro
+++ b/src/proto/if_python.pro
@@ -8,6 +8,6 @@ void ex_pydo(exarg_T *eap);
void python_buffer_free(buf_T *buf);
void python_window_free(win_T *win);
void python_tabpage_free(tabpage_T *tab);
-void do_pyeval(char_u *str, dict_T* locals, typval_T *rettv);
+void do_pyeval(char_u *str, dict_T *locals, typval_T *rettv);
int set_ref_in_python(int copyID);
/* vim: set ft=c : */
diff --git a/src/proto/if_python3.pro b/src/proto/if_python3.pro
index 63104ab7d..0487c57b6 100644
--- a/src/proto/if_python3.pro
+++ b/src/proto/if_python3.pro
@@ -8,7 +8,7 @@ void ex_py3do(exarg_T *eap);
void python3_buffer_free(buf_T *buf);
void python3_window_free(win_T *win);
void python3_tabpage_free(tabpage_T *tab);
-void do_py3eval(char_u *str, dict_T* locals, typval_T *rettv);
+void do_py3eval(char_u *str, dict_T *locals, typval_T *rettv);
int set_ref_in_python3(int copyID);
int python3_version(void);
/* vim: set ft=c : */
diff --git a/src/proto/option.pro b/src/proto/option.pro
index 8e544184a..f1f8a33a4 100644
--- a/src/proto/option.pro
+++ b/src/proto/option.pro
@@ -68,7 +68,6 @@ char *did_set_shellslash(optset_T *args);
char *did_set_shiftwidth_tabstop(optset_T *args);
char *did_set_showtabline(optset_T *args);
char *did_set_smoothscroll(optset_T *args);
-char *did_set_socktimeoutlen(optset_T *args);
char *did_set_spell(optset_T *args);
char *did_set_swapfile(optset_T *args);
char *did_set_termguicolors(optset_T *args);
diff --git a/src/proto/optionstr.pro b/src/proto/optionstr.pro
index 4da92f77c..734959b60 100644
--- a/src/proto/optionstr.pro
+++ b/src/proto/optionstr.pro
@@ -34,8 +34,6 @@ int expand_set_casemap(optexpand_T *args, int *numMatches, char_u ***matches);
int expand_set_clipboard(optexpand_T *args, int *numMatches, char_u ***matches);
char *did_set_clipmethod(optset_T *args);
int expand_set_clipmethod(optexpand_T *args, int *numMatches, char_u ***matches);
-char *did_set_clientserver(optset_T *args UNUSED);
-int expand_set_clientserver(optexpand_T *args, int *numMatches, char_u ***matches);
char *did_set_chars_option(optset_T *args);
int expand_set_chars_option(optexpand_T *args, int *numMatches, char_u ***matches);
char *did_set_cinoptions(optset_T *args);
diff --git a/src/proto/os_unix.pro b/src/proto/os_unix.pro
index 329e1dbbd..8f623c612 100644
--- a/src/proto/os_unix.pro
+++ b/src/proto/os_unix.pro
@@ -94,13 +94,13 @@ void stop_timeout(void);
volatile sig_atomic_t *start_timeout(long msec);
void delete_timer(void);
int mch_create_anon_file(void);
-int socket_server_init(char_u *sock_path);
+int socket_server_init(char_u *name);
void socket_server_uninit(void);
char_u *socket_server_list_sockets(void);
void socket_server_accept_client(void);
int socket_server_valid(void);
-int socket_server_send(char_u *sock_path, char_u *cmd, char_u **result, char_u **receiver, int is_expr, int timeout, int silent);
-int socket_server_read_reply(char_u *sender, char_u **str, int timeout);
+int socket_server_send(char_u *name, char_u *str, char_u **result, char_u **receiver, int is_expr, int timeout, int silent);
+int socket_server_read_reply(char_u *client, char_u **str, int timeout);
int socket_server_peek_reply(char_u *sender, char_u **str);
int socket_server_send_reply(char_u *client, char_u *str);
int socket_server_get_fd(void);
diff --git a/src/proto/sound.pro b/src/proto/sound.pro
index c6d0541f9..68c1fde77 100644
--- a/src/proto/sound.pro
+++ b/src/proto/sound.pro
@@ -1,10 +1,8 @@
/* sound.c */
-typedef struct soundcb_S soundcb_T;
-
int has_any_sound_callback(void);
-int has_sound_callback_in_queue(void);
-void call_sound_callback(soundcb_T *soundcb, long sound_id, int result);
+void call_sound_callback(soundcb_T *soundcb, long snd_id, int result);
void delete_sound_callback(soundcb_T *soundcb);
+int has_sound_callback_in_queue(void);
void invoke_sound_callback(void);
void f_sound_playevent(typval_T *argvars, typval_T *rettv);
void f_sound_playfile(typval_T *argvars, typval_T *rettv);
diff --git a/src/regexp.c b/src/regexp.c
index 27112bc53..669b123a3 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -50,7 +50,7 @@ toggle_Magic(int x)
return Magic(x);
}

-#ifdef FEAT_RELTIME
+#if defined(FEAT_RELTIME) || defined(PROTO)
static int timeout_nesting = 0;

/*
diff --git a/src/sound.c b/src/sound.c
index 7b4d98405..86fbce070 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -17,7 +17,7 @@

static long sound_id = 0;

-// soundcb_T is typedef'ed in proto/sound.pro
+// soundcb_T is typedef'ed in vim.h

struct soundcb_S
{
diff --git a/src/term.c b/src/term.c
index c892c6d06..d3435ee1f 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2449,7 +2449,7 @@ vim_tgetstr(char *s, char_u **pp)
}
#endif // HAVE_TGETENT

-#if defined(HAVE_TGETENT) && (defined(UNIX) || defined(VMS) || defined(MACOS_X))
+#if defined(HAVE_TGETENT) && (defined(UNIX) || defined(VMS) || defined(MACOS_X)) || defined(PROTO)
/*
* Get Columns and Rows from the termcap. Used after a window signal if the
* ioctl() fails. It doesn't make sense to call tgetent each time if the "co"
diff --git a/src/testing.c b/src/testing.c
index cfa01ff9e..251324c3b 100644
--- a/src/testing.c
+++ b/src/testing.c
@@ -1201,7 +1201,7 @@ f_test_null_blob(typval_T *argvars UNUSED, typval_T *rettv)
rettv->vval.v_blob = NULL;
}

-#ifdef FEAT_JOB_CHANNEL
+#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
void
f_test_null_channel(typval_T *argvars UNUSED, typval_T *rettv)
{
@@ -1216,7 +1216,7 @@ f_test_null_dict(typval_T *argvars UNUSED, typval_T *rettv)
rettv_dict_set(rettv, NULL);
}

-#ifdef FEAT_JOB_CHANNEL
+#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
void
f_test_null_job(typval_T *argvars UNUSED, typval_T *rettv)
{
diff --git a/src/version.c b/src/version.c
index bb3810302..d343e117c 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 */
+/**/
+ 1662,
/**/
1661,
/**/
diff --git a/src/vim.h b/src/vim.h
index 79d3add8a..26d3fc339 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -199,7 +199,7 @@
#endif

#if defined(HAVE_WAYLAND) && defined(WANT_WAYLAND)
-#define FEAT_WAYLAND
+# define FEAT_WAYLAND
#endif

#ifdef NO_X11_INCLUDES
@@ -264,7 +264,7 @@
#if (defined(UNIX) || defined(VMS)) \
&& (!defined(MACOS_X) || defined(HAVE_CONFIG_H))
# include "os_unix.h" // bring lots of system header files
-#else
+#elif !defined(PROTO)
// For all non-Unix systems: use old-fashioned signal().
# define mch_signal(signum, sighandler) signal(signum, sighandler)
#endif
@@ -1917,7 +1917,7 @@ typedef void *vim_acl_T; // dummy to pass an ACL to a function
# define USE_INPUT_BUF
#endif

-#ifndef EINTR
+#if !defined(EINTR) && !defined(PROTO)
# define read_eintr(fd, buf, count) vim_read((fd), (buf), (count))
# define write_eintr(fd, buf, count) vim_write((fd), (buf), (count))
#endif
@@ -2355,6 +2355,8 @@ typedef struct _stat64 stat_T;
typedef struct stat stat_T;
#endif

+typedef struct soundcb_S soundcb_T;
+
#if (defined(__GNUC__) || defined(__clang__)) && !defined(__MINGW32__)
# define ATTRIBUTE_FORMAT_PRINTF(fmt_idx, arg_idx) \
__attribute__((format(printf, fmt_idx, arg_idx)))
@@ -2519,7 +2521,7 @@ typedef int (*opt_expand_cb_T)(optexpand_T *args, int *numMatches, char_u ***mat

// This must come after including proto.h.
// For VMS this is defined in macros.h.
-#if !defined(MSWIN) && !defined(VMS)
+#if !defined(MSWIN) && !defined(VMS) && !defined(PROTO)
# define mch_open(n, m, p) open((n), (m), (p))
# define mch_fopen(n, p) fopen((n), (p))
#endif
@@ -2776,7 +2778,7 @@ typedef int (*opt_expand_cb_T)(optexpand_T *args, int *numMatches, char_u ***mat
// values for vim_handle_signal() that are not a signal
#define SIGNAL_BLOCK (-1)
#define SIGNAL_UNBLOCK (-2)
-#if !defined(UNIX) && !defined(VMS)
+#if !defined(UNIX) && !defined(VMS) && !defined(PROTO)
# define vim_handle_signal(x) 0
#endif

diff --git a/src/window.c b/src/window.c
index 85971164a..723195a0f 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2415,7 +2415,7 @@ win_equal_rec(
}
}

-#ifdef FEAT_JOB_CHANNEL
+#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
void
leaving_window(win_T *win)
{
Reply all
Reply to author
Forward
0 new messages