To: vim_dev@googlegroups.com Subject: Patch 9.0.1403 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.1403 Problem: Unused variables and functions. Solution: Delete items and adjust #ifdefs. (Dominique Pellé, closes #12145) Files: runtime/doc/builtin.txt, runtime/doc/vim9.txt, src/autocmd.c, src/charset.c, src/errors.h, src/ex_docmd.c, src/move.c, src/option.c, src/proto/option.pro, src/optionstr.c, src/os_unix.c, src/regexp.c *** ../vim-9.0.1402/runtime/doc/builtin.txt 2023-03-09 22:06:45.903407145 +0000 --- runtime/doc/builtin.txt 2023-03-12 21:12:21.997439099 +0000 *************** *** 2995,3001 **** Can also be used as a |method|: > GetFuncname()->funcref([arg]) < ! *function()* *partial* *E700* *E922* *E923* function({name} [, {arglist}] [, {dict}]) Return a |Funcref| variable that refers to function {name}. {name} can be the name of a user defined function or an --- 2994,3000 ---- Can also be used as a |method|: > GetFuncname()->funcref([arg]) < ! *function()* *partial* *E700* *E923* function({name} [, {arglist}] [, {dict}]) Return a |Funcref| variable that refers to function {name}. {name} can be the name of a user defined function or an *** ../vim-9.0.1402/runtime/doc/vim9.txt 2022-12-04 20:11:12.791828025 +0000 --- runtime/doc/vim9.txt 2023-03-12 21:12:21.997439099 +0000 *************** *** 340,346 **** Variable declarations with :var, :final and :const ~ *vim9-declaration* *:var* *E1079* ! *E1017* *E1020* *E1054* *E1087* *E1108* *E1124* Local variables need to be declared with `:var`. Local constants need to be declared with `:final` or `:const`. We refer to both as "variables" in this section. --- 340,346 ---- Variable declarations with :var, :final and :const ~ *vim9-declaration* *:var* *E1079* ! *E1017* *E1020* *E1054* *E1087* *E1124* Local variables need to be declared with `:var`. Local constants need to be declared with `:final` or `:const`. We refer to both as "variables" in this section. *************** *** 1659,1666 **** *E1211* *E1217* *E1218* *E1219* *E1220* *E1221* *E1222* *E1223* *E1224* *E1225* *E1226* *E1227* ! *E1228* *E1238* *E1250* *E1251* *E1252* *E1253* ! *E1256* *E1297* *E1298* *E1301* Types are checked for most builtin functions to make it easier to spot mistakes. --- 1666,1673 ---- *E1211* *E1217* *E1218* *E1219* *E1220* *E1221* *E1222* *E1223* *E1224* *E1225* *E1226* *E1227* ! *E1228* *E1238* *E1250* *E1251* *E1252* *E1256* ! *E1297* *E1298* *E1301* Types are checked for most builtin functions to make it easier to spot mistakes. *** ../vim-9.0.1402/src/autocmd.c 2023-02-04 10:58:28.815703377 +0000 --- src/autocmd.c 2023-03-12 21:12:21.997439099 +0000 *************** *** 2519,2524 **** --- 2519,2525 ---- } } + #if defined(FEAT_EVAL) || defined(PROTO) /* * Get the script context where autocommand "acp" is defined. */ *************** *** 2527,2532 **** --- 2528,2534 ---- { return &acp->script_ctx; } + #endif /* * Get next autocommand command. *** ../vim-9.0.1402/src/charset.c 2023-03-04 20:47:32.300617854 +0000 --- src/charset.c 2023-03-12 21:12:21.997439099 +0000 *************** *** 907,912 **** --- 907,913 ---- return (c >= 0x100 || (c > 0 && (g_chartab[c] & CT_FNAME_CHAR))); } + #if defined(FEAT_SPELL) || defined(PROTO) /* * Return TRUE if 'c' is a valid file-name character, including characters left * out of 'isfname' to make "gf" work, such as comma, space, '@', etc. *************** *** 916,921 **** --- 917,923 ---- { return vim_isfilec(c) || c == ',' || c == ' ' || c == '@'; } + #endif /* * return TRUE if 'c' is a valid file-name character or a wildcard character *** ../vim-9.0.1402/src/errors.h 2023-03-03 15:05:26.780832735 +0000 --- src/errors.h 2023-03-12 21:12:21.997439099 +0000 *************** *** 1182,1189 **** --- 1182,1191 ---- INIT(= N_("E476: Invalid command")); EXTERN char e_invalid_command_str[] INIT(= N_("E476: Invalid command: %s")); + #ifdef FEAT_EVAL EXTERN char e_invalid_command_str_expected_str[] INIT(= N_("E476: Invalid command: %s, expected %s")); + #endif EXTERN char e_no_bang_allowed[] INIT(= N_("E477: No ! allowed")); EXTERN char e_dont_panic[] *************** *** 1208,1215 **** --- 1210,1219 ---- INIT(= N_("E486: Pattern not found: %s")); EXTERN char e_argument_must_be_positive[] INIT(= N_("E487: Argument must be positive")); + #ifdef FEAT_PROP_POPUP EXTERN char e_argument_must_be_positive_str[] INIT(= N_("E487: Argument must be positive: %s")); + #endif EXTERN char e_trailing_characters[] INIT(= N_("E488: Trailing characters")); EXTERN char e_trailing_characters_str[] *************** *** 1370,1379 **** --- 1374,1385 ---- EXTERN char e_illegal_mouseshape[] INIT(= N_("E547: Illegal mouseshape")); #endif + #ifdef CURSOR_SHAPE EXTERN char e_digit_expected[] INIT(= N_("E548: Digit expected")); EXTERN char e_illegal_percentage[] INIT(= N_("E549: Illegal percentage")); + #endif #ifdef FEAT_PRINTER EXTERN char e_missing_colon_3[] INIT(= N_("E550: Missing colon")); *************** *** 2039,2052 **** EXTERN char e_cannot_use_percent_with_float[] // xgettext:no-c-format INIT(= N_("E804: Cannot use '%' with Float")); - #endif EXTERN char e_using_float_as_number[] INIT(= N_("E805: Using a Float as a Number")); EXTERN char e_using_float_as_string[] INIT(= N_("E806: Using a Float as a String")); EXTERN char e_expected_float_argument_for_printf[] INIT(= N_("E807: Expected Float argument for printf()")); - #if defined(FEAT_EVAL) EXTERN char e_number_or_float_required[] INIT(= N_("E808: Number or Float required")); #endif --- 2045,2056 ---- *************** *** 2270,2277 **** --- 2274,2283 ---- EXTERN char e_cant_rename_viminfo_file_to_str[] INIT(= N_("E886: Can't rename viminfo file to %s!")); #endif + #if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) EXTERN char e_sorry_this_command_is_disabled_python_side_module_could_not_be_loaded[] INIT(= N_("E887: Sorry, this command is disabled, the Python's site module could not be loaded.")); + #endif EXTERN char e_nfa_regexp_cannot_repeat_str[] INIT(= N_("E888: (NFA regexp) cannot repeat %s")); #ifdef FEAT_PROP_POPUP *************** *** 2282,2287 **** --- 2288,2294 ---- EXTERN char e_trailing_char_after_rsb_str_str[] INIT(= N_("E890: Trailing char after ']': %s]%s")); #endif + #ifdef FEAT_EVAL EXTERN char e_using_funcref_as_float[] INIT(= N_("E891: Using a Funcref as a Float")); EXTERN char e_using_string_as_float[] *************** *** 2290,2295 **** --- 2297,2303 ---- INIT(= N_("E893: Using a List as a Float")); EXTERN char e_using_dictionary_as_float[] INIT(= N_("E894: Using a Dictionary as a Float")); + #endif #ifdef FEAT_MZSCHEME EXTERN char e_sorry_this_command_is_disabled_the_mzscheme_racket_base_module_could_not_be_loaded[] INIT(= N_("E895: Sorry, this command is disabled, the MzScheme's racket/base module could not be loaded.")); *************** *** 2330,2338 **** EXTERN char e_not_an_open_channel[] INIT(= N_("E906: Not an open channel")); #endif EXTERN char e_using_special_value_as_float[] INIT(= N_("E907: Using a special value as a Float")); - #ifdef FEAT_EVAL EXTERN char e_using_invalid_value_as_string_str[] INIT(= N_("E908: Using an invalid value as a String: %s")); EXTERN char e_cannot_index_special_variable[] --- 2338,2346 ---- EXTERN char e_not_an_open_channel[] INIT(= N_("E906: Not an open channel")); #endif + #ifdef FEAT_EVAL EXTERN char e_using_special_value_as_float[] INIT(= N_("E907: Using a special value as a Float")); EXTERN char e_using_invalid_value_as_string_str[] INIT(= N_("E908: Using an invalid value as a String: %s")); EXTERN char e_cannot_index_special_variable[] *************** *** 2367,2374 **** #ifdef FEAT_EVAL EXTERN char e_invalid_callback_argument[] INIT(= N_("E921: Invalid callback argument")); - EXTERN char e_expected_dict[] - INIT(= N_("E922: Expected a dict")); EXTERN char e_second_argument_of_function_must_be_list_or_dict[] INIT(= N_("E923: Second argument of function() must be a list or a dict")); #endif --- 2375,2380 ---- *************** *** 2831,2838 **** INIT(= N_("E1106: %d arguments too many")); EXTERN char e_string_list_dict_or_blob_required[] INIT(= N_("E1107: String, List, Dict or Blob required")); - EXTERN char e_item_not_found_str[] - INIT(= N_("E1108: Item not found: %s")); EXTERN char e_list_item_nr_is_not_list[] INIT(= N_("E1109: List item %d is not a List")); EXTERN char e_list_item_nr_does_not_contain_3_numbers[] --- 2837,2842 ---- *************** *** 3186,3193 **** INIT(= N_("E1251: List, Dictionary, Blob or String required for argument %d")); EXTERN char e_string_list_or_blob_required_for_argument_nr[] INIT(= N_("E1252: String, List or Blob required for argument %d")); - EXTERN char e_string_expected_for_argument_nr[] - INIT(= N_("E1253: String expected for argument %d")); EXTERN char e_cannot_use_script_variable_in_for_loop[] INIT(= N_("E1254: Cannot use script variable in for loop")); #endif --- 3190,3195 ---- *************** *** 3274,3279 **** --- 3276,3282 ---- INIT(= N_("E1285: Could not clear timeout: %s")); EXTERN char e_could_not_set_timeout_str[] INIT(= N_("E1286: Could not set timeout: %s")); + #ifndef HAVE_TIMER_CREATE EXTERN char e_could_not_set_handler_for_timeout_str[] INIT(= N_("E1287: Could not set handler for timeout: %s")); EXTERN char e_could_not_reset_handler_for_timeout_str[] *************** *** 3281,3286 **** --- 3284,3290 ---- EXTERN char e_could_not_check_for_pending_sigalrm_str[] INIT(= N_("E1289: Could not check for pending SIGALRM: %s")); #endif + #endif #ifdef FEAT_EVAL EXTERN char e_substitute_nesting_too_deep[] INIT(= N_("E1290: substitute nesting too deep")); *** ../vim-9.0.1402/src/ex_docmd.c 2023-03-11 13:55:49.191639723 +0000 --- src/ex_docmd.c 2023-03-12 21:12:22.001439094 +0000 *************** *** 3569,3574 **** --- 3569,3575 ---- return FALSE; } + #if defined(FEAT_EVAL) || defined(PROTO) /* * Return TRUE if "cmd" starts with "123->", a number followed by a method * call. *************** *** 3580,3585 **** --- 3581,3587 ---- return p > cmd && (p = skipwhite(p))[0] == '-' && p[1] == '>'; } + #endif /* * Find an Ex command by its name, either built-in or user. *** ../vim-9.0.1402/src/move.c 2023-03-01 17:55:26.979125724 +0000 --- src/move.c 2023-03-12 21:12:22.001439094 +0000 *************** *** 662,667 **** --- 662,668 ---- redraw_win_later(wp, UPD_NOT_VALID); } + #if defined(FEAT_PROP_POPUP) || defined(PROTO) /* * Call changed_window_setting_win() for every window containing "buf". */ *************** *** 675,680 **** --- 676,682 ---- if (wp->w_buffer == buf) changed_window_setting_win(wp); } + #endif /* * Set wp->w_topline to a certain number. *************** *** 744,749 **** --- 746,752 ---- |VALID_CHEIGHT|VALID_TOPLINE); } + #if defined(FEAT_PROP_POPUP) || defined(PROTO) /* * Display of line has changed for "buf", invalidate cursor position and * w_botline. *************** *** 759,764 **** --- 762,768 ---- |VALID_CROW|VALID_CHEIGHT |VALID_TOPLINE|VALID_BOTLINE|VALID_BOTLINE_AP); } + #endif /* * Make sure the value of curwin->w_botline is valid. *************** *** 3573,3579 **** int set_curswant = curwin->w_set_curswant; win_T *old_curwin = curwin; buf_T *old_curbuf = curbuf; - int restart_edit_save; int old_VIsual_select = VIsual_select; int old_VIsual_active = VIsual_active; --- 3577,3582 ---- *************** *** 3601,3608 **** // Make sure the cursor is in a valid position. Temporarily set // "restart_edit" to allow the cursor to be beyond the EOL. ! restart_edit_save = restart_edit; ! restart_edit = TRUE; check_cursor(); // Avoid a scroll here for the cursor position, 'scrollbind' is --- 3604,3611 ---- // Make sure the cursor is in a valid position. Temporarily set // "restart_edit" to allow the cursor to be beyond the EOL. ! int restart_edit_save = restart_edit; ! restart_edit = 'a'; check_cursor(); // Avoid a scroll here for the cursor position, 'scrollbind' is *** ../vim-9.0.1402/src/option.c 2023-03-07 17:45:07.188247898 +0000 --- src/option.c 2023-03-12 21:12:22.001439094 +0000 *************** *** 5246,5260 **** } /* - * Clear a flag for the option at 'opt_idx'. - */ - void - clear_option_flag(int opt_idx, long_u flag) - { - options[opt_idx].flags &= ~flag; - } - - /* * Returns TRUE if the option at 'opt_idx' is a global option */ int --- 5246,5251 ---- *** ../vim-9.0.1402/src/proto/option.pro 2023-03-04 19:57:28.342671183 +0000 --- src/proto/option.pro 2023-03-12 21:12:22.001439094 +0000 *************** *** 94,100 **** char_u *option_iter_next(void **option, int opt_type); long_u get_option_flags(int opt_idx); void set_option_flag(int opt_idx, long_u flag); - void clear_option_flag(int opt_idx, long_u flag); int is_global_option(int opt_idx); int is_global_local_option(int opt_idx); int is_window_local_option(int opt_idx); --- 94,99 ---- *** ../vim-9.0.1402/src/optionstr.c 2023-03-07 17:45:07.188247898 +0000 --- src/optionstr.c 2023-03-12 21:12:22.001439094 +0000 *************** *** 429,434 **** --- 429,436 ---- # endif } + #if defined(FEAT_PROP_POPUP) || \ + (defined(FEAT_DIFF) && defined(FEAT_FOLDING)) || defined(PROTO) /* * Like set_string_option_direct(), but for a window-local option in "wp". * Blocks autocommands to avoid the old curwin becoming invalid. *************** *** 452,457 **** --- 454,460 ---- curbuf = curwin->w_buffer; unblock_autocmds(); } + #endif #if defined(FEAT_PROP_POPUP) || defined(PROTO) /* *** ../vim-9.0.1402/src/os_unix.c 2023-03-07 17:13:47.313107772 +0000 --- src/os_unix.c 2023-03-12 21:17:08.193310409 +0000 *************** *** 2434,2439 **** --- 2434,2440 ---- || STRCMP(name, "builtin_iris-ansi") == 0); } + #if defined(VMS) || defined(PROTO) /* * Return TRUE if "name" is a vt300-like terminal name. */ *************** *** 2448,2453 **** --- 2449,2455 ---- && vim_strchr((char_u *)"12345", name[2]) != NULL) || STRCMP(name, "builtin_vt320") == 0); } + #endif /* * Insert user name in s[len]. *** ../vim-9.0.1402/src/regexp.c 2023-01-18 18:17:43.865053454 +0000 --- src/regexp.c 2023-03-12 21:12:22.001439094 +0000 *************** *** 2948,2953 **** --- 2948,2954 ---- return result > 0; } + #if defined(FEAT_SPELL) || defined(FEAT_EVAL) || defined(FEAT_X11) || defined(PROTO) /* * Note: "*prog" may be freed and changed. * Return TRUE if there is a match, FALSE if not. *************** *** 2968,2973 **** --- 2969,2975 ---- *prog = regmatch.regprog; return r; } + #endif /* * Note: "rmp->regprog" may be freed and changed. *** ../vim-9.0.1402/src/version.c 2023-03-11 20:56:30.664063864 +0000 --- src/version.c 2023-03-12 21:11:47.297460822 +0000 *************** *** 697,698 **** --- 697,700 ---- { /* Add new patch number below this line */ + /**/ + 1403, /**/ -- hundred-and-one symptoms of being an internet addict: 269. You wonder how you can make your dustbin produce Sesame Street's Oscar's the Garbage Monster song when you empty it. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///