Skip to content

Commit e764d1b

Browse files
dpellebrammool
authored andcommitted
patch 9.0.1403: unused variables and functions
Problem: Unused variables and functions. Solution: Delete items and adjust #ifdefs. (Dominique Pellé, closes #12145)
1 parent d13dd30 commit e764d1b

File tree

13 files changed

+38
-26
lines changed

13 files changed

+38
-26
lines changed

runtime/doc/builtin.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2994,7 +2994,7 @@ funcref({name} [, {arglist}] [, {dict}])
29942994
Can also be used as a |method|: >
29952995
GetFuncname()->funcref([arg])
29962996
<
2997-
*function()* *partial* *E700* *E922* *E923*
2997+
*function()* *partial* *E700* *E923*
29982998
function({name} [, {arglist}] [, {dict}])
29992999
Return a |Funcref| variable that refers to function {name}.
30003000
{name} can be the name of a user defined function or an

runtime/doc/vim9.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ function, the function does not need to be defined more than once: >
340340
341341
Variable declarations with :var, :final and :const ~
342342
*vim9-declaration* *:var* *E1079*
343-
*E1017* *E1020* *E1054* *E1087* *E1108* *E1124*
343+
*E1017* *E1020* *E1054* *E1087* *E1124*
344344
Local variables need to be declared with `:var`. Local constants need to be
345345
declared with `:final` or `:const`. We refer to both as "variables" in this
346346
section.
@@ -1664,8 +1664,8 @@ type, it can not be used in Vim9 script.
16641664

16651665
*E1211* *E1217* *E1218* *E1219* *E1220* *E1221*
16661666
*E1222* *E1223* *E1224* *E1225* *E1226* *E1227*
1667-
*E1228* *E1238* *E1250* *E1251* *E1252* *E1253*
1668-
*E1256* *E1297* *E1298* *E1301*
1667+
*E1228* *E1238* *E1250* *E1251* *E1252* *E1256*
1668+
*E1297* *E1298* *E1301*
16691669
Types are checked for most builtin functions to make it easier to spot
16701670
mistakes.
16711671

src/autocmd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2519,6 +2519,7 @@ auto_next_pat(
25192519
}
25202520
}
25212521

2522+
#if defined(FEAT_EVAL) || defined(PROTO)
25222523
/*
25232524
* Get the script context where autocommand "acp" is defined.
25242525
*/
@@ -2527,6 +2528,7 @@ acp_script_ctx(AutoPatCmd_T *acp)
25272528
{
25282529
return &acp->script_ctx;
25292530
}
2531+
#endif
25302532

