Mercurial > vim
changeset 30077:d45ee1f829ba v9.0.0376
patch 9.0.0376: clang warns for dead assignments
Commit: https://github.com/vim/vim/commit/6b085b9d7367e077ca69f4f82ba0f92cc6b6e443
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Sun Sep 4 12:47:21 2022 +0100
patch 9.0.0376: clang warns for dead assignments
Problem: Clang warns for dead assignments.
Solution: Adjust the code. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/11048)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 04 Sep 2022 14:00:03 +0200 |
parents | acda512ad10a |
children | b2f98a810ef8 |
files | src/insexpand.c src/ops.c src/os_unix.c src/userfunc.c src/version.c src/vim9instr.c src/viminfo.c src/xxd/xxd.c |
diffstat | 8 files changed, 14 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/src/insexpand.c +++ b/src/insexpand.c @@ -3121,8 +3121,10 @@ get_complete_info(list_T *what_list, dic ? compl_curr_match->cp_number - 1 : -1); } - // TODO - // if (ret == OK && (what_flag & CI_WHAT_INSERTED)) + if (ret == OK && (what_flag & CI_WHAT_INSERTED)) + { + // TODO + } } /*
--- a/src/ops.c +++ b/src/ops.c @@ -1344,7 +1344,6 @@ op_tilde(oparg_T *oap) pos.col = 0; pos.lnum++; } - ptr = ml_get_buf(curbuf, pos.lnum, FALSE); count = oap->end.col - pos.col + 1; netbeans_removed(curbuf, pos.lnum, pos.col, (long)count); // get the line again, it may have been flushed
--- a/src/os_unix.c +++ b/src/os_unix.c @@ -4522,7 +4522,7 @@ mch_call_shell_terminal( // restore curwin/curbuf and a few other things aucmd_restbuf(&aco); - // only require pressing Enter when redrawing, to avoid that system() gets + // Only require pressing Enter when redrawing, to avoid that system() gets // the hit-enter prompt even though it didn't output anything. if (!RedrawingDisabled) wait_return(TRUE); @@ -5021,7 +5021,6 @@ mch_call_shell_fork( { // finished all the lines, close pipe close(toshell_fd); - toshell_fd = -1; break; } lp = ml_get(lnum); @@ -5399,7 +5398,7 @@ finished: * child already exited. */ if (wait_pid != pid) - wait_pid = wait4pid(pid, &status); + (void)wait4pid(pid, &status); # ifdef FEAT_GUI // Close slave side of pty. Only do this after the child has @@ -6495,7 +6494,7 @@ select_eintr: #ifdef FEAT_JOB_CHANNEL // also call when ret == 0, we may be polling a keep-open channel if (ret >= 0) - ret = channel_select_check(ret, &rfds, &wfds); + (void)channel_select_check(ret, &rfds, &wfds); #endif #endif // HAVE_SELECT
--- a/src/userfunc.c +++ b/src/userfunc.c @@ -312,8 +312,6 @@ get_function_args( // find the end of the expression (doesn't evaluate it) any_default = TRUE; p = skipwhite(p) + 1; - whitep = p; - p = skipwhite(p); expr = p; if (eval1(&p, &rettv, NULL) != FAIL) {
--- a/src/version.c +++ b/src/version.c @@ -704,6 +704,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 376, +/**/ 375, /**/ 374,
--- a/src/vim9instr.c +++ b/src/vim9instr.c @@ -514,10 +514,8 @@ generate_2BOOL(cctx_T *cctx, int invert, int generate_COND2BOOL(cctx_T *cctx) { - isn_T *isn; - RETURN_OK_IF_SKIP(cctx); - if ((isn = generate_instr(cctx, ISN_COND2BOOL)) == NULL) + if (generate_instr(cctx, ISN_COND2BOOL) == NULL) return FAIL; // type becomes bool @@ -741,13 +739,9 @@ generate_PUSHS(cctx_T *cctx, char_u **st int generate_PUSHCHANNEL(cctx_T *cctx) { -#ifdef FEAT_JOB_CHANNEL - isn_T *isn; -#endif - RETURN_OK_IF_SKIP(cctx); #ifdef FEAT_JOB_CHANNEL - if ((isn = generate_instr_type(cctx, ISN_PUSHCHANNEL, &t_channel)) == NULL) + if (generate_instr_type(cctx, ISN_PUSHCHANNEL, &t_channel) == NULL) return FAIL; return OK; #else @@ -762,13 +756,9 @@ generate_PUSHCHANNEL(cctx_T *cctx) int generate_PUSHJOB(cctx_T *cctx) { -#ifdef FEAT_JOB_CHANNEL - isn_T *isn; -#endif - RETURN_OK_IF_SKIP(cctx); #ifdef FEAT_JOB_CHANNEL - if ((isn = generate_instr_type(cctx, ISN_PUSHJOB, &t_job)) == NULL) + if (generate_instr_type(cctx, ISN_PUSHJOB, &t_job) == NULL) return FAIL; return OK; #else @@ -1067,10 +1057,8 @@ generate_UNLET(cctx_T *cctx, isntype_T i int generate_LOCKCONST(cctx_T *cctx) { - isn_T *isn; - RETURN_OK_IF_SKIP(cctx); - if ((isn = generate_instr(cctx, ISN_LOCKCONST)) == NULL) + if (generate_instr(cctx, ISN_LOCKCONST) == NULL) return FAIL; return OK; }
--- a/src/viminfo.c +++ b/src/viminfo.c @@ -2324,7 +2324,7 @@ copy_viminfo_marks( // Read the next line. If it has the "*" mark compare the // time stamps. Write entries from "buflist" that are // newer. - if (!(eof = viminfo_readline(virp)) && line[0] == TAB) + if (!viminfo_readline(virp) && line[0] == TAB) { did_read_line = TRUE; if (line[1] == '*')