]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1662: Issues with proto files: missing or inconsistent prototypes. v9.1.1662
authorHirohito Higashi <h.east.727@gmail.com>
Wed, 20 Aug 2025 20:08:13 +0000 (22:08 +0200)
committerChristian Brabandt <cb@256bit.org>
Wed, 20 Aug 2025 20:08:13 +0000 (22:08 +0200)
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.east.727@gmail.com>
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
27 files changed:
src/cmdexpand.c
src/gui_gtk_x11.c
src/indent.c
src/locale.c
src/macros.h
src/misc2.c
src/option.c
src/optionstr.c
src/os_mswin.c
src/os_unix.c
src/os_win32.c
src/profiler.c
src/proto/cmdexpand.pro
src/proto/gui_gtk_x11.pro
src/proto/if_python.pro
src/proto/if_python3.pro
src/proto/option.pro
src/proto/optionstr.pro
src/proto/os_unix.pro
src/proto/sound.pro
src/regexp.c
src/sound.c
src/term.c
src/testing.c
src/version.c
src/vim.h
src/window.c

index 416a7a7b39cc80e7255dd376c1f3383fcb680727..4bde81c62be7c77cdb364b5e1dbc6fe6f467fe26 100644 (file)
@@ -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)
index 2e3af0421f465bdf174ce7619a27cfdb7ad059f8..476deda93aa87ce68c2961b721d3912561e84ecc 100644 (file)
@@ -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
index 7a2c16d3c4af9557cae1b7fb89502d06ff5ef115..4e2614943c472fb260097ce98068b36dadabf931 100644 (file)
@@ -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.
index ccdb479a8e806ef0c9a83b6499e6f1eae035c0cd..f25af6d575f2e7833910fbda5eb82980d3687ee7 100644 (file)
@@ -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).
  */
index c11bfa5f79358a17f2fec3c8ba01e8427ee0ea0a..56d0a314269550b5aa2cfcd38920d28410e97677 100644 (file)
 # 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
 
index 9b8147cbb026b4d5985edab88d52096ac6c6c164..368b99b88d08f97235551cc4af12058d926850fd 100644 (file)
@@ -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
 
index 2ec959c726ae0c015f8573a94c8dd837214e4d09..2aa06027a4e0a5b96c8150f22c9eb0f42f270a90 100644 (file)
@@ -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.
  */
index bbae3397366535654d93ac3c542dc1732d3e0d65..cbc0a9e4f8677ffadd87a687a4b20b5544710a99 100644 (file)
@@ -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;
index eefb41d998761474c7c388f8fffc41c7fab619aa..d376af86c69bcce9af4be7dc5315ed8f05783315 100644 (file)
@@ -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)
 /*
index b1b7b33dcbd70318b72e5fab2c741b5eb0bbf6a8..cf195e62e1120e9314254143891b6b0407d88945 100644 (file)
@@ -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
index 6bd03bd1c8a9682fb58afff7fa2210499726ba5a..056a5a2239694eac14f882add9f05371333db0a8 100644 (file)
@@ -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)
index 00da9b64803e7cff419713e0f6d58f58de085906..4f16d811d6184fbd787b3fb0d9f9e681470817de 100644 (file)
@@ -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
index 501b5e6420512f50d7b97fc30d6c7949ec8b9c14..a2f6a16d470976c1ff6f0d5f860427ea6fd3fd47 100644 (file)
@@ -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);
index 5e7452d4d1432ce1ec73105c2f81de11e79a4885..37ae5ec5a60f7426ed97895bbffa800c21476cbe 100644 (file)
@@ -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);
index ee78990af136140276254b529d4e2c27126bc0a0..90d878a9937b94eb7deb5e3a550026476628c0f6 100644 (file)
@@ -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_Tlocals, 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 : */
index 63104ab7dc5547f3420defbbb48834f0e0e09a0e..0487c57b68225af7edb7f1950c9c2f555559416b 100644 (file)
@@ -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_Tlocals, 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 : */
index 8e544184a28a40012567670852f26a6989b388ac..f1f8a33a468e849aa121417a371350a4c2797976 100644 (file)
@@ -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);
index 4da92f77c9a59ba95e94462f650217682c4947c6..734959b60bf04ce620218e16d5028e495f3242bc 100644 (file)
@@ -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);
index 329e1dbbdd1857736c1d23e8b81faeb7939da3a5..8f623c612b4a3b8dee6a69aaf1727c085dba922b 100644 (file)
@@ -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);
index c6d0541f98750bbe9b5c6bf8d97c22124061bb79..68c1fde77cf53a0cc02710281aa1ba09be07145c 100644 (file)
@@ -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);
index 27112bc530fb3f38ab383170b58ab649953d8f32..669b123a3de9b8c8ba4e4214665c6a6acc9edd7a 100644 (file)
@@ -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;
 
 /*
index 7b4d98405ab371ce46ab618f15bc897bb772d431..86fbce0701771ed9c9823c4abb414f8a9fb89f6c 100644 (file)
@@ -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
 {
index c892c6d06b7e42be9f7f171ea1ac85164615af82..d3435ee1f7bdd4f2bd9e883f131268ac4325f795 100644 (file)
@@ -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"
index cfa01ff9e79247adf529789894812b243c3afd4f..251324c3bedb56cfd9d6f3268c0ff5dc86b12420 100644 (file)
@@ -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)
 {
index bb381030276e83b1931ad0411e72d4a764d3d190..d343e117c42d0860aa212563df980e1a6b2d78fe 100644 (file)
@@ -724,6 +724,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1662,
 /**/
     1661,
 /**/
index 79d3add8acdbbf88ecc70b300859b82ebaff54eb..26d3fc339f6bc7b6cb212a1b83dd1603b86281e6 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
 #endif
 
 #if defined(HAVE_WAYLAND) && defined(WANT_WAYLAND)
-#define FEAT_WAYLAND
+# define FEAT_WAYLAND
 #endif
 
 #ifdef NO_X11_INCLUDES
 #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
 
index 85971164a2f8456f5ba14ad4215ef9d458ad9442..723195a0f7b48883e87d110f79ef5bf9fb9f346a 100644 (file)
@@ -2415,7 +2415,7 @@ win_equal_rec(
     }
 }
 
-#ifdef FEAT_JOB_CHANNEL
+#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
     void
 leaving_window(win_T *win)
 {