25312533
/*
25322534
* Get next autocommand command.

src/charset.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,7 @@ vim_isfilec(int c)
907907
return (c >= 0x100 || (c > 0 && (g_chartab[c] & CT_FNAME_CHAR)));
908908
}
909909

910+
#if defined(FEAT_SPELL) || defined(PROTO)
910911
/*
911912
* Return TRUE if 'c' is a valid file-name character, including characters left
912913
* out of 'isfname' to make "gf" work, such as comma, space, '@', etc.
@@ -916,6 +917,7 @@ vim_is_fname_char(int c)
916917
{
917918
return vim_isfilec(c) || c == ',' || c == ' ' || c == '@';
918919
}
920+
#endif
919921

920922
/*
921923
* return TRUE if 'c' is a valid file-name character or a wildcard character

src/errors.h

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,8 +1182,10 @@ EXTERN char e_invalid_command[]
11821182
INIT(= N_("E476: Invalid command"));
11831183
EXTERN char e_invalid_command_str[]
11841184
INIT(= N_("E476: Invalid command: %s"));
1185+
#ifdef FEAT_EVAL
11851186
EXTERN char e_invalid_command_str_expected_str[]
11861187
INIT(= N_("E476: Invalid command: %s, expected %s"));
1188+
#endif
11871189
EXTERN char e_no_bang_allowed[]
11881190
INIT(= N_("E477: No ! allowed"));
11891191
EXTERN char e_dont_panic[]
@@ -1208,8 +1210,10 @@ EXTERN char e_pattern_not_found_str[]
12081210
INIT(= N_("E486: Pattern not found: %s"));
12091211
EXTERN char e_argument_must_be_positive[]
12101212
INIT(= N_("E487: Argument must be positive"));
1213+
#ifdef FEAT_PROP_POPUP
12111214
EXTERN char e_argument_must_be_positive_str[]
12121215
INIT(= N_("E487: Argument must be positive: %s"));
1216+
#endif
12131217
EXTERN char e_trailing_characters[]
12141218
INIT(= N_("E488: Trailing characters"));
12151219
EXTERN char e_trailing_characters_str[]
@@ -1370,10 +1374,12 @@ EXTERN char e_illegal_mode[]
13701374
EXTERN char e_illegal_mouseshape[]
13711375
INIT(= N_("E547: Illegal mouseshape"));
13721376
#endif
1377+
#ifdef CURSOR_SHAPE
13731378
EXTERN char e_digit_expected[]
13741379
INIT(= N_("E548: Digit expected"));
13751380
EXTERN char e_illegal_percentage[]
13761381
INIT(= N_("E549: Illegal percentage"));
1382+
#endif
13771383
#ifdef FEAT_PRINTER
13781384
EXTERN char e_missing_colon_3[]
13791385
INIT(= N_("E550: Missing colon"));
@@ -2039,14 +2045,12 @@ EXTERN char e_id_not_found_nr[]
20392045
EXTERN char e_cannot_use_percent_with_float[]
20402046
// xgettext:no-c-format
20412047
INIT(= N_("E804: Cannot use '%' with Float"));
2042-
#endif
20432048
EXTERN char e_using_float_as_number[]
20442049
INIT(= N_("E805: Using a Float as a Number"));
20452050
EXTERN char e_using_float_as_string[]
20462051
INIT(= N_("E806: Using a Float as a String"));
20472052
EXTERN char e_expected_float_argument_for_printf[]
20482053
INIT(= N_("E807: Expected Float argument for printf()"));
2049-
#if defined(FEAT_EVAL)
20502054
EXTERN char e_number_or_float_required[]
20512055
INIT(= N_("E808: Number or Float required"));
20522056
#endif
@@ -2270,8 +2274,10 @@ EXTERN char e_not_possible_to_change_sign_str[]
22702274
EXTERN char e_cant_rename_viminfo_file_to_str[]
22712275
INIT(= N_("E886: Can't rename viminfo file to %s!"));
22722276
#endif
2277+
#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3)
22732278
EXTERN char e_sorry_this_command_is_disabled_python_side_module_could_not_be_loaded[]
22742279
INIT(= N_("E887: Sorry, this command is disabled, the Python's site module could not be loaded."));
2280+
#endif
22752281
EXTERN char e_nfa_regexp_cannot_repeat_str[]
22762282
INIT(= N_("E888: (NFA regexp) cannot repeat %s"));
22772283
#ifdef FEAT_PROP_POPUP
@@ -2282,6 +2288,7 @@ EXTERN char e_number_required[]
22822288
EXTERN char e_trailing_char_after_rsb_str_str[]
22832289
INIT(= N_("E890: Trailing char after ']': %s]%s"));
22842290
#endif
2291+
#ifdef FEAT_EVAL
22852292
EXTERN char e_using_funcref_as_float[]
22862293
INIT(= N_("E891: Using a Funcref as a Float"));
22872294
EXTERN char e_using_string_as_float[]
@@ -2290,6 +2297,7 @@ EXTERN char e_using_list_as_float[]
22902297
INIT(= N_("E893: Using a List as a Float"));
22912298
EXTERN char e_using_dictionary_as_float[]
22922299
INIT(= N_("E894: Using a Dictionary as a Float"));
2300+
#endif
22932301
#ifdef FEAT_MZSCHEME
22942302
EXTERN char e_sorry_this_command_is_disabled_the_mzscheme_racket_base_module_could_not_be_loaded[]
22952303
INIT(= N_("E895: Sorry, this command is disabled, the MzScheme's racket/base module could not be loaded."));
@@ -2330,9 +2338,9 @@ EXTERN char e_received_unknown_command_str[]
23302338
EXTERN char e_not_an_open_channel[]
23312339
INIT(= N_("E906: Not an open channel"));
23322340
#endif
2341+
#ifdef FEAT_EVAL
23332342
EXTERN char e_using_special_value_as_float[]
23342343
INIT(= N_("E907: Using a special value as a Float"));
2335-
#ifdef FEAT_EVAL
23362344
EXTERN char e_using_invalid_value_as_string_str[]
23372345
INIT(= N_("E908: Using an invalid value as a String: %s"));
23382346
EXTERN char e_cannot_index_special_variable[]
@@ -2367,8 +2375,6 @@ EXTERN char e_io_file_requires_name_to_be_set[]
23672375
#ifdef FEAT_EVAL
23682376
EXTERN char e_invalid_callback_argument[]
23692377
INIT(= N_("E921: Invalid callback argument"));
2370-
EXTERN char e_expected_dict[]
2371-
INIT(= N_("E922: Expected a dict"));
23722378
EXTERN char e_second_argument_of_function_must_be_list_or_dict[]
23732379
INIT(= N_("E923: Second argument of function() must be a list or a dict"));
23742380
#endif
@@ -2831,8 +2837,6 @@ EXTERN char e_nr_arguments_too_many[]
28312837
INIT(= N_("E1106: %d arguments too many"));
28322838
EXTERN char e_string_list_dict_or_blob_required[]
28332839
INIT(= N_("E1107: String, List, Dict or Blob required"));
2834-
EXTERN char e_item_not_found_str[]
2835-
INIT(= N_("E1108: Item not found: %s"));
28362840
EXTERN char e_list_item_nr_is_not_list[]
28372841
INIT(= N_("E1109: List item %d is not a List"));
28382842
EXTERN char e_list_item_nr_does_not_contain_3_numbers[]
@@ -3186,8 +3190,6 @@ EXTERN char e_list_dict_blob_or_string_required_for_argument_nr[]
31863190
INIT(= N_("E1251: List, Dictionary, Blob or String required for argument %d"));
31873191
EXTERN char e_string_list_or_blob_required_for_argument_nr[]
31883192
INIT(= N_("E1252: String, List or Blob required for argument %d"));
3189-
EXTERN char e_string_expected_for_argument_nr[]
3190-
INIT(= N_("E1253: String expected for argument %d"));
31913193
EXTERN char e_cannot_use_script_variable_in_for_loop[]
31923194
INIT(= N_("E1254: Cannot use script variable in for loop"));
31933195
#endif
@@ -3274,13 +3276,15 @@ EXTERN char e_could_not_clear_timeout_str[]
32743276
INIT(= N_("E1285: Could not clear timeout: %s"));
32753277
EXTERN char e_could_not_set_timeout_str[]
32763278
INIT(= N_("E1286: Could not set timeout: %s"));
3279+
#ifndef HAVE_TIMER_CREATE
32773280
EXTERN char e_could_not_set_handler_for_timeout_str[]
32783281
INIT(= N_("E1287: Could not set handler for timeout: %s"));
32793282
EXTERN char e_could_not_reset_handler_for_timeout_str[]
32803283
INIT(= N_("E1288: Could not reset handler for timeout: %s"));
32813284
EXTERN char e_could_not_check_for_pending_sigalrm_str[]
32823285
INIT(= N_("E1289: Could not check for pending SIGALRM: %s"));
32833286
#endif
3287+
#endif
32843288
#ifdef FEAT_EVAL
32853289
EXTERN char e_substitute_nesting_too_deep[]
32863290
INIT(= N_("E1290: substitute nesting too deep"));

src/ex_docmd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3569,6 +3569,7 @@ one_letter_cmd(char_u *p, cmdidx_T *idx)
35693569
return FALSE;
35703570
}
35713571

3572+
#if defined(FEAT_EVAL) || defined(PROTO)
35723573
/*
35733574
* Return TRUE if "cmd" starts with "123->", a number followed by a method
35743575
* call.
@@ -3580,6 +3581,7 @@ number_method(char_u *cmd)
35803581

35813582
return p > cmd && (p = skipwhite(p))[0] == '-' && p[1] == '>';
35823583
}
3584+
#endif
35833585

35843586
/*
35853587
* Find an Ex command by its name, either built-in or user.

src/move.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,7 @@ changed_window_setting_win(win_T *wp)
662662
redraw_win_later(wp, UPD_NOT_VALID);
663663
}
664664

665+
#if defined(FEAT_PROP_POPUP) || defined(PROTO)
665666
/*
666667
* Call changed_window_setting_win() for every window containing "buf".
667668
*/
@@ -675,6 +676,7 @@ changed_window_setting_buf(buf_T *buf)
675676
if (wp->w_buffer == buf)
676677
changed_window_setting_win(wp);
677678
}
679+
#endif
678680

