]> granicus.if.org Git - vim/commitdiff
patch 9.0.0376: clang warns for dead assignments v9.0.0376
authorYegappan Lakshmanan <yegappan@yahoo.com>
Sun, 4 Sep 2022 11:47:21 +0000 (12:47 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 4 Sep 2022 11:47:21 +0000 (12:47 +0100)
Problem:    Clang warns for dead assignments.
Solution:   Adjust the code. (Yegappan Lakshmanan, closes #11048)

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

index b91c230011d49bf2b712550622ebac65d006a418..f9ee4e6e5e59bf6144c2a2bbe6508bd5ae470010 100644 (file)
@@ -3121,8 +3121,10 @@ get_complete_info(list_T *what_list, dict_T *retdict)
                                      ? 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
+    }
 }
 
 /*
index 5629a1a669ccdc38ff6fbee556ca0aff3b7ff4d5..88d85f8e0b312676d0e7018e7c2d618e35db282e 100644 (file)
--- 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
index 4dadac30af9a43d80c917f0cae0be2059a4687c0..1ac6e190bce1a1c4af20b86b04be56a529ad6994 100644 (file)
@@ -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
index c33ec63f9a91415d694ddbb05d8e7f95bbe85735..0c6f9938f0ad22b6b0dd8e5b57208e4b560edfeb 100644 (file)
@@ -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)
                {
index 1ceb171a3fb2762ec875807150db631e123175a6..1e3f9a3bdf5829eab94cc26dcdb5cf305048a2cb 100644 (file)
@@ -703,6 +703,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    376,
 /**/
     375,
 /**/
index ae4de33f41e37a6b10c4f8aaa41d6791c5d15e27..34d4ae33f39781e92d02730affae9071cb94b228 100644 (file)
@@ -514,10 +514,8 @@ generate_2BOOL(cctx_T *cctx, int invert, int offset)
     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 **str)
     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 isn_type, char_u *name, int forceit)
     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;
 }
index acdf61825f061cd8d3ca4882bff99f3d44256c79..546103e97858aa099a021848f003e95020fd5043 100644 (file)
@@ -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] == '*')
index 8429b98ec5663da3dd6f073fb85c69c6b4d4aa2b..c9e4c4678874f97c5ca3086bed8dda686c49a0ab 100644 (file)
@@ -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",