# HG changeset patch # User Bram Moolenaar # Date 1547995507 -3600 # Node ID d89c5b339c2ad8aae5460f7c3c767539bc2cc91f # Parent 496f146a0836d6b89b81962edc80b3d30a6583d7 patch 8.1.0785: depending on the configuration some functions are unused commit https://github.com/vim/vim/commit/113e10721f42fc2500b63fe95193f8665658a90c Author: Bram Moolenaar Date: Sun Jan 20 15:30:40 2019 +0100 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 --- a/src/buffer.c +++ b/src/buffer.c @@ -5660,6 +5660,7 @@ bt_normal(buf_T *buf) 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 @@ bt_quickfix(buf_T *buf) { 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 @@ bt_terminal(buf_T *buf) { return buf != NULL && buf->b_p_bt[0] == 't'; } +#endif /* * Return TRUE if "buf" is a help buffer. @@ -5721,6 +5725,7 @@ bt_dontwrite(buf_T *buf) || buf->b_p_bt[0] == 'p'); } +#if defined(FEAT_QUICKFIX) || defined(PROTO) int bt_dontwrite_msg(buf_T *buf) { @@ -5731,6 +5736,7 @@ bt_dontwrite_msg(buf_T *buf) } 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 --- a/src/channel.c +++ b/src/channel.c @@ -2750,6 +2750,7 @@ may_invoke_callback(channel_T *channel, 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 @@ channel_can_write_to(channel_T *channel) 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 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -1578,7 +1578,7 @@ timer_free_all() # 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 # endif diff --git a/src/ex_docmd.c b/src/ex_docmd.c --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -12314,6 +12314,7 @@ get_messages_arg(expand_T *xp UNUSED, in } #endif +#if defined(FEAT_CMDL_COMPL) || defined(PROTO) char_u * get_mapclear_arg(expand_T *xp UNUSED, int idx) { @@ -12321,6 +12322,7 @@ get_mapclear_arg(expand_T *xp UNUSED, in return (char_u *)""; return NULL; } +#endif static int filetype_detect = FALSE; static int filetype_plugin = FALSE; diff --git a/src/fileio.c b/src/fileio.c --- a/src/fileio.c +++ b/src/fileio.c @@ -9303,6 +9303,7 @@ has_cursormoved(void) 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 @@ has_cursormovedI(void) { return (first_autopat[(int)EVENT_CURSORMOVEDI] != NULL); } +#endif /* * Return TRUE when there is a TextChanged autocommand defined. @@ -9330,6 +9332,7 @@ has_textchangedI(void) 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 @@ has_textchangedP(void) { return (first_autopat[(int)EVENT_TEXTCHANGEDP] != NULL); } +#endif /* * Return TRUE when there is an InsertCharPre autocommand defined. @@ -9366,6 +9370,7 @@ has_funcundefined(void) 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 @@ has_textyankpost(void) { return (first_autopat[(int)EVENT_TEXTYANKPOST] != NULL); } +#endif /* * Execute autocommands for "event" and file name "fname". @@ -9823,11 +9829,14 @@ unblock_autocmds(void) # 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 @@ get_event_name(expand_T *xp UNUSED, int #endif /* FEAT_CMDL_COMPL */ +#if defined(FEAT_EVAL) || defined(PROTO) /* * Return TRUE if autocmd is supported. */ @@ -10196,6 +10206,7 @@ theend: vim_free(arg_save); return retval; } +#endif /* diff --git a/src/getchar.c b/src/getchar.c --- a/src/getchar.c +++ b/src/getchar.c @@ -413,6 +413,7 @@ stuff_empty(void) && 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 @@ readbuf1_empty(void) { 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 --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -6737,11 +6737,13 @@ clip_mch_set_selection(VimClipboard *cbd { } +#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 --- a/src/hashtab.c +++ b/src/hashtab.c @@ -81,6 +81,7 @@ hash_clear(hashtab_T *ht) 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_all(hashtab_T *ht, int off) } hash_clear(ht); } +#endif /* * Find "key" in hashtable "ht". "key" must not be NULL. @@ -178,6 +180,7 @@ hash_lookup(hashtab_T *ht, char_u *key, } } +#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_debug_results(void) 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 --- a/src/json.c +++ b/src/json.c @@ -54,6 +54,7 @@ json_encode(typval_T *val, int options) 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 @@ json_encode_nr_expr(int nr, typval_T *va 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 @@ json_decode_all(js_read_T *reader, typva 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 @@ json_decode(js_read_T *reader, typval_T 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 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -844,6 +844,7 @@ bomb_size(void) return n; } +#if defined(FEAT_QUICKFIX) || defined(PROTO) /* * Remove all BOM from "s" by moving remaining text. */ @@ -863,6 +864,7 @@ remove_bom(char_u *s) } } } +#endif /* * Get class of pointer: diff --git a/src/message.c b/src/message.c --- a/src/message.c +++ b/src/message.c @@ -3507,12 +3507,14 @@ give_warning(char_u *message, int hl) --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 --- a/src/misc1.c +++ b/src/misc1.c @@ -4672,6 +4672,7 @@ remove_tail(char_u *p, char_u *pend, cha return pend; } +#if defined(FEAT_EVAL) || defined(PROTO) void vim_unsetenv(char_u *var) { @@ -4681,6 +4682,7 @@ vim_unsetenv(char_u *var) vim_setenv(var, (char_u *)""); #endif } +#endif /* diff --git a/src/misc2.c b/src/misc2.c --- a/src/misc2.c +++ b/src/misc2.c @@ -1033,6 +1033,7 @@ theend: /* * 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 @@ lalloc_id(long_u size, int message, allo #endif return (lalloc((long_u)size, message)); } +#endif #if defined(MEM_PROFILE) || defined(PROTO) /* @@ -2135,6 +2137,7 @@ ga_grow(garray_T *gap, int n) 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 @@ ga_concat_strings(garray_T *gap, char *s } return s; } +#endif #if defined(FEAT_VIMINFO) || defined(FEAT_EVAL) || defined(PROTO) /* diff --git a/src/ops.c b/src/ops.c --- a/src/ops.c +++ b/src/ops.c @@ -201,6 +201,7 @@ op_on_lines(int op) return opchars[op][2] & OPF_LINES; } +#if defined(FEAT_JOB_CHANNEL) || defined(PROTO) /* * Return TRUE if operator "op" changes text. */ @@ -209,6 +210,7 @@ op_is_change(int op) { return opchars[op][2] & OPF_CHANGE; } +#endif /* * Get first operator command character. @@ -1050,6 +1052,8 @@ put_register(int name, void *reg) #endif } +#if (defined(FEAT_CLIPBOARD) && defined(FEAT_X11) && defined(USE_SYSTEM)) \ + || defined(PROTO) void free_register(void *reg) { @@ -1061,6 +1065,7 @@ free_register(void *reg) vim_free(reg); *y_current = tmp; } +#endif #if defined(FEAT_MOUSE) || defined(PROTO) /* diff --git a/src/option.c b/src/option.c --- a/src/option.c +++ b/src/option.c @@ -10699,6 +10699,7 @@ comp_col(void) #endif } +#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) || defined(PROTO) /* * Unset local option value, similar to ":set opt<". */ @@ -10800,6 +10801,7 @@ unset_global_local_option(char_u *name, #endif } } +#endif /* * Get pointer to option variable, depending on local or global scope. @@ -13122,6 +13124,7 @@ tabstop_eq(int *ts1, int *ts2) return TRUE; } +#if defined(FEAT_BEVAL) || defined(PROTO) /* * Copy a tabstop array, allocating space for the new array. */ @@ -13140,6 +13143,7 @@ tabstop_copy(int *oldts) return newts; } +#endif /* * Return a count of the number of tabstops. diff --git a/src/os_unix.c b/src/os_unix.c --- a/src/os_unix.c +++ b/src/os_unix.c @@ -1016,7 +1016,7 @@ static volatile sig_atomic_t lc_active I * 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 @@ mch_startjmp(void) 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 --- a/src/proto/os_unix.pro +++ b/src/proto/os_unix.pro @@ -7,9 +7,6 @@ int mch_check_messages(void); 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 --- 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 --- a/src/proto/terminal.pro +++ b/src/proto/terminal.pro @@ -18,7 +18,6 @@ cursorentry_T *term_get_cursor_shape(gui 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 --- a/src/regexp.c +++ b/src/regexp.c @@ -734,16 +734,6 @@ re_multiline(regprog_T *prog) } /* - * Return TRUE if compiled regular expression "prog" looks before the start - * position (pattern contains "\@<=" or "\@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 @@ report_re_switch(char_u *pat) } #endif +#if (defined(FEAT_X11) && (defined(FEAT_TITLE) || defined(FEAT_XCLIPBOARD))) \ + || defined(PROTO) /* * Return whether "prog" is currently being executed. */ @@ -8214,6 +8206,7 @@ regprog_in_use(regprog_T *prog) { return prog->re_in_use; } +#endif /* * Match a regexp against a string. diff --git a/src/screen.c b/src/screen.c --- a/src/screen.c +++ b/src/screen.c @@ -263,6 +263,7 @@ redraw_buf_later(buf_T *buf, int type) } } +#if defined(FEAT_SIGNS) || defined(PROTO) void redraw_buf_line_later(buf_T *buf, linenr_T lnum) { @@ -273,7 +274,9 @@ redraw_buf_line_later(buf_T *buf, linenr && 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 @@ redraw_buf_and_status_later(buf_T *buf, } } } - +#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 @@ redraw_asap(int type) return ret; } +#endif /* * Invoked after an asynchronous callback is called. @@ -929,7 +935,7 @@ conceal_check_cursor_line(void) } #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 @@ number_width(win_T *wp) } #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 @@ screen_screenrow(void) { return screen_cur_row; } +#endif diff --git a/src/search.c b/src/search.c --- a/src/search.c +++ b/src/search.c @@ -476,6 +476,7 @@ pat_has_uppercase(char_u *pat) return FALSE; } +#if defined(FEAT_EVAL) || defined(PROTO) char_u * last_csearch(void) { @@ -510,6 +511,7 @@ set_last_csearch(int c, char_u *s UNUSED 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 --- a/src/syntax.c +++ b/src/syntax.c @@ -8887,6 +8887,7 @@ get_attr_entry(garray_T *table, attrentr 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 @@ get_cterm_attr_idx(int attr, int fg, int at_en.ae_u.cterm.bg_color = bg; return get_attr_entry(&cterm_attr_table, &at_en); } - -#if defined(FEAT_TERMGUICOLORS) || defined(PROTO) +#endif + +#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 @@ get_tgc_attr_idx(int attr, guicolor_T fg } #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 --- a/src/term.c +++ b/src/term.c @@ -2838,6 +2838,7 @@ static int winpos_x = -1; 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 @@ term_get_winpos(int *x, int *y, varnumbe return FALSE; } +# endif # endif void diff --git a/src/terminal.c b/src/terminal.c --- a/src/terminal.c +++ b/src/terminal.c @@ -2307,35 +2307,6 @@ theend: 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 @@ update_system_term(term_T *term) 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 @@ term_send_eof(channel_T *ch) } } +#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 --- a/src/ui.c +++ b/src/ui.c @@ -1589,6 +1589,7 @@ clip_gen_request_selection(VimClipboard #endif } +#if (defined(FEAT_X11) && defined(USE_SYSTEM)) || defined(PROTO) int clip_gen_owner_exists(VimClipboard *cbd UNUSED) { @@ -1603,6 +1604,7 @@ clip_gen_owner_exists(VimClipboard *cbd return TRUE; #endif } +#endif #endif /* FEAT_CLIPBOARD */ @@ -2574,12 +2576,15 @@ clip_x11_set_selection(VimClipboard *cbd { } +#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 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -2560,6 +2560,7 @@ function_exists(char_u *name, int no_der 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 @@ get_expanded_name(char_u *name, int chec vim_free(p); return NULL; } +#endif #if defined(FEAT_PROFILE) || defined(PROTO) /* diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -792,6 +792,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 785, +/**/ 784, /**/ 783,