679681
/*
680682
* Set wp->w_topline to a certain number.
@@ -744,6 +746,7 @@ changed_line_abv_curs_win(win_T *wp)
744746
|VALID_CHEIGHT|VALID_TOPLINE);
745747
}
746748

749+
#if defined(FEAT_PROP_POPUP) || defined(PROTO)
747750
/*
748751
* Display of line has changed for "buf", invalidate cursor position and
749752
* w_botline.
@@ -759,6 +762,7 @@ changed_line_display_buf(buf_T *buf)
759762
|VALID_CROW|VALID_CHEIGHT
760763
|VALID_TOPLINE|VALID_BOTLINE|VALID_BOTLINE_AP);
761764
}
765+
#endif
762766

763767
/*
764768
* Make sure the value of curwin->w_botline is valid.
@@ -3573,7 +3577,6 @@ do_check_cursorbind(void)
35733577
int set_curswant = curwin->w_set_curswant;
35743578
win_T *old_curwin = curwin;
35753579
buf_T *old_curbuf = curbuf;
3576-
int restart_edit_save;
35773580
int old_VIsual_select = VIsual_select;
35783581
int old_VIsual_active = VIsual_active;
35793582

@@ -3601,8 +3604,8 @@ do_check_cursorbind(void)
36013604

36023605
// Make sure the cursor is in a valid position. Temporarily set
36033606
// "restart_edit" to allow the cursor to be beyond the EOL.
3604-
restart_edit_save = restart_edit;
3605-
restart_edit = TRUE;
3607+
int restart_edit_save = restart_edit;
3608+
restart_edit = 'a';
36063609
check_cursor();
36073610

36083611
// Avoid a scroll here for the cursor position, 'scrollbind' is

src/option.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5245,15 +5245,6 @@ set_option_flag(int opt_idx, long_u flag)
52455245
options[opt_idx].flags |= flag;
52465246
}
52475247

5248-
/*
5249-
* Clear a flag for the option at 'opt_idx'.
5250-
*/
5251-
void
5252-
clear_option_flag(int opt_idx, long_u flag)
5253-
{
5254-
options[opt_idx].flags &= ~flag;
5255-
}
5256-
52575248
/*
52585249
* Returns TRUE if the option at 'opt_idx' is a global option
52595250
*/

