patch 8.1.0785: depending on the configuration some functions are unused
Problem: Depending on the configuration some functions are unused.
Solution: Add more #ifdefs, remove unused functions. (Dominique Pelle,
closes #3822)
diff --git a/src/buffer.c b/src/buffer.c
index 18e08ad..33df710 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -5660,6 +5660,7 @@
return buf != NULL && buf->b_p_bt[0] == NUL;
}
+#if defined(FEAT_QUICKFIX) || defined(PROTO)
/*
* Return TRUE if "buf" is the quickfix buffer.
*/
@@ -5668,7 +5669,9 @@
{
return buf != NULL && buf->b_p_bt[0] == 'q';
}
+#endif
+#if defined(FEAT_TERMINAL) || defined(PROTO)
/*
* Return TRUE if "buf" is a terminal buffer.
*/
@@ -5677,6 +5680,7 @@
{
return buf != NULL && buf->b_p_bt[0] == 't';
}
+#endif
/*
* Return TRUE if "buf" is a help buffer.
@@ -5721,6 +5725,7 @@
|| buf->b_p_bt[0] == 'p');
}
+#if defined(FEAT_QUICKFIX) || defined(PROTO)
int
bt_dontwrite_msg(buf_T *buf)
{
@@ -5731,6 +5736,7 @@
}
return FALSE;
}
+#endif
/*
* Return TRUE if the buffer should be hidden, according to 'hidden', ":hide"
diff --git a/src/channel.c b/src/channel.c
index f6ffcd6..41d19f5 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -2750,6 +2750,7 @@
return TRUE;
}
+#if defined(FEAT_NETBEANS_INTG) || defined(PROTO)
/*
* Return TRUE when channel "channel" is open for writing to.
* Also returns FALSE or invalid "channel".
@@ -2760,6 +2761,7 @@
return channel != NULL && (channel->CH_SOCK_FD != INVALID_FD
|| channel->CH_IN_FD != INVALID_FD);
}
+#endif
/*
* Return TRUE when channel "channel" is open for reading or writing.
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 72d28c5..9fe22a3 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -1578,7 +1578,7 @@
# endif
# endif
-#if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME) && defined(FEAT_FLOAT)
+#if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME) && defined(FEAT_FLOAT) && defined(FEAT_PROFILE)
# if defined(HAVE_MATH_H)
# include <math.h>
# endif
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 8a9b2f4..4722edd 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -12314,6 +12314,7 @@
}
#endif
+#if defined(FEAT_CMDL_COMPL) || defined(PROTO)
char_u *
get_mapclear_arg(expand_T *xp UNUSED, int idx)
{
@@ -12321,6 +12322,7 @@
return (char_u *)"<buffer>";
return NULL;
}
+#endif
static int filetype_detect = FALSE;
static int filetype_plugin = FALSE;
diff --git a/src/fileio.c b/src/fileio.c
index 168c26e..dfe1ef9 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -9303,6 +9303,7 @@
return (first_autopat[(int)EVENT_CURSORMOVED] != NULL);
}
+#if defined(FEAT_CONCEAL) || defined(PROTO)
/*
* Return TRUE when there is a CursorMovedI autocommand defined.
*/
@@ -9311,6 +9312,7 @@
{
return (first_autopat[(int)EVENT_CURSORMOVEDI] != NULL);
}
+#endif
/*
* Return TRUE when there is a TextChanged autocommand defined.
@@ -9330,6 +9332,7 @@
return (first_autopat[(int)EVENT_TEXTCHANGEDI] != NULL);
}
+#if defined(FEAT_INS_EXPAND) || defined(PROTO)
/*
* Return TRUE when there is a TextChangedP autocommand defined.
*/
@@ -9338,6 +9341,7 @@
{
return (first_autopat[(int)EVENT_TEXTCHANGEDP] != NULL);
}
+#endif
/*
* Return TRUE when there is an InsertCharPre autocommand defined.
@@ -9366,6 +9370,7 @@
return (first_autopat[(int)EVENT_FUNCUNDEFINED] != NULL);
}
+#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Return TRUE when there is a TextYankPost autocommand defined.
*/
@@ -9374,6 +9379,7 @@
{
return (first_autopat[(int)EVENT_TEXTYANKPOST] != NULL);
}
+#endif
/*
* Execute autocommands for "event" and file name "fname".
@@ -9823,11 +9829,14 @@
# endif
}
+#if defined(FEAT_EVAL) && (defined(FEAT_XIM) || defined(IME_WITHOUT_XIM)) \
+ || defined(PROTO)
int
is_autocmd_blocked(void)
{
return autocmd_blocked != 0;
}
+#endif
/*
* Find next autocommand pattern that matches.
@@ -10088,6 +10097,7 @@
#endif /* FEAT_CMDL_COMPL */
+#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Return TRUE if autocmd is supported.
*/
@@ -10196,6 +10206,7 @@
vim_free(arg_save);
return retval;
}
+#endif
/*
diff --git a/src/getchar.c b/src/getchar.c
index c0cfd92..0f81979 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -413,6 +413,7 @@
&& readbuf2.bh_first.b_next == NULL);
}
+#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Return TRUE if readbuf1 is empty. There may still be redo characters in
* redbuf2.
@@ -422,6 +423,7 @@
{
return (readbuf1.bh_first.b_next == NULL);
}
+#endif
/*
* Set a typeahead character that won't be flushed.
diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index beec291..6882733 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -6737,11 +6737,13 @@
{
}
+#if (defined(FEAT_XCLIPBOARD) && defined(USE_SYSTEM)) || defined(PROTO)
int
clip_gtk_owner_exists(VimClipboard *cbd)
{
return gdk_selection_owner_get(cbd->gtk_sel_atom) != NULL;
}
+#endif
#if defined(FEAT_MENU) || defined(PROTO)
diff --git a/src/hashtab.c b/src/hashtab.c
index bc86a07..6f2c2ca 100644
--- a/src/hashtab.c
+++ b/src/hashtab.c
@@ -81,6 +81,7 @@
vim_free(ht->ht_array);
}
+#if defined(FEAT_SPELL) || defined(PROTO)
/*
* Free the array of a hash table and all the keys it contains. The keys must
* have been allocated. "off" is the offset from the start of the allocate
@@ -103,6 +104,7 @@
}
hash_clear(ht);
}
+#endif
/*
* Find "key" in hashtable "ht". "key" must not be NULL.
@@ -178,6 +180,7 @@
}
}
+#if defined(FEAT_EVAL) || defined(FEAT_SYN_HL) || defined(PROTO)
/*
* Print the efficiency of hashtable lookups.
* Useful when trying different hash algorithms.
@@ -194,6 +197,7 @@
hash_count_perturb * 100 / hash_count_lookup);
#endif
}
+#endif
/*
* Add item with key "key" to hashtable "ht".
diff --git a/src/json.c b/src/json.c
index ff66411..6ed11ad 100644
--- a/src/json.c
+++ b/src/json.c
@@ -54,6 +54,7 @@
return ga.ga_data;
}
+#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
/*
* Encode ["nr", "val"] into a JSON format string in allocated memory.
* "options" can contain JSON_JS, JSON_NO_NONE and JSON_NL.
@@ -83,6 +84,7 @@
list_unref(listtv.vval.v_list);
return ga.ga_data;
}
+#endif
static void
write_string(garray_T *gap, char_u *str)
@@ -1082,6 +1084,7 @@
return OK;
}
+#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
/*
* Decode the JSON from "reader" and store the result in "res".
* "options" can be JSON_JS or zero;
@@ -1102,6 +1105,7 @@
return ret;
}
+#endif
/*
* Decode the JSON from "reader" to find the end of the message.
diff --git a/src/mbyte.c b/src/mbyte.c
index b6758a1..f33841c 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -844,6 +844,7 @@
return n;
}
+#if defined(FEAT_QUICKFIX) || defined(PROTO)
/*
* Remove all BOM from "s" by moving remaining text.
*/
@@ -863,6 +864,7 @@
}
}
}
+#endif
/*
* Get class of pointer:
diff --git a/src/message.c b/src/message.c
index 0c3b532..1a7ec28 100644
--- a/src/message.c
+++ b/src/message.c
@@ -3507,12 +3507,14 @@
--no_wait_return;
}
+#if defined(FEAT_EVAL) || defined(PROTO)
void
give_warning2(char_u *message, char_u *a1, int hl)
{
vim_snprintf((char *)IObuff, IOSIZE, (char *)message, a1);
give_warning(IObuff, hl);
}
+#endif
/*
* Advance msg cursor to column "col".
diff --git a/src/misc1.c b/src/misc1.c
index 4c9bd2f..f75ea81 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -4672,6 +4672,7 @@
return pend;
}
+#if defined(FEAT_EVAL) || defined(PROTO)
void
vim_unsetenv(char_u *var)
{
@@ -4681,6 +4682,7 @@
vim_setenv(var, (char_u *)"");
#endif
}
+#endif
/*
diff --git a/src/misc2.c b/src/misc2.c
index 214a3a2..b1cf8b5 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -1033,6 +1033,7 @@
/*
* lalloc() with an ID for alloc_fail().
*/
+#if defined(FEAT_SIGNS) || defined(PROTO)
char_u *
lalloc_id(long_u size, int message, alloc_id_T id UNUSED)
{
@@ -1042,6 +1043,7 @@
#endif
return (lalloc((long_u)size, message));
}
+#endif
#if defined(MEM_PROFILE) || defined(PROTO)
/*
@@ -2135,6 +2137,7 @@
return OK;
}
+#if defined(FEAT_EVAL) || defined(FEAT_SEARCHPATH) || defined(PROTO)
/*
* For a growing array that contains a list of strings: concatenate all the
* strings with a separating "sep".
@@ -2170,6 +2173,7 @@
}
return s;
}
+#endif
#if defined(FEAT_VIMINFO) || defined(FEAT_EVAL) || defined(PROTO)
/*
diff --git a/src/ops.c b/src/ops.c
index 9ee2339..4b1040f 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -201,6 +201,7 @@
return opchars[op][2] & OPF_LINES;
}
+#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
/*
* Return TRUE if operator "op" changes text.
*/
@@ -209,6 +210,7 @@
{
return opchars[op][2] & OPF_CHANGE;
}
+#endif
/*
* Get first operator command character.
@@ -1050,6 +1052,8 @@
#endif
}
+#if (defined(FEAT_CLIPBOARD) && defined(FEAT_X11) && defined(USE_SYSTEM)) \
+ || defined(PROTO)
void
free_register(void *reg)
{
@@ -1061,6 +1065,7 @@
vim_free(reg);
*y_current = tmp;
}
+#endif
#if defined(FEAT_MOUSE) || defined(PROTO)
/*
diff --git a/src/option.c b/src/option.c
index 3be4447..8deac53 100644
--- a/src/option.c
+++ b/src/option.c
@@ -10699,6 +10699,7 @@
#endif
}
+#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) || defined(PROTO)
/*
* Unset local option value, similar to ":set opt<".
*/
@@ -10800,6 +10801,7 @@
#endif
}
}
+#endif
/*
* Get pointer to option variable, depending on local or global scope.
@@ -13122,6 +13124,7 @@
return TRUE;
}
+#if defined(FEAT_BEVAL) || defined(PROTO)
/*
* Copy a tabstop array, allocating space for the new array.
*/
@@ -13140,6 +13143,7 @@
return newts;
}
+#endif
/*
* Return a count of the number of tabstops.
diff --git a/src/os_unix.c b/src/os_unix.c
index 242d60e..0a26829 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -1016,7 +1016,7 @@
* Returns OK for normal return, FAIL when the protected code caused a
* problem and LONGJMP() was used.
*/
- void
+ static void
mch_startjmp(void)
{
#ifdef SIGHASARG
@@ -1025,13 +1025,13 @@
lc_active = TRUE;
}
- void
+ static void
mch_endjmp(void)
{
lc_active = FALSE;
}
- void
+ static void
mch_didjmp(void)
{
# if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK)
diff --git a/src/proto/os_unix.pro b/src/proto/os_unix.pro
index 262a8d5..224fe98 100644
--- a/src/proto/os_unix.pro
+++ b/src/proto/os_unix.pro
@@ -7,9 +7,6 @@
long_u mch_total_mem(int special);
void mch_delay(long msec, int ignoreinput);
int mch_stackcheck(char *p);
-void mch_startjmp(void);
-void mch_endjmp(void);
-void mch_didjmp(void);
void mch_suspend(void);
void mch_init(void);
void reset_signals(void);
diff --git a/src/proto/regexp.pro b/src/proto/regexp.pro
index a33fdd9..490bda4 100644
--- a/src/proto/regexp.pro
+++ b/src/proto/regexp.pro
@@ -1,6 +1,5 @@
/* regexp.c */
int re_multiline(regprog_T *prog);
-int re_lookbehind(regprog_T *prog);
char_u *skip_regexp(char_u *startp, int dirc, int magic, char_u **newp);
int vim_regcomp_had_eol(void);
void free_regexp_stuff(void);
diff --git a/src/proto/terminal.pro b/src/proto/terminal.pro
index 1031876..a318fc8 100644
--- a/src/proto/terminal.pro
+++ b/src/proto/terminal.pro
@@ -18,7 +18,6 @@
int term_use_loop(void);
void term_win_entered(void);
int terminal_loop(int blocking);
-void term_job_ended(job_T *job);
void term_channel_closed(channel_T *ch);
void term_check_channel_closed_recently(void);
int term_do_update_window(win_T *wp);
diff --git a/src/regexp.c b/src/regexp.c
index accd10c..71bcd6c 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -734,16 +734,6 @@
}
/*
- * Return TRUE if compiled regular expression "prog" looks before the start
- * position (pattern contains "\@<=" or "\@<!").
- */
- int
-re_lookbehind(regprog_T *prog)
-{
- return (prog->regflags & RF_LOOKBH);
-}
-
-/*
* Check for an equivalence class name "[=a=]". "pp" points to the '['.
* Returns a character representing the class. Zero means that no item was
* recognized. Otherwise "pp" is advanced to after the item.
@@ -8206,6 +8196,8 @@
}
#endif
+#if (defined(FEAT_X11) && (defined(FEAT_TITLE) || defined(FEAT_XCLIPBOARD))) \
+ || defined(PROTO)
/*
* Return whether "prog" is currently being executed.
*/
@@ -8214,6 +8206,7 @@
{
return prog->re_in_use;
}
+#endif
/*
* Match a regexp against a string.
diff --git a/src/screen.c b/src/screen.c
index 4a8fce2..62f9bd1 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -263,6 +263,7 @@
}
}
+#if defined(FEAT_SIGNS) || defined(PROTO)
void
redraw_buf_line_later(buf_T *buf, linenr_T lnum)
{
@@ -273,7 +274,9 @@
&& lnum < wp->w_botline)
redrawWinline(wp, lnum);
}
+#endif
+#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
void
redraw_buf_and_status_later(buf_T *buf, int type)
{
@@ -294,7 +297,9 @@
}
}
}
+#endif
+#if defined(FEAT_TERMRESPONSE) || defined(PROTO)
/*
* Redraw as soon as possible. When the command line is not scrolled redraw
* right away and restore what was on the command line.
@@ -439,6 +444,7 @@
return ret;
}
+#endif
/*
* Invoked after an asynchronous callback is called.
@@ -929,7 +935,7 @@
}
#endif
-#if defined(FEAT_SIGNS) || defined(PROTO)
+#if defined(FEAT_NETBEANS_INTG) || defined(PROTO)
void
update_debug_sign(buf_T *buf, linenr_T lnum)
{
@@ -11294,6 +11300,7 @@
}
#endif
+#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Return the current cursor column. This is the actual position on the
* screen. First column is 0.
@@ -11313,3 +11320,4 @@
{
return screen_cur_row;
}
+#endif
diff --git a/src/search.c b/src/search.c
index f62858c..94b1ef1 100644
--- a/src/search.c
+++ b/src/search.c
@@ -476,6 +476,7 @@
return FALSE;
}
+#if defined(FEAT_EVAL) || defined(PROTO)
char_u *
last_csearch(void)
{
@@ -510,6 +511,7 @@
vim_memset(lastc_bytes, 0, sizeof(lastc_bytes));
#endif
}
+#endif
void
set_csearch_direction(int cdir)
diff --git a/src/syntax.c b/src/syntax.c
index 4e1d450..b48ca00 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -8887,6 +8887,7 @@
return (table->ga_len - 1 + ATTR_OFF);
}
+#if defined(FEAT_TERMINAL) || defined(PROTO)
/*
* Get an attribute index for a cterm entry.
* Uses an existing entry when possible or adds one when needed.
@@ -8906,8 +8907,9 @@
at_en.ae_u.cterm.bg_color = bg;
return get_attr_entry(&cterm_attr_table, &at_en);
}
+#endif
-#if defined(FEAT_TERMGUICOLORS) || defined(PROTO)
+#if (defined(FEAT_TERMINAL) && defined(FEAT_TERMGUICOLORS)) || defined(PROTO)
/*
* Get an attribute index for a 'termguicolors' entry.
* Uses an existing entry when possible or adds one when needed.
@@ -8935,7 +8937,7 @@
}
#endif
-#if defined(FEAT_GUI) || defined(PROTO)
+#if (defined(FEAT_TERMINAL) && defined(FEAT_GUI)) || defined(PROTO)
/*
* Get an attribute index for a cterm entry.
* Uses an existing entry when possible or adds one when needed.
diff --git a/src/term.c b/src/term.c
index e48b16e..5180868 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2838,6 +2838,7 @@
static int winpos_y = -1;
static int did_request_winpos = 0;
+# if (defined(FEAT_EVAL) && defined(HAVE_TGETENT)) || defined(PROTO)
/*
* Try getting the Vim window position from the terminal.
* Returns OK or FAIL.
@@ -2885,6 +2886,7 @@
return FALSE;
}
+# endif
# endif
void
diff --git a/src/terminal.c b/src/terminal.c
index 09b6072..d485b74 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -2307,35 +2307,6 @@
return ret;
}
-/*
- * Called when a job has finished.
- * This updates the title and status, but does not close the vterm, because
- * there might still be pending output in the channel.
- */
- void
-term_job_ended(job_T *job)
-{
- term_T *term;
- int did_one = FALSE;
-
- for (term = first_term; term != NULL; term = term->tl_next)
- if (term->tl_job == job)
- {
- VIM_CLEAR(term->tl_title);
- VIM_CLEAR(term->tl_status_text);
- redraw_buf_and_status_later(term->tl_buffer, VALID);
- did_one = TRUE;
- }
- if (did_one)
- redraw_statuslines();
- if (curbuf->b_term != NULL)
- {
- if (curbuf->b_term->tl_job == job)
- maketitle();
- update_cursor(curbuf->b_term, TRUE);
- }
-}
-
static void
may_toggle_cursor(term_T *term)
{
@@ -3072,7 +3043,7 @@
p_more = FALSE;
msg_row = Rows - 1;
- msg_puts((char_u *)"\n");
+ msg_puts("\n");
p_more = save_p_more;
--term->tl_toprow;
}
@@ -5408,11 +5379,13 @@
}
}
+#if defined(FEAT_GUI) || defined(PROTO)
job_T *
term_getjob(term_T *term)
{
return term != NULL ? term->tl_job : NULL;
}
+#endif
# if defined(WIN3264) || defined(PROTO)
diff --git a/src/ui.c b/src/ui.c
index 5451570..f931124 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -1589,6 +1589,7 @@
#endif
}
+#if (defined(FEAT_X11) && defined(USE_SYSTEM)) || defined(PROTO)
int
clip_gen_owner_exists(VimClipboard *cbd UNUSED)
{
@@ -1603,6 +1604,7 @@
return TRUE;
#endif
}
+#endif
#endif /* FEAT_CLIPBOARD */
@@ -2574,12 +2576,15 @@
{
}
+#if (defined(FEAT_X11) && defined(FEAT_XCLIPBOARD) && defined(USE_SYSTEM)) \
+ || defined(PROTO)
int
clip_x11_owner_exists(VimClipboard *cbd)
{
return XGetSelectionOwner(X_DISPLAY, cbd->sel_atom) != None;
}
#endif
+#endif
#if defined(FEAT_XCLIPBOARD) || defined(FEAT_GUI_X11) \
|| defined(FEAT_GUI_GTK) || defined(PROTO)
diff --git a/src/userfunc.c b/src/userfunc.c
index 49c34c1..6887c2c 100644
--- a/src/userfunc.c
+++ b/src/userfunc.c
@@ -2560,6 +2560,7 @@
return n;
}
+#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) || defined(PROTO)
char_u *
get_expanded_name(char_u *name, int check)
{
@@ -2575,6 +2576,7 @@
vim_free(p);
return NULL;
}
+#endif
#if defined(FEAT_PROFILE) || defined(PROTO)
/*
diff --git a/src/version.c b/src/version.c
index 90f4296..0ef836e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -792,6 +792,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 785,
+/**/
784,
/**/
783,