Mercurial > hg > octave-nkf
changeset 13222:82f3a0c27569
fix warnings for uninitialized variables
* pt-binop.cc (simplify_mul_op, simplify_ldiv_op, simplify_and_or_op):
Initialize retop at declaration.
* hex2num.cc (Fhex2num): Initialize num.ival to zero.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 25 Sep 2011 19:44:04 -0400 |
parents | 410de573089a |
children | 931d4b7dc205 |
files | src/DLD-FUNCTIONS/hex2num.cc src/pt-cbinop.cc |
diffstat | 2 files changed, 11 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/hex2num.cc +++ b/src/DLD-FUNCTIONS/hex2num.cc @@ -76,6 +76,8 @@ double dval; } num; + num.ival = 0; + for (octave_idx_type j = 0; j < nc; j++) { unsigned char ch = cmat.elem (i, j);
--- a/src/pt-cbinop.cc +++ b/src/pt-cbinop.cc @@ -84,7 +84,9 @@ static octave_value::compound_binary_op simplify_mul_op (tree_expression *&a, tree_expression *&b) { - octave_value::compound_binary_op retop; + octave_value::compound_binary_op retop + = octave_value::unknown_compound_binary_op; + octave_value::unary_op opa = strip_trans_herm (a); if (opa == octave_value::op_hermitian) @@ -99,8 +101,6 @@ retop = octave_value::op_mul_herm; else if (opb == octave_value::op_transpose) retop = octave_value::op_mul_trans; - else - retop = octave_value::unknown_compound_binary_op; } return retop; @@ -111,15 +111,15 @@ static octave_value::compound_binary_op simplify_ldiv_op (tree_expression *&a, tree_expression *&) { - octave_value::compound_binary_op retop; + octave_value::compound_binary_op retop + = octave_value::unknown_compound_binary_op; + octave_value::unary_op opa = strip_trans_herm (a); if (opa == octave_value::op_hermitian) retop = octave_value::op_herm_ldiv; else if (opa == octave_value::op_transpose) retop = octave_value::op_trans_ldiv; - else - retop = octave_value::unknown_compound_binary_op; return retop; } @@ -129,7 +129,9 @@ static octave_value::compound_binary_op simplify_and_or_op (tree_expression *&a, tree_expression *&b, octave_value::binary_op op) { - octave_value::compound_binary_op retop; + octave_value::compound_binary_op retop + = octave_value::unknown_compound_binary_op; + octave_value::unary_op opa = strip_not (a); if (opa == octave_value::op_not) @@ -150,8 +152,6 @@ else if (op == octave_value::op_el_or) retop = octave_value::op_el_or_not; } - else - retop = octave_value::unknown_compound_binary_op; } return retop;