# HG changeset patch # User Rik # Date 1547741093 28800 # Node ID f8d380d04b01e7db553b383dfede619f19e2b55a # Parent 50439c2e8bbfe2ee9662fc465b6656642e6a1fb5 Fix dead assignments found by clang static analysis (bug #55440). * find.cc (Ffind): Delete "direction = 0;" assignment. * oct-map.cc (octave_fields::equal_up_to_order): Declare, but don't bother to initialize retval. If mismatch is found, return false directly to jump out of loop. * oct-stream.cc (printf_format_list::printf_format_list): Delete "empty_buf = false;" * oct-stream.cc (textscan::scan_complex): delete unnecessary call to is.tellg () to get pos which is never used. * regexp.cc (do_regexp_ptn_string_escapes): Delete "bad_esc_seq = true;". * ov-java.cc (unbox): Delete "found = false;". diff -r 50439c2e8bbf -r f8d380d04b01 libinterp/corefcn/find.cc --- a/libinterp/corefcn/find.cc Wed Jan 16 20:32:15 2019 -0800 +++ b/libinterp/corefcn/find.cc Thu Jan 17 08:04:53 2019 -0800 @@ -408,8 +408,6 @@ int direction = 1; if (nargin > 2) { - direction = 0; - std::string s_arg = args(2).string_value (); if (s_arg == "first") diff -r 50439c2e8bbf -r f8d380d04b01 libinterp/corefcn/oct-map.cc --- a/libinterp/corefcn/oct-map.cc Wed Jan 16 20:32:15 2019 -0800 +++ b/libinterp/corefcn/oct-map.cc Thu Jan 17 08:04:53 2019 -0800 @@ -124,7 +124,7 @@ octave_fields::equal_up_to_order (const octave_fields& other, octave_idx_type *perm) const { - bool retval = true; + bool retval; auto p = begin (); auto q = other.begin (); @@ -133,10 +133,7 @@ if (p->first == q->first) perm[p->second] = q->second; else - { - retval = false; - break; - } + return false; } retval = (p == end () && q == other.end ()); diff -r 50439c2e8bbf -r f8d380d04b01 libinterp/corefcn/oct-stream.cc --- a/libinterp/corefcn/oct-stream.cc Wed Jan 16 20:32:15 2019 -0800 +++ b/libinterp/corefcn/oct-stream.cc Thu Jan 17 08:04:53 2019 -0800 @@ -914,7 +914,6 @@ modifier = '\0'; type = '\0'; buf << s[i++]; - empty_buf = false; } break; } @@ -2993,8 +2992,8 @@ if (! is.eof () && ! as_empty) { - state = is.rdstate (); // before tellg, since that fails at EOF - pos = is.tellg (); + state = is.rdstate (); // before tellg, since that fails at EOF + ch = is.peek (); // ch == EOF if read failed; no need to chk fail if (ch == 'i' || ch == 'j') // pure imaginary { diff -r 50439c2e8bbf -r f8d380d04b01 libinterp/corefcn/regexp.cc --- a/libinterp/corefcn/regexp.cc Wed Jan 16 20:32:15 2019 -0800 +++ b/libinterp/corefcn/regexp.cc Thu Jan 17 08:04:53 2019 -0800 @@ -107,7 +107,6 @@ } if (bad_esc_seq || (brace && s[k++] != '}')) { - bad_esc_seq = true; tmpi = 0; warning (R"(malformed octal escape sequence '\o' -- converting to '\0')"); } diff -r 50439c2e8bbf -r f8d380d04b01 libinterp/octave-value/ov-java.cc --- a/libinterp/octave-value/ov-java.cc Wed Jan 16 20:32:15 2019 -0800 +++ b/libinterp/octave-value/ov-java.cc Thu Jan 17 08:04:53 2019 -0800 @@ -1811,7 +1811,6 @@ } else { - found = false; error ("cannot convert matrix of type '%s'", val.class_name ().c_str ()); }