0
0
mirror of https://github.com/vim/vim.git synced 2025-10-22 08:34:29 -04:00

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.east.727@gmail.com>
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Hirohito Higashi
2025-08-20 22:08:13 +02:00
committed by Christian Brabandt
parent c0a3eda6ba
commit d839a5b3b0
27 changed files with 46 additions and 49 deletions

View 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)

View 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

View 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.

View 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).
*/

View File

@@ -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

View 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

View 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.
*/

View 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;

View 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)
/*

View 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

View 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)

View 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

View 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);

View 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);

View 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);

View 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);

View 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);

View 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);

View 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;
/*

View 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
{

View 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"

View 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)
{

View File

@@ -724,6 +724,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1662,
/**/
1661,
/**/

View File

@@ -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

View 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)
{