Mercurial > octave
changeset 26566:f8d380d04b01 stable
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;".
author | Rik <rik@octave.org> |
---|---|
date | Thu, 17 Jan 2019 08:04:53 -0800 |
parents | 50439c2e8bbf |
children | bf05a7c16e9e |
files | libinterp/corefcn/find.cc libinterp/corefcn/oct-map.cc libinterp/corefcn/oct-stream.cc libinterp/corefcn/regexp.cc libinterp/octave-value/ov-java.cc |
diffstat | 5 files changed, 4 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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")
--- 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 ());
--- 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 {
--- 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')"); }