# HG changeset patch # User Bram Moolenaar # Date 1676989808 -3600 # Node ID 4545f58c8490a19cd678cf4eb854bbb8ef896fd3 # Parent 6b51ad8c5e8ee3aa669532dfb9ddf931e1d25006 patch 9.0.1336: functions without arguments are not always declared properly Commit: https://github.com/vim/vim/commit/a23a11b5bf03454b71fdb5deac0d5f641e222160 Author: Yegappan Lakshmanan Date: Tue Feb 21 14:27:41 2023 +0000 patch 9.0.1336: functions without arguments are not always declared properly Problem: Functions without arguments are not always declared properly. Solution: Use "(void)" instead of "()". (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/12031) diff --git a/src/channel.c b/src/channel.c --- a/src/channel.c +++ b/src/channel.c @@ -4180,7 +4180,7 @@ channel_handle_events(int only_keep_open * Return TRUE when there is any channel with a keep_open flag. */ int -channel_any_keep_open() +channel_any_keep_open(void) { channel_T *channel; diff --git a/src/charset.c b/src/charset.c --- a/src/charset.c +++ b/src/charset.c @@ -1764,7 +1764,7 @@ skipwhite_and_nl(char_u *q) * columns (bytes) at the start of a given line */ int -getwhitecols_curline() +getwhitecols_curline(void) { return getwhitecols(ml_get_curline()); } diff --git a/src/clipboard.c b/src/clipboard.c --- a/src/clipboard.c +++ b/src/clipboard.c @@ -257,7 +257,7 @@ start_global_changes(void) * right text. */ static int -is_clipboard_needs_update() +is_clipboard_needs_update(void) { return clipboard_needs_update; } diff --git a/src/crypt.c b/src/crypt.c --- a/src/crypt.c +++ b/src/crypt.c @@ -155,7 +155,7 @@ static cryptmethod_T cryptmethods[CRYPT_ // to avoid that a text file is recognized as encrypted. }; -#ifdef FEAT_SODIUM +#if defined(FEAT_SODIUM) || defined(PROTO) typedef struct { size_t count; unsigned char key[crypto_box_SEEDBYTES]; @@ -396,7 +396,7 @@ crypt_get_header_len(int method_nr) * Get maximum crypt method specific length of the file header in bytes. */ int -crypt_get_max_header_len() +crypt_get_max_header_len(void) { int i; int max = 0; diff --git a/src/debugger.c b/src/debugger.c --- a/src/debugger.c +++ b/src/debugger.c @@ -734,7 +734,7 @@ ex_debuggreedy(exarg_T *eap) } static void -update_has_expr_breakpoint() +update_has_expr_breakpoint(void) { int i; @@ -751,7 +751,7 @@ update_has_expr_breakpoint() * Return TRUE if there is any expression breakpoint. */ int -debug_has_expr_breakpoint() +debug_has_expr_breakpoint(void) { return has_expr_breakpoint; } diff --git a/src/edit.c b/src/edit.c --- a/src/edit.c +++ b/src/edit.c @@ -4607,7 +4607,7 @@ ins_end(int c) } static void -ins_s_left() +ins_s_left(void) { int end_change = dont_sync_undo == FALSE; // end undoable change #ifdef FEAT_FOLDING @@ -4676,7 +4676,7 @@ ins_right(void) } static void -ins_s_right() +ins_s_right(void) { int end_change = dont_sync_undo == FALSE; // end undoable change #ifdef FEAT_FOLDING diff --git a/src/ex_docmd.c b/src/ex_docmd.c --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -1386,7 +1386,7 @@ do_cmdline( * Handle when "did_throw" is set after executing commands. */ void -handle_did_throw() +handle_did_throw(void) { char *p = NULL; msglist_T *messages = NULL; diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -463,7 +463,7 @@ alloc_resize_hist(int width, int height) * This list is empty when there are no outstanding resize requests. */ static void -clear_resize_hists() +clear_resize_hists(void) { # ifdef ENABLE_RESIZE_HISTORY_LOG int i = 0; @@ -516,7 +516,7 @@ match_stale_width_height(int width, int # if defined(EXITFREE) static void -free_all_resize_hist() +free_all_resize_hist(void) { clear_resize_hists(); vim_free(latest_resize_hist); diff --git a/src/gui_xim.c b/src/gui_xim.c --- a/src/gui_xim.c +++ b/src/gui_xim.c @@ -295,7 +295,7 @@ im_preedit_window_set_position(void) } static void -im_preedit_window_open() +im_preedit_window_open(void) { char *preedit_string; #if !GTK_CHECK_VERSION(3,16,0) @@ -417,14 +417,14 @@ im_preedit_window_open() } static void -im_preedit_window_close() +im_preedit_window_close(void) { if (preedit_window != NULL) gtk_widget_hide(preedit_window); } static void -im_show_preedit() +im_show_preedit(void) { im_preedit_window_open(); diff --git a/src/highlight.c b/src/highlight.c --- a/src/highlight.c +++ b/src/highlight.c @@ -469,7 +469,7 @@ init_highlight( * the user to override the color values. Only loaded once. */ static void -load_default_colors_lists() +load_default_colors_lists(void) { // Lacking a default color list isn't the end of the world but it is likely // an inconvenience so users should know when it is missing. diff --git a/src/if_lua.c b/src/if_lua.c --- a/src/if_lua.c +++ b/src/if_lua.c @@ -2736,7 +2736,7 @@ set_ref_in_lua(int copyID) } void -update_package_paths_in_lua() +update_package_paths_in_lua(void) { if (!lua_isopen()) return; diff --git a/src/indent.c b/src/indent.c --- a/src/indent.c +++ b/src/indent.c @@ -1161,7 +1161,7 @@ preprocs_left(void) * Return TRUE if the conditions are OK for smart indenting. */ int -may_do_si() +may_do_si(void) { return curbuf->b_p_si && !curbuf->b_p_cin diff --git a/src/insexpand.c b/src/insexpand.c --- a/src/insexpand.c +++ b/src/insexpand.c @@ -2994,7 +2994,7 @@ ins_compl_mode(void) * one assigned yet. */ static void -ins_compl_update_sequence_numbers() +ins_compl_update_sequence_numbers(void) { int number = 0; compl_T *match; @@ -3457,7 +3457,7 @@ get_next_filename_completion(void) * Get the next set of command-line completions matching "compl_pattern". */ static void -get_next_cmdline_completion() +get_next_cmdline_completion(void) { char_u **matches; int num_matches; diff --git a/src/job.c b/src/job.c --- a/src/job.c +++ b/src/job.c @@ -885,7 +885,7 @@ job_still_useful(job_T *job) * Return TRUE when there is any running job that we care about. */ int -job_any_running() +job_any_running(void) { job_T *job; @@ -1655,7 +1655,7 @@ init_prompt(int cmdchar_todo) * Return TRUE if the cursor is in the editable position of the prompt line. */ int -prompt_curpos_editable() +prompt_curpos_editable(void) { return curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count && curwin->w_cursor.col >= (int)STRLEN(prompt_text()); diff --git a/src/misc1.c b/src/misc1.c --- a/src/misc1.c +++ b/src/misc1.c @@ -1313,7 +1313,7 @@ free_users(void) #if defined(MSWIN) || defined(PROTO) /* - * Initilize $VIM and $VIMRUNTIME when 'enc' is updated. + * Initialize $VIM and $VIMRUNTIME when 'enc' is updated. */ void init_vimdir(void) @@ -2777,7 +2777,7 @@ restore_v_event(dict_T *v_event, save_v_ * Fires a ModeChanged autocmd event if appropriate. */ void -may_trigger_modechanged() +may_trigger_modechanged(void) { #ifdef FEAT_EVAL dict_T *v_event; diff --git a/src/mouse.c b/src/mouse.c --- a/src/mouse.c +++ b/src/mouse.c @@ -2234,7 +2234,7 @@ nv_mouse(cmdarg_T *cap) static int held_button = MOUSE_RELEASE; void -reset_held_button() +reset_held_button(void) { held_button = MOUSE_RELEASE; } diff --git a/src/normal.c b/src/normal.c --- a/src/normal.c +++ b/src/normal.c @@ -976,14 +976,14 @@ normal_end: // Reset finish_op, in case it was set #ifdef CURSOR_SHAPE - c = finish_op; + int prev_finish_op = finish_op; #endif finish_op = FALSE; may_trigger_modechanged(); #ifdef CURSOR_SHAPE // Redraw the cursor with another shape, if we were in Operator-pending // mode or did a replace command. - if (c || ca.cmdchar == 'r') + if (prev_finish_op || ca.cmdchar == 'r') { ui_cursor_shape(); // may show different cursor shape # ifdef FEAT_MOUSESHAPE @@ -1110,14 +1110,14 @@ call_yank_do_autocmd(int regname) * from do_pending_operator(). */ void -end_visual_mode() +end_visual_mode(void) { end_visual_mode_keep_button(); reset_held_button(); } void -end_visual_mode_keep_button() +end_visual_mode_keep_button(void) { #ifdef FEAT_CLIPBOARD // If we are using the clipboard, then remember what was selected in case @@ -3190,7 +3190,7 @@ nv_colon(cmdarg_T *cap) else if (cap->oap->op_type != OP_NOP && (cap->oap->start.lnum > curbuf->b_ml.ml_line_count || cap->oap->start.col > - (colnr_T)STRLEN(ml_get(cap->oap->start.lnum)) + (colnr_T)STRLEN(ml_get(cap->oap->start.lnum)) || did_emsg )) // The start of the operator has become invalid by the Ex command. diff --git a/src/optionstr.c b/src/optionstr.c --- a/src/optionstr.c +++ b/src/optionstr.c @@ -3075,7 +3075,7 @@ check_ff_value(char_u *p) * restore_shm_value() exactly the same number of times. */ void -save_clear_shm_value() +save_clear_shm_value(void) { if (STRLEN(p_shm) >= SHM_LEN) { @@ -3094,7 +3094,7 @@ save_clear_shm_value() * Restore the shortmess Flags set from the save_clear_shm_value() function. */ void -restore_shm_value() +restore_shm_value(void) { if (--set_shm_recursive == 0) { diff --git a/src/popupmenu.c b/src/popupmenu.c --- a/src/popupmenu.c +++ b/src/popupmenu.c @@ -387,7 +387,7 @@ pum_display( * This will avoid clearing and redrawing the popup menu, prevent flicker. */ void -pum_call_update_screen() +pum_call_update_screen(void) { call_update_screen = TRUE; diff --git a/src/popupwin.c b/src/popupwin.c --- a/src/popupwin.c +++ b/src/popupwin.c @@ -3309,7 +3309,7 @@ f_popup_getoptions(typval_T *argvars, ty * Return FALSE when the job has ended. */ int -error_if_term_popup_window() +error_if_term_popup_window(void) { if (WIN_IS_POPUP(curwin) && curbuf->b_term != NULL && term_job_running(curbuf->b_term)) @@ -3543,7 +3543,7 @@ popup_no_mapping(void) * cursor moved far enough. */ void -popup_check_cursor_pos() +popup_check_cursor_pos(void) { win_T *wp; diff --git a/src/proto/filepath.pro b/src/proto/filepath.pro --- a/src/proto/filepath.pro +++ b/src/proto/filepath.pro @@ -1,11 +1,11 @@ /* filepath.c */ int modify_fname(char_u *src, int tilde_file, int *usedlen, char_u **fnamep, char_u **bufp, int *fnamelen); void shorten_dir(char_u *str); +int file_is_readable(char_u *fname); void f_chdir(typval_T *argvars, typval_T *rettv); void f_delete(typval_T *argvars, typval_T *rettv); void f_executable(typval_T *argvars, typval_T *rettv); void f_exepath(typval_T *argvars, typval_T *rettv); -int file_is_readable(char_u *fname); void f_filereadable(typval_T *argvars, typval_T *rettv); void f_filewritable(typval_T *argvars, typval_T *rettv); void f_finddir(typval_T *argvars, typval_T *rettv); diff --git a/src/proto/gui_motif.pro b/src/proto/gui_motif.pro --- a/src/proto/gui_motif.pro +++ b/src/proto/gui_motif.pro @@ -32,8 +32,6 @@ void gui_mch_set_scrollbar_colors(scroll Window gui_x11_get_wid(void); char_u *gui_mch_browse(int saving, char_u *title, char_u *dflt, char_u *ext, char_u *initdir, char_u *filter); int gui_mch_dialog(int type, char_u *title, char_u *message, char_u *button_names, int dfltbutton, char_u *textfield, int ex_cmd); -void gui_mch_enable_footer(int showit); -void gui_mch_set_footer(char_u *s); void gui_mch_show_toolbar(int showit); int gui_mch_compute_toolbar_height(void); void motif_get_toolbar_colors(Pixel *bgp, Pixel *fgp, Pixel *bsp, Pixel *tsp, Pixel *hsp); diff --git a/src/quickfix.c b/src/quickfix.c --- a/src/quickfix.c +++ b/src/quickfix.c @@ -8448,7 +8448,7 @@ ex_helpgrep(exarg_T *eap) # if defined(EXITFREE) || defined(PROTO) void -free_quickfix() +free_quickfix(void) { win_T *win; tabpage_T *tab; diff --git a/src/register.c b/src/register.c --- a/src/register.c +++ b/src/register.c @@ -977,7 +977,7 @@ cmdline_paste_reg( * Shift the delete registers: "9 is cleared, "8 becomes "9, etc. */ void -shift_delete_registers() +shift_delete_registers(void) { int n; @@ -2328,7 +2328,7 @@ get_register_name(int num) * Return the index of the register "" points to. */ int -get_unname_register() +get_unname_register(void) { return y_previous == NULL ? -1 : y_previous - &y_regs[0]; } diff --git a/src/screen.c b/src/screen.c --- a/src/screen.c +++ b/src/screen.c @@ -379,7 +379,7 @@ char_needs_redraw(int off_from, int off_ * Return the index in ScreenLines[] for the current screen line. */ int -screen_get_current_line_off() +screen_get_current_line_off(void) { return (int)(current_ScreenLine - ScreenLines); } @@ -3962,7 +3962,7 @@ screen_del_lines( * or inside a mapping. */ int -skip_showmode() +skip_showmode(void) { // Call char_avail() only when we are going to show something, because it // takes a bit of time. redrawing() may also call char_avail(). diff --git a/src/sound.c b/src/sound.c --- a/src/sound.c +++ b/src/sound.c @@ -339,7 +339,7 @@ sound_wndproc(HWND hwnd, UINT message, W } static HWND -sound_window() +sound_window(void) { if (g_hWndSound == NULL) { diff --git a/src/term.c b/src/term.c --- a/src/term.c +++ b/src/term.c @@ -2081,7 +2081,7 @@ set_termname(char_u *term) #endif { // Use the 'keyprotocol' option to adjust the t_TE and t_TI - // termcap entries if there is an entry maching "term". + // termcap entries if there is an entry matching "term". keyprot_T kpc = match_keyprotocol(term); if (kpc == KEYPROTOCOL_KITTY) apply_builtin_tcap(term, builtin_kitty, TRUE); @@ -2092,7 +2092,7 @@ set_termname(char_u *term) // There is no good way to detect that the terminal supports RGB // colors. Since these termcap entries are non-standard anyway and // only used when the user sets 'termguicolors' we might as well add - // them. But not when one of them was alredy set. + // them. But not when one of them was already set. if (term_strings_not_set(KS_8F) && term_strings_not_set(KS_8B) && term_strings_not_set(KS_8U)) @@ -2341,7 +2341,7 @@ set_termname(char_u *term) * Avoids that valgrind reports possibly lost memory. */ void -free_cur_term() +free_cur_term(void) { # ifdef HAVE_DEL_CURTERM if (cur_term) @@ -2997,7 +2997,7 @@ term_set_winpos(int x, int y) * Return TRUE if we can request the terminal for a response. */ static int -can_get_termresponse() +can_get_termresponse(void) { return cur_tmode == TMODE_RAW && termcap_active @@ -3021,7 +3021,7 @@ termrequest_sent(termrequest_T *status) * Return TRUE if any of the requests are in STATUS_SENT. */ static int -termrequest_any_pending() +termrequest_any_pending(void) { int i; time_t now = time(NULL); @@ -4367,7 +4367,7 @@ term_cursor_color(char_u *color) # endif int -blink_state_is_inverted() +blink_state_is_inverted(void) { #ifdef FEAT_TERMRESPONSE return rbm_status.tr_progress == STATUS_GOT diff --git a/src/terminal.c b/src/terminal.c --- a/src/terminal.c +++ b/src/terminal.c @@ -392,7 +392,7 @@ setup_job_options(jobopt_T *opt, int row * Flush messages on channels. */ static void -term_flush_messages() +term_flush_messages(void) { mch_check_messages(); parse_queued_messages(); @@ -1104,7 +1104,7 @@ free_terminal(buf_T *buf) } void -free_unused_terminals() +free_unused_terminals(void) { while (terminals_to_free != NULL) { @@ -2157,7 +2157,7 @@ term_in_normal_mode(void) * Restores updating the terminal window. */ void -term_enter_job_mode() +term_enter_job_mode(void) { term_T *term = curbuf->b_term; @@ -2224,7 +2224,7 @@ check_no_reduce_keys(void) * closed and ++close was used. This may even happen before we get here. */ static int -term_vgetc() +term_vgetc(void) { int c; int save_State = State; @@ -2451,7 +2451,7 @@ term_paste_register(int prev_c UNUSED) * terminal should be displayed. */ int -terminal_is_active() +terminal_is_active(void) { return in_terminal_loop != NULL; } @@ -2609,7 +2609,7 @@ term_use_loop(void) * we may want to change state. */ void -term_win_entered() +term_win_entered(void) { term_T *term = curbuf->b_term; @@ -3702,7 +3702,7 @@ term_channel_closed(channel_T *ch) * channel was closed. */ void -term_check_channel_closed_recently() +term_check_channel_closed_recently(void) { term_T *term; term_T *next_term; @@ -4203,7 +4203,7 @@ term_update_wincolor(win_T *wp) * or when any highlight is changed. */ void -term_update_wincolor_all() +term_update_wincolor_all(void) { win_T *wp = NULL; int did_curwin = FALSE; @@ -4300,7 +4300,7 @@ init_default_colors(term_T *term) * "ansi_colors" argument in term_start()) shall be applied. */ static int -term_use_palette() +term_use_palette(void) { if (0 #ifdef FEAT_GUI @@ -4866,7 +4866,7 @@ term_update_palette(term_T *term) * Called when option 'termguicolors' is changed. */ void -term_update_palette_all() +term_update_palette_all(void) { term_T *term; @@ -5816,7 +5816,7 @@ theend: * Return FAIL when this is not possible. */ int -term_swap_diff() +term_swap_diff(void) { term_T *term = curbuf->b_term; linenr_T line_count; diff --git a/src/time.c b/src/time.c --- a/src/time.c +++ b/src/time.c @@ -802,7 +802,7 @@ timer_valid(timer_T *timer) # if defined(EXITFREE) || defined(PROTO) void -timer_free_all() +timer_free_all(void) { while (first_timer != NULL) { diff --git a/src/userfunc.c b/src/userfunc.c --- a/src/userfunc.c +++ b/src/userfunc.c @@ -36,7 +36,7 @@ static char_u *untrans_function_name(cha static void handle_defer_one(funccall_T *funccal); void -func_init() +func_init(void) { hash_init(&func_hashtab); } @@ -2709,7 +2709,7 @@ create_funccal(ufunc_T *fp, typval_T *re * current_funccal. */ void -remove_funccal() +remove_funccal(void) { funccall_T *fc = current_funccal; @@ -6662,7 +6662,7 @@ get_funccal(void) * Return NULL if there is no current funccal. */ hashtab_T * -get_funccal_local_ht() +get_funccal_local_ht(void) { if (current_funccal == NULL || current_funccal->fc_l_vars.dv_refcount == 0) return NULL; @@ -6674,7 +6674,7 @@ get_funccal_local_ht() * Return NULL if there is no current funccal. */ dictitem_T * -get_funccal_local_var() +get_funccal_local_var(void) { if (current_funccal == NULL || current_funccal->fc_l_vars.dv_refcount == 0) return NULL; @@ -6686,7 +6686,7 @@ get_funccal_local_var() * Return NULL if there is no current funccal. */ hashtab_T * -get_funccal_args_ht() +get_funccal_args_ht(void) { if (current_funccal == NULL || current_funccal->fc_l_vars.dv_refcount == 0) return NULL; @@ -6698,7 +6698,7 @@ get_funccal_args_ht() * Return NULL if there is no current funccal. */ dictitem_T * -get_funccal_args_var() +get_funccal_args_var(void) { if (current_funccal == NULL || current_funccal->fc_l_vars.dv_refcount == 0) return NULL; diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1336, +/**/ 1335, /**/ 1334, diff --git a/src/vim.h b/src/vim.h --- a/src/vim.h +++ b/src/vim.h @@ -2287,6 +2287,9 @@ typedef enum { /* * Type for the callback function that is invoked after an option value is * changed to validate and apply the new value. + * + * Returns NULL if the option value is valid is successfully applied. + * Otherwise returns an error message. */ typedef char *(*opt_did_set_cb_T)(optset_T *args); diff --git a/src/vim9compile.c b/src/vim9compile.c --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -291,7 +291,7 @@ update_script_var_block_id(char_u *name, * Return TRUE if the script context is Vim9 script. */ int -script_is_vim9() +script_is_vim9(void) { return SCRIPT_ITEM(current_sctx.sc_sid)->sn_version == SCRIPT_VERSION_VIM9; } diff --git a/src/window.c b/src/window.c --- a/src/window.c +++ b/src/window.c @@ -824,7 +824,7 @@ cmd_with_count( * Otherwise return OK. */ static int -check_split_disallowed() +check_split_disallowed(void) { if (split_disallowed > 0) { @@ -6014,7 +6014,7 @@ frame_comp_pos(frame_T *topfrp, int *row * Make the current window show at least one line and one column. */ void -win_ensure_size() +win_ensure_size(void) { if (curwin->w_height == 0) win_setheight(1); @@ -7357,7 +7357,7 @@ check_lnums_nested(int do_curwin) * check_lnums() must have been called first! */ void -reset_lnums() +reset_lnums(void) { win_T *wp; tabpage_T *tp;