src/optionstr.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,8 @@ set_string_option_direct(
429429
# endif
430430
}
431431

432+
#if defined(FEAT_PROP_POPUP) || \
433+
(defined(FEAT_DIFF) && defined(FEAT_FOLDING)) || defined(PROTO)
432434
/*
433435
* Like set_string_option_direct(), but for a window-local option in "wp".
434436
* Blocks autocommands to avoid the old curwin becoming invalid.
@@ -452,6 +454,7 @@ set_string_option_direct_in_win(
452454
curbuf = curwin->w_buffer;
453455
unblock_autocmds();
454456
}
457+
#endif
455458

456459
#if defined(FEAT_PROP_POPUP) || defined(PROTO)
457460
/*

src/os_unix.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2434,6 +2434,7 @@ vim_is_iris(char_u *name)
24342434
|| STRCMP(name, "builtin_iris-ansi") == 0);
24352435
}
24362436

2437+
#if defined(VMS) || defined(PROTO)
24372438
/*
24382439
* Return TRUE if "name" is a vt300-like terminal name.
24392440
*/
@@ -2448,6 +2449,7 @@ vim_is_vt300(char_u *name)
24482449
&& vim_strchr((char_u *)"12345", name[2]) != NULL)
24492450
|| STRCMP(name, "builtin_vt320") == 0);
24502451
}
2452+
#endif
24512453

24522454
/*
24532455
* Insert user name in s[len].

0 commit comments

Comments
 (0)