# HG changeset patch # User Bram Moolenaar # Date 1662292803 -7200 # Node ID d45ee1f829ba17f5eb2de1b9f97c937880484b04 # Parent acda512ad10abf868f6185cb3d29c35c47635143 patch 9.0.0376: clang warns for dead assignments Commit: https://github.com/vim/vim/commit/6b085b9d7367e077ca69f4f82ba0f92cc6b6e443 Author: Yegappan Lakshmanan 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) diff --git a/src/insexpand.c b/src/insexpand.c --- 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 + } } /* diff --git a/src/ops.c b/src/ops.c --- 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 diff --git a/src/os_unix.c b/src/os_unix.c --- 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 diff --git a/src/userfunc.c b/src/userfunc.c --- 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) { diff --git a/src/version.c b/src/version.c --- 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, diff --git a/src/vim9instr.c b/src/vim9instr.c --- 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; } diff --git a/src/viminfo.c b/src/viminfo.c --- 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] == '*') diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c --- a/src/xxd/xxd.c +++ b/src/xxd/xxd.c @@ -782,7 +782,6 @@ main(int argc, char *argv[]) } p = 0; - c = 0; while ((length < 0 || p < length) && (c = getc_or_die(fp)) != EOF) { FPRINTF_OR_DIE((fpo, (hexx == hexxa) ? "%s0x%02x" : "%s0X%02X",