Mercurial > octave
changeset 29163:8f67ad8b3103
maint: Updating naming conventions for exceptions and use const where possible.
* GLCanvas.cc, interpreter-qobject.cc, file-editor-tab.cc,
octave-qscintilla.cc, octave-qobject.cc, Cell.cc, __eigs__.cc,
__magick_read__.cc, __qp__.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc,
file-io.cc, graphics.cc, graphics.in.h, input.cc, interpreter.cc,
ls-mat-ascii.cc, lsode.cc, oct-handle.h, oct-map.cc, quad.cc, rand.cc,
sparse.cc, sub2ind.cc, toplev.cc, utils.cc, __init_gnuplot__.cc, __ode15__.cc,
cdef-object.cc, ov-base-diag.cc, ov-base-mat.cc, ov-base-sparse.cc,
ov-base.cc, ov-fcn-handle.cc, ov-java.cc, ov-perm.cc, ov-range.cc,
ov-re-diag.cc, ov-str-mat.cc, ov.cc, pt-assign.cc, pt-eval.cc, pt-idx.cc,
pt-jit.cc, pt.cc, Array-util.cc, randmtzig.cc:
Update naming conventions for exceptions to use initial letter of exception
type. For example, "execution_exception" is named "ee", "index_exception" is
"ie". Catch "const" exceptions where possible.
* gzip.cc: Add block to catch and throw interrupt_exceptions before having
a catch block "(...)" for everything else.
line wrap: on
line diff
--- a/libgui/graphics/GLCanvas.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libgui/graphics/GLCanvas.cc Tue Dec 08 13:25:03 2020 -0800 @@ -191,7 +191,6 @@ ([=] (void) { // INTERPRETER THREAD - throw ee; }); }
--- a/libgui/src/interpreter-qobject.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libgui/src/interpreter-qobject.cc Tue Dec 08 13:25:03 2020 -0800 @@ -87,9 +87,9 @@ exit_status = interp.execute (); } } - catch (const exit_exception& ex) + catch (const exit_exception& xe) { - exit_status = ex.exit_status (); + exit_status = xe.exit_status (); } // Signal that the interpreter is done executing code in the main
--- a/libgui/src/m-editor/file-editor-tab.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libgui/src/m-editor/file-editor-tab.cc Tue Dec 08 13:25:03 2020 -0800 @@ -454,11 +454,11 @@ emit request_add_breakpoint (line, new_cond); } - catch (const execution_exception& e) + catch (const execution_exception& ee) { interp.recover_from_exception (); - msg = e.message (); + msg = ee.message (); eval_error = true; } catch (const interrupt_exception&) @@ -2175,7 +2175,7 @@ { sym = symtab.find_user_function (std_base_name); } - catch (const execution_exception& e) + catch (const execution_exception&) { interp.recover_from_exception ();
--- a/libgui/src/m-editor/octave-qscintilla.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libgui/src/m-editor/octave-qscintilla.cc Tue Dec 08 13:25:03 2020 -0800 @@ -917,14 +917,14 @@ // Do the job interp.source_file (file); } - catch (const execution_exception& e) + catch (const execution_exception& ee) { // Catch errors otherwise the rest of the interpreter // will not be executed (cleaning up). // New error message and error stack - QString new_msg = QString::fromStdString (e.message ()); - std::list<frame_info> stack = e.stack_info (); + QString new_msg = QString::fromStdString (ee.message ()); + std::list<frame_info> stack = ee.stack_info (); // Remove line and column from first line of error message only // if it is related to the tmp itself, i.e. only if the @@ -974,11 +974,11 @@ dbg, auto_repeat); // New exception with updated message and stack - execution_exception ee (e.err_type (),e.identifier (), - new_msg.toStdString (), stack); + execution_exception nee (ee.err_type (), ee.identifier (), + new_msg.toStdString (), stack); // Throw - throw (ee); + throw (nee); } // Clean up
--- a/libgui/src/octave-qobject.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libgui/src/octave-qobject.cc Tue Dec 08 13:25:03 2020 -0800 @@ -137,7 +137,6 @@ ([=] (void) { // INTERPRETER THREAD - throw ee; }); }
--- a/libinterp/corefcn/Cell.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/Cell.cc Tue Dec 08 13:25:03 2020 -0800 @@ -220,10 +220,10 @@ break; } } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos_if_unset (n, k+1); + ie.set_pos_if_unset (n, k+1); throw; } @@ -253,10 +253,10 @@ { ra_idx(i) = idx_arg(i).index_vector (); } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos (len, i+1); + ie.set_pos (len, i+1); throw; } } @@ -277,10 +277,10 @@ { ra_idx.xelem (i) = idx_arg(i).index_vector (); } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos (len, i+1); + ie.set_pos (len, i+1); throw; }
--- a/libinterp/corefcn/__eigs__.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/__eigs__.cc Tue Dec 08 13:25:03 2020 -0800 @@ -71,9 +71,9 @@ { tmp = octave::feval (eigs_fcn, args, 1); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - err_user_supplied_eval (e, "eigs"); + err_user_supplied_eval (ee, "eigs"); } if (tmp.length () && tmp(0).is_defined ()) @@ -111,9 +111,9 @@ { tmp = octave::feval (eigs_fcn, args, 1); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - err_user_supplied_eval (e, "eigs"); + err_user_supplied_eval (ee, "eigs"); } if (tmp.length () && tmp(0).is_defined ())
--- a/libinterp/corefcn/__magick_read__.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/__magick_read__.cc Tue Dec 08 13:25:03 2020 -0800 @@ -765,11 +765,11 @@ { Magick::readImages (&imvec, ascii_fname); } - catch (Magick::Warning& w) + catch (const Magick::Warning& w) { warning ("Magick++ warning: %s", w.what ()); } - catch (Magick::Exception& e) + catch (const Magick::Exception& e) { error ("Magick++ exception: %s", e.what ()); } @@ -1461,15 +1461,15 @@ { Magick::writeImages (imvec.begin (), imvec.end (), ext + ':' + filename); } - catch (Magick::Warning& w) + catch (const Magick::Warning& w) { warning ("Magick++ warning: %s", w.what ()); } - catch (Magick::ErrorCoder& e) + catch (const Magick::ErrorCoder& e) { warning ("Magick++ coder error: %s", e.what ()); } - catch (Magick::Exception& e) + catch (const Magick::Exception& e) { error ("Magick++ exception: %s", e.what ()); } @@ -1705,11 +1705,11 @@ { img.ping (ascii_fname); } - catch (Magick::Warning& w) + catch (const Magick::Warning& w) { warning ("Magick++ warning: %s", w.what ()); } - catch (Magick::Exception& e) + catch (const Magick::Exception& e) { error ("Magick++ exception: %s", e.what ()); } @@ -2384,7 +2384,7 @@ fmt.setfield ("write", Matrix ()); formats.fast_elem_insert (idx, fmt); } - catch (Magick::Exception& e) + catch (const Magick::Exception&) { // Exception here are missing formats. So we remove the format // from the structure and reduce idx.
--- a/libinterp/corefcn/__qp__.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/__qp__.cc Tue Dec 08 13:25:03 2020 -0800 @@ -157,9 +157,9 @@ { eigH = EIG (H); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - error (e, "qp: failed to compute eigenvalues of H"); + error (ee, "qp: failed to compute eigenvalues of H"); } ColumnVector eigenvalH = real (eigH.eigenvalues ()); @@ -298,9 +298,9 @@ { eigrH = EIG (rH); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - error (e, "qp: failed to compute eigenvalues of rH"); + error (ee, "qp: failed to compute eigenvalues of rH"); } ColumnVector eigenvalrH = real (eigrH.eigenvalues ());
--- a/libinterp/corefcn/daspk.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/daspk.cc Tue Dec 08 13:25:03 2020 -0800 @@ -82,9 +82,9 @@ { tmp = octave::feval (daspk_fcn, args, 1); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - err_user_supplied_eval (e, "daspk"); + err_user_supplied_eval (ee, "daspk"); } int tlen = tmp.length (); @@ -132,9 +132,9 @@ { tmp = octave::feval (daspk_jac, args, 1); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - err_user_supplied_eval (e, "daspk"); + err_user_supplied_eval (ee, "daspk"); } int tlen = tmp.length ();
--- a/libinterp/corefcn/dasrt.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/dasrt.cc Tue Dec 08 13:25:03 2020 -0800 @@ -83,9 +83,9 @@ { tmp = octave::feval (dasrt_fcn, args, 1); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - err_user_supplied_eval (e, "dasrt"); + err_user_supplied_eval (ee, "dasrt"); } if (tmp.empty () || ! tmp(0).is_defined ()) @@ -124,9 +124,9 @@ { tmp = octave::feval (dasrt_cf, args, 1); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - err_user_supplied_eval (e, "dasrt"); + err_user_supplied_eval (ee, "dasrt"); } if (tmp.empty () || ! tmp(0).is_defined ()) @@ -170,9 +170,9 @@ { tmp = octave::feval (dasrt_jac, args, 1); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - err_user_supplied_eval (e, "dasrt"); + err_user_supplied_eval (ee, "dasrt"); } int tlen = tmp.length ();
--- a/libinterp/corefcn/dassl.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/dassl.cc Tue Dec 08 13:25:03 2020 -0800 @@ -81,9 +81,9 @@ { tmp = octave::feval (dassl_fcn, args, 1); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - err_user_supplied_eval (e, "dassl"); + err_user_supplied_eval (ee, "dassl"); } int tlen = tmp.length (); @@ -131,9 +131,9 @@ { tmp = octave::feval (dassl_jac, args, 1); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - err_user_supplied_eval (e, "dassl"); + err_user_supplied_eval (ee, "dassl"); } int tlen = tmp.length ();
--- a/libinterp/corefcn/data.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/data.cc Tue Dec 08 13:25:03 2020 -0800 @@ -1648,9 +1648,9 @@ { result = octave::feval (fcn, ovl (ov), 1); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - error (e, "conversion from %s to %s failed", dtype.c_str (), + error (ee, "conversion from %s to %s failed", dtype.c_str (), cname.c_str ()); } @@ -1676,9 +1676,9 @@ { result = octave::feval (fcn, ovl (ov), 1); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - error (e, "%s constructor failed for %s argument", dtype.c_str (), + error (ee, "%s constructor failed for %s argument", dtype.c_str (), cname.c_str ()); } @@ -1715,9 +1715,9 @@ { tmp2 = octave::feval (fcn, ovl, 1); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - error (e, "%s/%s method failed", dtype.c_str (), cattype.c_str ()); + error (ee, "%s/%s method failed", dtype.c_str (), cattype.c_str ()); } if (tmp2.empty ()) @@ -7301,9 +7301,9 @@ err_wrong_type_arg ("nth_element", argx); } } - catch (const octave::index_exception& e) - { - error ("nth_element: invalid index %s", e.what ()); + catch (const octave::index_exception& ie) + { + error ("nth_element: invalid index %s", ie.what ()); } return retval; @@ -7400,9 +7400,9 @@ else err_wrong_type_arg ("accumarray", vals); } - catch (const octave::index_exception& e) - { - error ("__accumarray_sum__: invalid index %s", e.what ()); + catch (const octave::index_exception& ie) + { + error ("__accumarray_sum__: invalid index %s", ie.what ()); } return retval; @@ -7511,9 +7511,9 @@ err_wrong_type_arg ("accumarray", vals); } } - catch (const octave::index_exception& e) - { - error ("do_accumarray_minmax_fun: invalid index %s", e.what ()); + catch (const octave::index_exception& ie) + { + error ("do_accumarray_minmax_fun: invalid index %s", ie.what ()); } return retval; @@ -7618,9 +7618,9 @@ else err_wrong_type_arg ("accumdim", vals); } - catch (const octave::index_exception& e) - { - error ("__accumdim_sum__: invalid index %s", e.what ()); + catch (const octave::index_exception& ie) + { + error ("__accumdim_sum__: invalid index %s", ie.what ()); } return retval;
--- a/libinterp/corefcn/file-io.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/file-io.cc Tue Dec 08 13:25:03 2020 -0800 @@ -2384,9 +2384,9 @@ oct_data_conv::string_to_data_type (prec, block_size, input_type, output_type); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - error (e, "fread: invalid PRECISION specified"); + error (ee, "fread: invalid PRECISION specified"); } int skip = 0; @@ -2395,9 +2395,9 @@ { skip = skip_arg.int_value (true); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - error (e, "fread: SKIP must be an integer"); + error (ee, "fread: SKIP must be an integer"); } std::string arch = arch_arg.xstring_value ("fread: ARCH architecture type must be a string"); @@ -2620,9 +2620,9 @@ { oct_data_conv::string_to_data_type (prec, block_size, output_type); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - error (e, "fwrite: invalid PRECISION specified"); + error (ee, "fwrite: invalid PRECISION specified"); } int skip = 0; @@ -2631,9 +2631,9 @@ { skip = skip_arg.int_value (true); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - error (e, "fwrite: SKIP must be an integer"); + error (ee, "fwrite: SKIP must be an integer"); } std::string arch = arch_arg.xstring_value ("fwrite: ARCH architecture type must be a string");
--- a/libinterp/corefcn/graphics.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/graphics.cc Tue Dec 08 13:25:03 2020 -0800 @@ -1484,9 +1484,9 @@ return true; } } - catch (octave::execution_exception& e) - { - error (e, R"(invalid value for color property "%s" (value = %s))", + catch (octave::execution_exception& ee) + { + error (ee, R"(invalid value for color property "%s" (value = %s))", get_name ().c_str (), s.c_str ()); } } @@ -3322,9 +3322,9 @@ { bgo.set (pname, prop_val.second); } - catch (octave::execution_exception& e) - { - error (e, "error setting default property %s", pname.c_str ()); + catch (octave::execution_exception& ee) + { + error (ee, "error setting default property %s", pname.c_str ()); } } } @@ -12277,9 +12277,9 @@ { m_interpreter.eval_string (s, false, status, 0); } - catch (octave::execution_exception& e) - { - m_interpreter.handle_exception (e); + catch (const octave::execution_exception& ee) + { + m_interpreter.handle_exception (ee); } } else if (cb.iscell () && cb.length () > 0 @@ -12309,9 +12309,9 @@ else octave::feval (fcn, args); } - catch (octave::execution_exception& e) + catch (const octave::execution_exception& ee) { - m_interpreter.handle_exception (e); + m_interpreter.handle_exception (ee); } // Redraw after interacting with a user-interface (ui*) object. @@ -13226,9 +13226,9 @@ h = gh_mgr.make_graphics_handle (go_name, parent, integer_figure_handle, false, false); } - catch (octave::execution_exception& e) - { - error (e, "__go_%s__: unable to create graphics handle", + catch (octave::execution_exception& ee) + { + error (ee, "__go_%s__: unable to create graphics handle", go_name.c_str ()); } @@ -13236,10 +13236,10 @@ { xset (h, xargs); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { delete_graphics_object (h); - error (e, "__go_%s__: unable to create graphics handle", + error (ee, "__go_%s__: unable to create graphics handle", go_name.c_str ()); } @@ -13332,10 +13332,10 @@ { xset (h, xargs); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { delete_graphics_object (h); - error (e, "__go_figure__: unable to create figure handle"); + error (ee, "__go_figure__: unable to create figure handle"); } adopt (0, h);
--- a/libinterp/corefcn/graphics.in.h Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/graphics.in.h Tue Dec 08 13:25:03 2020 -0800 @@ -808,9 +808,9 @@ { nda = val.array_value (); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - error (e, R"(set: invalid string property value for "%s")", + error (ee, R"(set: invalid string property value for "%s")", get_name ().c_str ()); } @@ -1801,9 +1801,9 @@ { new_kids = val.matrix_value (); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - error (e, "set: children must be an array of graphics handles"); + error (ee, "set: children must be an array of graphics handles"); } octave_idx_type nel = new_kids.numel ();
--- a/libinterp/corefcn/input.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/input.cc Tue Dec 08 13:25:03 2020 -0800 @@ -666,11 +666,11 @@ { Fdrawnow (m_interpreter); } - catch (const execution_exception& e) + catch (const execution_exception& ee) { eval_error = true; - m_interpreter.handle_exception (e); + m_interpreter.handle_exception (ee); } flush_stdout ();
--- a/libinterp/corefcn/interpreter.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/interpreter.cc Tue Dec 08 13:25:03 2020 -0800 @@ -353,9 +353,9 @@ return 1; } - catch (const execution_exception& e) + catch (const execution_exception& ee) { - interp.handle_exception (e); + interp.handle_exception (ee); return 1; } @@ -806,9 +806,9 @@ exit_status = main_loop (); } } - catch (const exit_exception& ex) + catch (const exit_exception& xe) { - return ex.exit_status (); + return xe.exit_status (); } return exit_status; @@ -1039,9 +1039,9 @@ { recover_from_exception (); } - catch (const execution_exception& e) + catch (const execution_exception& ee) { - handle_exception (e); + handle_exception (ee); } } @@ -1149,9 +1149,9 @@ return 1; } - catch (const execution_exception& e) + catch (const execution_exception& ee) { - handle_exception (e); + handle_exception (ee); return 1; } @@ -1292,12 +1292,12 @@ if (m_interactive) octave_stdout << "\n"; } - catch (const index_exception& e) + catch (const index_exception& ie) { recover_from_exception (); std::cerr << "error: unhandled index exception: " - << e.message () << " -- trying to return to prompt" + << ie.message () << " -- trying to return to prompt" << std::endl; } catch (const execution_exception& ee) @@ -1971,9 +1971,9 @@ { recover_from_exception (); } - catch (const execution_exception& e) + catch (const execution_exception& ee) { - handle_exception (e); + handle_exception (ee); } } }
--- a/libinterp/corefcn/ls-mat-ascii.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/ls-mat-ascii.cc Tue Dec 08 13:25:03 2020 -0800 @@ -354,7 +354,7 @@ { m = val.matrix_value (true); } - catch (const octave::execution_exception& e) + catch (const octave::execution_exception&) { octave::interpreter& interp = octave::__get_interpreter__ ("save_mat_ascii_data");
--- a/libinterp/corefcn/lsode.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/lsode.cc Tue Dec 08 13:25:03 2020 -0800 @@ -79,9 +79,9 @@ { tmp = octave::feval (lsode_fcn, args, 1); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - err_user_supplied_eval (e, "lsode"); + err_user_supplied_eval (ee, "lsode"); } if (tmp.empty () || ! tmp(0).is_defined ()) @@ -119,9 +119,9 @@ { tmp = octave::feval (lsode_jac, args, 1); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - err_user_supplied_eval (e, "lsode"); + err_user_supplied_eval (ee, "lsode"); } if (tmp.empty () || ! tmp(0).is_defined ())
--- a/libinterp/corefcn/oct-handle.h Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/oct-handle.h Tue Dec 08 13:25:03 2020 -0800 @@ -52,9 +52,9 @@ { val = a.double_value (); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - error (e, "invalid handle"); + error (ee, "invalid handle"); } } }
--- a/libinterp/corefcn/oct-map.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/oct-map.cc Tue Dec 08 13:25:03 2020 -0800 @@ -680,9 +680,9 @@ new_map_list[i], perm); } } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - error (e, "cat: field names mismatch in concatenating structs"); + error (ee, "cat: field names mismatch in concatenating structs"); } } @@ -964,10 +964,10 @@ break; } } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos_if_unset (n_idx, k+1); + ie.set_pos_if_unset (n_idx, k+1); throw; } @@ -1027,9 +1027,9 @@ { rhs1 = rhs.orderfields (*this, perm); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - error (e, "incompatible fields in struct assignment"); + error (ee, "incompatible fields in struct assignment"); } assert (rhs1.xkeys.is_same (xkeys)); @@ -1075,9 +1075,9 @@ { rhs1 = rhs.orderfields (*this, perm); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - error (e, "incompatible fields in struct assignment"); + error (ee, "incompatible fields in struct assignment"); } assert (rhs1.xkeys.is_same (xkeys)); @@ -1123,9 +1123,9 @@ { rhs1 = rhs.orderfields (*this, perm); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - error (e, "incompatible fields in struct assignment"); + error (ee, "incompatible fields in struct assignment"); } assert (rhs1.xkeys.is_same (xkeys)); @@ -1179,10 +1179,10 @@ break; } } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos_if_unset (n_idx, k+1); + ie.set_pos_if_unset (n_idx, k+1); throw; } } @@ -1298,10 +1298,10 @@ { ia(i) = idx(i).index_vector (); } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos_if_unset (n_idx, i+1); + ie.set_pos_if_unset (n_idx, i+1); throw; } }
--- a/libinterp/corefcn/quad.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/quad.cc Tue Dec 08 13:25:03 2020 -0800 @@ -71,9 +71,9 @@ { tmp = octave::feval (quad_fcn, args, 1); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - err_user_supplied_eval (e, "quad"); + err_user_supplied_eval (ee, "quad"); } if (! tmp.length () || ! tmp(0).is_defined ()) @@ -107,9 +107,9 @@ { tmp = octave::feval (quad_fcn, args, 1); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - err_user_supplied_eval (e, "quad"); + err_user_supplied_eval (ee, "quad"); } if (! tmp.length () || ! tmp(0).is_defined ())
--- a/libinterp/corefcn/rand.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/rand.cc Tue Dec 08 13:25:03 2020 -0800 @@ -212,9 +212,9 @@ { iv = tmp.octave_idx_type_vector_value (true); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - error (e, "%s: dimensions must be a scalar or array of integers", fcn); + error (ee, "%s: dimensions must be a scalar or array of integers", fcn); } octave_idx_type len = iv.numel ();
--- a/libinterp/corefcn/sparse.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/sparse.cc Tue Dec 08 13:25:03 2020 -0800 @@ -230,10 +230,10 @@ else err_wrong_type_arg ("sparse", args(2)); } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos_if_unset (2, k+1); + ie.set_pos_if_unset (2, k+1); throw; } }
--- a/libinterp/corefcn/sub2ind.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/sub2ind.cc Tue Dec 08 13:25:03 2020 -0800 @@ -130,12 +130,12 @@ if (j > 0 && args(j+1).dims () != args(1).dims ()) error ("sub2ind: all subscripts must be of the same size"); } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { - e.set_pos_if_unset (nargin-1, j+1); - e.set_var (); - std::string msg = e.message (); - error_with_id (e.err_id (), "%s", msg.c_str ()); + ie.set_pos_if_unset (nargin-1, j+1); + ie.set_var (); + std::string msg = ie.message (); + error_with_id (ie.err_id (), "%s", msg.c_str ()); } } @@ -270,9 +270,9 @@ { retval = Array<octave_value> (ind2sub (dv, args(1).index_vector ())); } - catch (const octave::index_exception& e) + catch (const octave::index_exception& ie) { - error ("ind2sub: invalid index %s", e.what ()); + error ("ind2sub: invalid index %s", ie.what ()); } return retval;
--- a/libinterp/corefcn/toplev.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/toplev.cc Tue Dec 08 13:25:03 2020 -0800 @@ -264,9 +264,9 @@ { return_output = args(1).is_true (); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - error (e, "system: RETURN_OUTPUT must be boolean value true or false"); + error (ee, "system: RETURN_OUTPUT must be boolean value true or false"); } }
--- a/libinterp/corefcn/utils.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/corefcn/utils.cc Tue Dec 08 13:25:03 2020 -0800 @@ -1446,9 +1446,9 @@ retval *= jdx.length (dv(i)); } - catch (const index_exception& e) + catch (const index_exception& ie) { - error ("dims_to_numel: invalid index %s", e.what ()); + error ("dims_to_numel: invalid index %s", ie.what ()); } } }
--- a/libinterp/dldfcn/__init_gnuplot__.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/dldfcn/__init_gnuplot__.cc Tue Dec 08 13:25:03 2020 -0800 @@ -212,7 +212,7 @@ retval = fs.exists (); } } - catch (octave::execution_exception&) + catch (const octave::execution_exception&) { octave::interpreter& interp = octave::__get_interpreter__ ("have_gnuplot_binary");
--- a/libinterp/dldfcn/__ode15__.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/dldfcn/__ode15__.cc Tue Dec 08 13:25:03 2020 -0800 @@ -1027,9 +1027,9 @@ { tmp = feval (ida_fc, ovl (t, x, xdot), 1); } - catch (execution_exception& e) + catch (execution_exception& ee) { - err_user_supplied_eval (e, "__ode15__"); + err_user_supplied_eval (ee, "__ode15__"); } return tmp(0).vector_value (); @@ -1045,9 +1045,9 @@ { tmp = feval (ida_jc, ovl (t, x, xdot), 2); } - catch (execution_exception& e) + catch (execution_exception& ee) { - err_user_supplied_eval (e, "__ode15__"); + err_user_supplied_eval (ee, "__ode15__"); } return tmp(0).matrix_value () + cj * tmp(1).matrix_value (); @@ -1063,9 +1063,9 @@ { tmp = feval (ida_jc, ovl (t, x, xdot), 2); } - catch (execution_exception& e) + catch (execution_exception& ee) { - err_user_supplied_eval (e, "__ode15__"); + err_user_supplied_eval (ee, "__ode15__"); } return tmp(0).sparse_matrix_value () + cj * tmp(1).sparse_matrix_value ();
--- a/libinterp/dldfcn/gzip.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/dldfcn/gzip.cc Tue Dec 08 13:25:03 2020 -0800 @@ -508,13 +508,17 @@ { X::zip (path, dest_path); } + catch (const interrupt_exception&) + { + throw; // interrupts are special, just re-throw. + } catch (...) { // Error "handling" is not including filename on the output list. - // Also remove created file which maybe was not even created + // Also, remove created file which may not have been created // in the first place. Note that it is possible for the file - // to exist in the first place and for X::zip to not have - // clobber it yet but we remove it anyway by design. + // to exist before the call to X::zip and that X::zip has not + // clobber it yet, but we remove it anyway. sys::unlink (dest_path); return; }
--- a/libinterp/octave-value/cdef-object.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/octave-value/cdef-object.cc Tue Dec 08 13:25:03 2020 -0800 @@ -244,10 +244,10 @@ { iv(i) = ival(i).index_vector (); } - catch (index_exception& e) + catch (index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos_if_unset (ival.length (), i+1); + ie.set_pos_if_unset (ival.length (), i+1); throw; } @@ -340,9 +340,9 @@ { iv(i) = ival(i).index_vector (); } - catch (index_exception& e) + catch (index_exception& ie) { - e.set_pos_if_unset (ival.length (), i+1); + ie.set_pos_if_unset (ival.length (), i+1); throw; // var name set in pt-idx.cc / pt-assign.cc } @@ -391,10 +391,10 @@ { iv(i) = ival(i).index_vector (); } - catch (index_exception& e) + catch (index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos_if_unset (ival.length (), i+1); + ie.set_pos_if_unset (ival.length (), i+1); throw; }
--- a/libinterp/octave-value/ov-base-diag.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/octave-value/ov-base-diag.cc Tue Dec 08 13:25:03 2020 -0800 @@ -133,10 +133,10 @@ retval = to_dense ().index_op (idx, resize_ok); } } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos_if_unset (2, k+1); + ie.set_pos_if_unset (2, k+1); throw; } } @@ -197,10 +197,10 @@ dense_cache = octave_value (); } } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos_if_unset (2, k+1); + ie.set_pos_if_unset (2, k+1); throw; } } @@ -225,10 +225,10 @@ dense_cache = octave_value (); } } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos_if_unset (2, k+1); + ie.set_pos_if_unset (2, k+1); throw; } }
--- a/libinterp/octave-value/ov-base-mat.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/octave-value/ov-base-mat.cc Tue Dec 08 13:25:03 2020 -0800 @@ -203,10 +203,10 @@ break; } } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos_if_unset (n_idx, k+1); + ie.set_pos_if_unset (n_idx, k+1); throw; } @@ -271,10 +271,10 @@ break; } } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos_if_unset (n_idx, k+1); + ie.set_pos_if_unset (n_idx, k+1); throw; } @@ -377,10 +377,10 @@ break; } } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos_if_unset (n_idx, k+1); + ie.set_pos_if_unset (n_idx, k+1); throw; }
--- a/libinterp/octave-value/ov-base-sparse.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/octave-value/ov-base-sparse.cc Tue Dec 08 13:25:03 2020 -0800 @@ -96,10 +96,10 @@ error ("sparse indexing needs 1 or 2 indices"); } } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos_if_unset (n_idx, k+1); + ie.set_pos_if_unset (n_idx, k+1); throw; } @@ -221,10 +221,10 @@ error ("sparse indexing needs 1 or 2 indices"); } } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos_if_unset (len, k+1); + ie.set_pos_if_unset (len, k+1); throw; } @@ -273,10 +273,10 @@ error ("sparse indexing needs 1 or 2 indices"); } } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos_if_unset (len, k+1); + ie.set_pos_if_unset (len, k+1); throw; }
--- a/libinterp/octave-value/ov-base.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/octave-value/ov-base.cc Tue Dec 08 13:25:03 2020 -0800 @@ -470,9 +470,9 @@ { \ d = double_value (frc_str_conv); \ } \ - catch (octave::execution_exception& e) \ + catch (octave::execution_exception& ee) \ { \ - err_wrong_type_arg (e, "octave_base_value::" #F "_value ()", type_name ()); \ + err_wrong_type_arg (ee, "octave_base_value::" #F "_value ()", type_name ()); \ } \ \ if (require_int && octave::math::x_nint (d) != d) \ @@ -508,9 +508,9 @@ { d = double_value (frc_str_conv); } - catch (octave::execution_exception& e) + catch (octave::execution_exception& ee) { - err_wrong_type_arg (e, "octave_base_value::nint_value ()", type_name ()); + err_wrong_type_arg (ee, "octave_base_value::nint_value ()", type_name ()); } if (octave::math::isnan (d))
--- a/libinterp/octave-value/ov-fcn-handle.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/octave-value/ov-fcn-handle.cc Tue Dec 08 13:25:03 2020 -0800 @@ -837,7 +837,7 @@ arg_list.clear (); } - catch (index_exception&) + catch (const index_exception&) { err_invalid_fcn_handle (m_name); }
--- a/libinterp/octave-value/ov-java.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/octave-value/ov-java.cc Tue Dec 08 13:25:03 2020 -0800 @@ -1137,10 +1137,10 @@ check_exception (jni_env); } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos_if_unset (idx.length (), i + 1); + ie.set_pos_if_unset (idx.length (), i + 1); throw; } @@ -2018,7 +2018,7 @@ octave_thread_ID = get_current_thread_ID (current_env); } - catch (std::string msg) + catch (const std::string msg) { error ("%s", msg.c_str ()); }
--- a/libinterp/octave-value/ov-perm.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/octave-value/ov-perm.cc Tue Dec 08 13:25:03 2020 -0800 @@ -84,10 +84,10 @@ k = 1; idx1 = idx(1).index_vector (); } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos_if_unset (2, k+1); + ie.set_pos_if_unset (2, k+1); throw; } }
--- a/libinterp/octave-value/ov-range.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/octave-value/ov-range.cc Tue Dec 08 13:25:03 2020 -0800 @@ -263,11 +263,11 @@ else retval = m_range.index (i); } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // More info may be added later before displaying error. - e.set_pos_if_unset (1, 1); + ie.set_pos_if_unset (1, 1); throw; }
--- a/libinterp/octave-value/ov-re-diag.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/octave-value/ov-re-diag.cc Tue Dec 08 13:25:03 2020 -0800 @@ -122,10 +122,10 @@ } } } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos_if_unset (2, k+1); + ie.set_pos_if_unset (2, k+1); throw; } }
--- a/libinterp/octave-value/ov-str-mat.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/octave-value/ov-str-mat.cc Tue Dec 08 13:25:03 2020 -0800 @@ -140,10 +140,10 @@ break; } } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { // Rethrow to allow more info to be reported later. - e.set_pos_if_unset (len, k+1); + ie.set_pos_if_unset (len, k+1); throw; }
--- a/libinterp/octave-value/ov.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/octave-value/ov.cc Tue Dec 08 13:25:03 2020 -0800 @@ -2092,17 +2092,17 @@ { \ retval = FCN (); \ } \ - catch (octave::execution_exception& e) \ + catch (octave::execution_exception& ee) \ { \ if (fmt) \ { \ va_list args; \ va_start (args, fmt); \ - verror (e, fmt, args); \ + verror (ee, fmt, args); \ va_end (args); \ } \ \ - throw e; \ + throw ee; \ } \ \ return retval; \
--- a/libinterp/parse-tree/pt-assign.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/parse-tree/pt-assign.cc Tue Dec 08 13:25:03 2020 -0800 @@ -137,11 +137,11 @@ feval ("display", args); } } - catch (index_exception& e) + catch (index_exception& ie) { - e.set_var (m_lhs->name ()); - std::string msg = e.message (); - error_with_id (e.err_id (), "%s", msg.c_str ()); + ie.set_var (m_lhs->name ()); + std::string msg = ie.message (); + error_with_id (ie.err_id (), "%s", msg.c_str ()); } }
--- a/libinterp/parse-tree/pt-eval.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/parse-tree/pt-eval.cc Tue Dec 08 13:25:03 2020 -0800 @@ -1555,9 +1555,9 @@ file_name, dir_name, "", "", require_file, true, false, false); } - catch (execution_exception& e) + catch (execution_exception& ee) { - error (e, "source: error sourcing file '%s'", + error (ee, "source: error sourcing file '%s'", file_full_name.c_str ()); } } @@ -4325,7 +4325,7 @@ if (expr_result.is_cs_list ()) err_indexed_cs_list (); } - catch (index_exception&) + catch (const index_exception&) { error ("error evaluating partial expression for END"); }
--- a/libinterp/parse-tree/pt-idx.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/parse-tree/pt-idx.cc Tue Dec 08 13:25:03 2020 -0800 @@ -401,9 +401,9 @@ { retval = fcn->call (tw, nargout, first_args); } - catch (index_exception& e) + catch (index_exception& ie) { - tw.final_index_error (e, m_expr); + tw.final_index_error (ie, m_expr); } beg++; @@ -527,9 +527,9 @@ indexing_object = true; } } - catch (index_exception& e) + catch (index_exception& ie) { - tw.final_index_error (e, m_expr); + tw.final_index_error (ie, m_expr); } } } @@ -588,9 +588,9 @@ beg = n; idx_list.clear (); } - catch (index_exception& e) + catch (index_exception& ie) { - tw.final_index_error (e, m_expr); + tw.final_index_error (ie, m_expr); } } else @@ -624,9 +624,9 @@ retval = fcn->call (tw, nargout, final_args); } - catch (index_exception& e) + catch (index_exception& ie) { - tw.final_index_error (e, m_expr); + tw.final_index_error (ie, m_expr); } } }
--- a/libinterp/parse-tree/pt-jit.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/parse-tree/pt-jit.cc Tue Dec 08 13:25:03 2020 -0800 @@ -1365,7 +1365,7 @@ convert (blocks, constants); } - catch (const jit_fail_exception& e) + catch (const jit_fail_exception&) { m_function->eraseFromParent (); throw; @@ -1411,7 +1411,7 @@ convert (blocks, constants); } - catch (const jit_fail_exception& e) + catch (const jit_fail_exception&) { m_function->eraseFromParent (); throw; @@ -2596,14 +2596,14 @@ m_function = reinterpret_cast<jited_function> (void_fn); } } - catch (const jit_fail_exception& e) + catch (const jit_fail_exception& jfe) { m_argument_types.clear (); if (Vdebug_jit) { - if (e.known ()) - octave_stdout << "jit fail: " << e.what () << std::endl; + if (jfe.known ()) + octave_stdout << "jit fail: " << jfe.what () << std::endl; } Vjit_failcnt++; @@ -2772,16 +2772,15 @@ m_bounds = conv.get_bounds (); } - catch (const jit_fail_exception& e) + catch (const jit_fail_exception& jfe) { if (Vdebug_jit) { - if (e.known ()) - octave_stdout << "jit fail: " << e.what () << std::endl; + if (jfe.known ()) + octave_stdout << "jit fail: " << jfe.what () << std::endl; } Vjit_failcnt++; - } if (llvm_function)
--- a/libinterp/parse-tree/pt.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/libinterp/parse-tree/pt.cc Tue Dec 08 13:25:03 2020 -0800 @@ -91,13 +91,13 @@ else warning ("Error parsing breakpoint condition"); } - catch (const execution_exception& e) + catch (const execution_exception& ee) { interpreter& interp = tw.get_interpreter (); interp.recover_from_exception (); - std::string tmp = e.message (); + std::string tmp = ee.message (); warning ("Error evaluating breakpoint condition:\n %s", tmp.c_str ());
--- a/liboctave/array/Array-util.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/liboctave/array/Array-util.cc Tue Dec 08 13:25:03 2020 -0800 @@ -561,13 +561,13 @@ if (idx.extent (n) > n) octave::err_index_out_of_range (len, i+1, idx.extent (n), n, dv); } - catch (octave::index_exception& e) + catch (octave::index_exception& ie) { - e.set_pos_if_unset (len, i+1); - e.set_var (); - std::string msg = e.message (); + ie.set_pos_if_unset (len, i+1); + ie.set_var (); + std::string msg = ie.message (); (*current_liboctave_error_with_id_handler) - (e.err_id (), "%s", msg.c_str ()); + (ie.err_id (), "%s", msg.c_str ()); } } // idxa known to be valid.
--- a/liboctave/numeric/randmtzig.cc Tue Dec 08 21:34:55 2020 +0100 +++ b/liboctave/numeric/randmtzig.cc Tue Dec 08 13:25:03 2020 -0800 @@ -297,7 +297,7 @@ while (n < n_max) entropy[n++] = dist (rd); } - catch (std::exception& e) + catch (const std::exception&) { // Just ignore any exception and skip that source of entropy. }