Mercurial > octave
changeset 21743:f4d7d0eb5b0c
use namespace for unwind_protect class
* unwind-prot.h, unwind-prot.cc: Put unwind_protect in octave
namespace. Change all uses.
line wrap: on
line diff
--- a/examples/code/unwinddemo.cc Thu May 19 08:42:55 2016 -0700 +++ b/examples/code/unwinddemo.cc Thu May 19 12:56:47 2016 -0400 @@ -23,7 +23,7 @@ // Declare unwind_protect frame which lasts as long as // the variable frame has scope. - unwind_protect frame; + octave::unwind_protect frame; frame.add_fcn (set_liboctave_warning_handler, current_liboctave_warning_handler);
--- a/libgui/src/m-editor/file-editor-tab.cc Thu May 19 08:42:55 2016 -0700 +++ b/libgui/src/m-editor/file-editor-tab.cc Thu May 19 12:56:47 2016 -0400 @@ -375,7 +375,7 @@ try { // Suppress error messages on the console. - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (buffer_error_messages); buffer_error_messages++;
--- a/libinterp/corefcn/cellfun.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/cellfun.cc Thu May 19 12:56:47 2016 -0400 @@ -540,7 +540,7 @@ } } - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (buffer_error_messages); if (error_handler.is_defined ()) @@ -1222,7 +1222,7 @@ } } - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (buffer_error_messages); if (error_handler.is_defined ())
--- a/libinterp/corefcn/daspk.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/daspk.cc Thu May 19 12:56:47 2016 -0400 @@ -264,7 +264,7 @@ octave_value_list retval (4); - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (call_depth); call_depth++;
--- a/libinterp/corefcn/dasrt.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/dasrt.cc Thu May 19 12:56:47 2016 -0400 @@ -342,7 +342,7 @@ octave_value_list retval (5); - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (call_depth); call_depth++;
--- a/libinterp/corefcn/dassl.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/dassl.cc Thu May 19 12:56:47 2016 -0400 @@ -265,7 +265,7 @@ octave_value_list retval (4); - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (call_depth); call_depth++;
--- a/libinterp/corefcn/debug.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/debug.cc Thu May 19 12:56:47 2016 -0400 @@ -1851,7 +1851,7 @@ octave_value_list retval; - unwind_protect frame; + octave::unwind_protect frame; octave_idx_type curr_frame = -1;
--- a/libinterp/corefcn/dynamic-ld.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/dynamic-ld.cc Thu May 19 12:56:47 2016 -0400 @@ -247,7 +247,7 @@ { octave_function *retval = 0; - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (octave_dynamic_loader::doing_load); @@ -301,7 +301,7 @@ { octave_function *retval = 0; - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (octave_dynamic_loader::doing_load);
--- a/libinterp/corefcn/error.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/error.cc Thu May 19 12:56:47 2016 -0400 @@ -318,7 +318,7 @@ || (Vdebug_on_caught && bp_table::debug_on_caught (last_error_id ()))) && octave_call_stack::caller_user_code ()) { - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (Vdebug_on_error); Vdebug_on_error = false; @@ -723,7 +723,7 @@ if ((interactive || forced_interactive) && Vdebug_on_warning && in_user_code && bp_table::debug_on_warn (id)) { - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (Vdebug_on_warning); Vdebug_on_warning = false; @@ -2156,7 +2156,7 @@ } void -interpreter_try (unwind_protect& frame) +interpreter_try (octave::unwind_protect& frame) { frame.protect_var (buffer_error_messages); frame.protect_var (Vdebug_on_error);
--- a/libinterp/corefcn/error.h Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/error.h Thu May 19 12:56:47 2016 -0400 @@ -28,9 +28,10 @@ #include <cstdarg> #include <string> +#include "unwind-prot.h" + class octave_map; class octave_value_list; -class unwind_protect; class octave_execution_exception; #define panic_impossible() \ @@ -170,6 +171,6 @@ extern OCTINTERP_API std::string last_warning_message (void); extern OCTINTERP_API std::string last_warning_id (void); -extern OCTINTERP_API void interpreter_try (unwind_protect&); +extern OCTINTERP_API void interpreter_try (octave::unwind_protect&); #endif
--- a/libinterp/corefcn/gl2ps-print.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/gl2ps-print.cc Thu May 19 12:56:47 2016 -0400 @@ -162,7 +162,7 @@ if (! in_draw) { - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (in_draw); @@ -789,7 +789,7 @@ FILE *fp = 0; - unwind_protect frame; + octave::unwind_protect frame; if (have_cmd) {
--- a/libinterp/corefcn/graphics.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/graphics.cc Thu May 19 12:56:47 2016 -0400 @@ -1658,7 +1658,7 @@ void callback_property::execute (const octave_value& data) const { - unwind_protect frame; + octave::unwind_protect frame; // We are executing the callback function associated with this // callback property. When set to true, we avoid recursive calls to @@ -2666,7 +2666,7 @@ delete_graphics_objects (const NDArray vals) { // Prevent redraw of partially deleted objects. - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (delete_executing); delete_executing = true; @@ -3197,7 +3197,7 @@ // ask whether it is OK to delete the listener for the given // property. How can we know in advance that it will be OK? - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (discard_error_messages); frame.protect_var (Vdebug_on_error); @@ -5506,7 +5506,7 @@ zPlaneN = (zPlane == z_min ? z_max : z_min); fz = (z_max - z_min) / sqrt (dir(0)*dir(0) + dir(1)*dir(1)); - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (updating_axes_layout); updating_axes_layout = true; @@ -5652,7 +5652,7 @@ bool is_empty = xlabel_props.get_string ().is_empty (); - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (updating_xlabel_position); updating_xlabel_position = true; @@ -5753,7 +5753,7 @@ bool is_empty = ylabel_props.get_string ().is_empty (); - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (updating_ylabel_position); updating_ylabel_position = true; @@ -5864,7 +5864,7 @@ bool camAuto = cameraupvectormode_is ("auto"); bool is_empty = zlabel_props.get_string ().is_empty (); - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (updating_zlabel_position); updating_zlabel_position = true; @@ -5985,7 +5985,7 @@ text::properties& title_props = reinterpret_cast<text::properties&> (go.get_properties ()); - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (updating_title_position); updating_title_position = true; @@ -6139,7 +6139,7 @@ if (modified_limits) { - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (updating_aspectratios); updating_aspectratios.insert (get___myhandle__ ().value ()); @@ -7265,7 +7265,7 @@ #undef FIX_LIMITS - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (updating_axis_limits); updating_axis_limits.insert (get_handle ().value ()); @@ -7426,7 +7426,7 @@ } - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (updating_axis_limits); updating_axis_limits.insert (get_handle ().value ()); @@ -8169,7 +8169,7 @@ // FIXME: shouldn't we update facevertexalphadata here ? - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (updating_patch_data); updating_patch_data = true; @@ -8273,7 +8273,7 @@ } - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (updating_patch_data); updating_patch_data = true; @@ -8497,7 +8497,7 @@ get_children_limits (min_val, max_val, min_pos, max_neg, kids, update_type); - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (updating_hggroup_limits); updating_hggroup_limits = true; @@ -8586,7 +8586,7 @@ update_type = 'a'; } - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (updating_hggroup_limits); updating_hggroup_limits = true; @@ -9303,7 +9303,7 @@ else args(1) = Matrix (); - unwind_protect_safe frame; + octave::unwind_protect_safe frame; frame.add_fcn (gh_manager::restore_gcbo); if (true) @@ -10724,7 +10724,7 @@ if (args.length () > 3) print_usage (); - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (Vdrawnow_requested, false); frame.protect_var (drawnow_executing); @@ -11263,7 +11263,7 @@ caseless_str pname; - unwind_protect frame; + octave::unwind_protect frame; static uint32_t id_counter = 0; uint32_t id = 0;
--- a/libinterp/corefcn/input.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/input.cc Thu May 19 12:56:47 2016 -0400 @@ -524,7 +524,7 @@ static void get_debug_input (const std::string& prompt) { - unwind_protect frame; + octave::unwind_protect frame; bool silent = tree_evaluator::quiet_breakpoint_flag; tree_evaluator::quiet_breakpoint_flag = false; @@ -864,7 +864,7 @@ assert (nargin == 0 || nargin == 1); - unwind_protect frame; + octave::unwind_protect frame; frame.add_fcn (command_history::ignore_entries, command_history::ignoring_entries ()); @@ -914,7 +914,7 @@ if (args.length () > 1) print_usage (); - unwind_protect frame; + octave::unwind_protect frame; frame.add_fcn (octave_call_stack::restore_frame, octave_call_stack::current_frame ());
--- a/libinterp/corefcn/load-path.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/load-path.cc Thu May 19 12:56:47 2016 -0400 @@ -680,7 +680,7 @@ // Temporarily disable add hook. - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (add_hook); add_hook = 0; @@ -2207,7 +2207,7 @@ if (! octave_interpreter_ready) return; - unwind_protect frame; + octave::unwind_protect frame; std::string file = octave::sys::file_ops::concat (dir, script_file);
--- a/libinterp/corefcn/ls-mat4.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/ls-mat4.cc Thu May 19 12:56:47 2016 -0400 @@ -449,7 +449,7 @@ if (tc.is_string ()) { - unwind_protect frame; + octave::unwind_protect frame; charMatrix chm = tc.char_matrix_value ();
--- a/libinterp/corefcn/ls-mat5.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/ls-mat5.cc Thu May 19 12:56:47 2016 -0400 @@ -974,7 +974,7 @@ tc2 = m2.contents ("MCOS").cell_value ()(1 + off).cell_value ()(1); m2 = tc2.scalar_map_value (); - unwind_protect_safe frame; + octave::unwind_protect_safe frame; // Set up temporary scope to use for evaluating the text // that defines the anonymous function.
--- a/libinterp/corefcn/lsode.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/lsode.cc Thu May 19 12:56:47 2016 -0400 @@ -265,7 +265,7 @@ warned_fcn_imaginary = false; warned_jac_imaginary = false; - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (call_depth); call_depth++;
--- a/libinterp/corefcn/mex.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/mex.cc Thu May 19 12:56:47 2016 -0400 @@ -2986,7 +2986,7 @@ for (int i = 0; i < nout; i++) argout[i] = 0; - unwind_protect_safe frame; + octave::unwind_protect_safe frame; // Save old mex pointer. frame.protect_var (mex_context); @@ -3218,7 +3218,7 @@ { // FIXME: should this be in variables.cc? - unwind_protect frame; + octave::unwind_protect frame; bool caller = ! strcmp (space, "caller"); bool base = ! strcmp (space, "base"); @@ -3278,7 +3278,7 @@ { // FIXME: should this be in variables.cc? - unwind_protect frame; + octave::unwind_protect frame; bool caller = ! strcmp (space, "caller"); bool base = ! strcmp (space, "base");
--- a/libinterp/corefcn/oct-hist.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/oct-hist.cc Thu May 19 12:56:47 2016 -0400 @@ -134,7 +134,7 @@ { bool numbered_output = nargout == 0; - unwind_protect frame; + octave::unwind_protect frame; string_vector hlist; @@ -496,7 +496,7 @@ // Turn on command echo, so the output from this will make better // sense. - unwind_protect frame; + octave::unwind_protect frame; frame.add_fcn (unlink_cleanup, name.c_str ()); frame.protect_var (Vecho_executing_commands); @@ -518,7 +518,7 @@ // Turn on command echo so the output from this will make better sense. - unwind_protect frame; + octave::unwind_protect frame; frame.add_fcn (unlink_cleanup, name.c_str ()); frame.protect_var (Vecho_executing_commands);
--- a/libinterp/corefcn/pager.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/pager.cc Thu May 19 12:56:47 2016 -0400 @@ -451,7 +451,7 @@ { if (! flushing_output_to_pager) { - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (really_flush_to_pager); frame.protect_var (flushing_output_to_pager);
--- a/libinterp/corefcn/pr-output.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/pr-output.cc Thu May 19 12:56:47 2016 -0400 @@ -3439,7 +3439,7 @@ if (! arg.is_numeric_type ()) error ("rats: X must be numeric"); - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (rat_string_len);
--- a/libinterp/corefcn/pt-jit.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/pt-jit.cc Thu May 19 12:56:47 2016 -0400 @@ -380,9 +380,9 @@ // and used only inside the for loop (e.g. the index variable) // If we are a nested for loop we need to store the previous breaks - unwind_protect prot; - prot.protect_var (breaks); - prot.protect_var (continues); + octave::unwind_protect frame; + frame.protect_var (breaks); + frame.protect_var (continues); breaks.clear (); continues.clear (); @@ -955,9 +955,9 @@ void jit_convert::visit_while_command (tree_while_command& wc) { - unwind_protect prot; - prot.protect_var (breaks); - prot.protect_var (continues); + octave::unwind_protect frame; + frame.protect_var (breaks); + frame.protect_var (continues); breaks.clear (); continues.clear (); @@ -1017,9 +1017,9 @@ void jit_convert::visit_do_until_command (tree_do_until_command& duc) { - unwind_protect prot; - prot.protect_var (breaks); - prot.protect_var (continues); + octave::unwind_protect frame; + frame.protect_var (breaks); + frame.protect_var (continues); breaks.clear (); continues.clear (); @@ -1216,8 +1216,8 @@ for (size_t idx = 0; iter != arg_list->end (); ++idx, ++iter) { - unwind_protect prot; - prot.add_method (&end_context, + octave::unwind_protect frame; + frame.add_method (&end_context, &std::vector<jit_magic_end::context>::pop_back); jit_magic_end::context ctx (factory, object, idx, narg); @@ -1278,8 +1278,8 @@ jit_value * jit_convert::visit (tree& tee) { - unwind_protect prot; - prot.protect_var (result); + octave::unwind_protect frame; + frame.protect_var (result); tee.accept (*this); return result;
--- a/libinterp/corefcn/quad.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/quad.cc Thu May 19 12:56:47 2016 -0400 @@ -182,7 +182,7 @@ warned_imaginary = false; - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (call_depth); call_depth++;
--- a/libinterp/corefcn/rand.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/rand.cc Thu May 19 12:56:47 2016 -0400 @@ -92,7 +92,7 @@ octave_value retval; dim_vector dims; - unwind_protect frame; + octave::unwind_protect frame; // Restore current distribution on any exit. frame.add_fcn (octave_rand::distribution, octave_rand::distribution ());
--- a/libinterp/corefcn/sparse.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/sparse.cc Thu May 19 12:56:47 2016 -0400 @@ -130,7 +130,7 @@ octave_value retval; // Temporarily disable sparse_auto_mutate if set (it's obsolete anyway). - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (Vsparse_auto_mutate); Vsparse_auto_mutate = false;
--- a/libinterp/corefcn/toplev.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/toplev.cc Thu May 19 12:56:47 2016 -0400 @@ -1020,7 +1020,7 @@ run_command_and_return_output (const std::string& cmd_str) { octave_value_list retval; - unwind_protect frame; + octave::unwind_protect frame; iprocstream *cmd = new iprocstream (cmd_str.c_str ()); @@ -1141,7 +1141,7 @@ octave_value_list retval; // FIXME: Is this unwind_protect frame needed anymore (12/16/15)? - unwind_protect frame; + octave::unwind_protect frame; bool return_output = (nargin == 1 && nargout > 1);
--- a/libinterp/corefcn/toplev.h Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/toplev.h Thu May 19 12:56:47 2016 -0400 @@ -528,7 +528,7 @@ { \ try \ { \ - unwind_protect frame; \ + octave::unwind_protect frame; \ \ frame.protect_var (Vdebug_on_error); \ frame.protect_var (Vdebug_on_warning); \
--- a/libinterp/corefcn/typecast.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/typecast.cc Thu May 19 12:56:47 2016 -0400 @@ -52,7 +52,7 @@ const void *& data, octave_idx_type& byte_size, dim_vector& old_dims, - unwind_protect& frame) + octave::unwind_protect& frame) { // The array given may be a temporary, constructed from a scalar or sparse // array. This will ensure the data will be deallocated after we exit. @@ -143,7 +143,7 @@ octave_value retval; - unwind_protect frame; + octave::unwind_protect frame; const void *data = 0; octave_idx_type byte_size = 0;
--- a/libinterp/corefcn/urlwrite.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/urlwrite.cc Thu May 19 12:56:47 2016 -0400 @@ -366,7 +366,7 @@ if (! ofile.is_open ()) error ("urlwrite: unable to open file"); - unwind_protect_safe frame; + octave::unwind_protect_safe frame; frame.add_fcn (delete_file, filename); @@ -904,7 +904,7 @@ if (! ofile.is_open ()) error ("__ftp_mget__: unable to open file"); - unwind_protect_safe frame; + octave::unwind_protect_safe frame; frame.add_fcn (delete_file, target + sv(i));
--- a/libinterp/corefcn/utils.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/utils.cc Thu May 19 12:56:47 2016 -0400 @@ -1366,7 +1366,7 @@ octave_value retval; - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (discard_error_messages); discard_error_messages = true;
--- a/libinterp/corefcn/variables.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/corefcn/variables.cc Thu May 19 12:56:47 2016 -0400 @@ -258,7 +258,7 @@ { int parse_status; - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (discard_error_messages); frame.protect_var (discard_warning_messages); @@ -304,7 +304,7 @@ { int parse_status; - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (discard_error_messages); @@ -370,7 +370,7 @@ { octave_value retval; - unwind_protect frame; + octave::unwind_protect frame; interpreter_try (frame); try @@ -1666,7 +1666,7 @@ std::string nm = argv[i + 1]; - unwind_protect frame; + octave::unwind_protect frame; // Set up temporary scope. @@ -2643,7 +2643,7 @@ if (val.is_defined ()) { // Ensure auto-restoration. - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (Vmissing_function_hook); // Clear the variable prior to calling the function.
--- a/libinterp/dldfcn/__delaunayn__.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/dldfcn/__delaunayn__.cc Thu May 19 12:56:47 2016 -0400 @@ -146,7 +146,7 @@ sprintf (flags, "qhull d %s", options.c_str ()); - unwind_protect frame; + octave::unwind_protect frame; // Replace the outfile pointer with stdout for debugging information. #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)
--- a/libinterp/dldfcn/__eigs__.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/dldfcn/__eigs__.cc Thu May 19 12:56:47 2016 -0400 @@ -190,7 +190,7 @@ warned_imaginary = false; - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (call_depth); call_depth++;
--- a/libinterp/dldfcn/__osmesa_print__.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/dldfcn/__osmesa_print__.cc Thu May 19 12:56:47 2016 -0400 @@ -138,7 +138,7 @@ error ("__osmesa_print__: Depth and stencil doesn't match," " are you sure you are using OSMesa >= 9.0?"); - unwind_protect outer_frame; + octave::unwind_protect outer_frame; bool v = fp.is_visible ();
--- a/libinterp/dldfcn/__voronoi__.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/dldfcn/__voronoi__.cc Thu May 19 12:56:47 2016 -0400 @@ -137,7 +137,7 @@ boolT ismalloc = false; - unwind_protect frame; + octave::unwind_protect frame; // Replace the outfile pointer with stdout for debugging information. #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)
--- a/libinterp/dldfcn/audiodevinfo.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/dldfcn/audiodevinfo.cc Thu May 19 12:56:47 2016 -0400 @@ -1103,7 +1103,7 @@ start = get_sample_number (); end = get_end_sample (); - unwind_protect frame; + octave::unwind_protect frame; frame.add_fcn (safe_audioplayer_stop, this); @@ -1723,7 +1723,7 @@ unsigned int frames = seconds * get_fs (); - unwind_protect frame; + octave::unwind_protect frame; frame.add_fcn (safe_audiorecorder_stop, this);
--- a/libinterp/dldfcn/audioread.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/dldfcn/audioread.cc Thu May 19 12:56:47 2016 -0400 @@ -91,7 +91,7 @@ if (! file) error ("audioread: failed to open input file %s", filename.c_str ()); - unwind_protect frame; + octave::unwind_protect frame; frame.add_fcn (safe_close, file); @@ -394,7 +394,7 @@ if (! file) error ("audiowrite: failed to open output file %s", filename.c_str ()); - unwind_protect frame; + octave::unwind_protect frame; frame.add_fcn (safe_close, file); @@ -462,7 +462,7 @@ if (! file) error ("audioinfo: failed to open file %s", filename.c_str ()); - unwind_protect frame; + octave::unwind_protect frame; frame.add_fcn (safe_close, file);
--- a/libinterp/dldfcn/convhulln.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/dldfcn/convhulln.cc Thu May 19 12:56:47 2016 -0400 @@ -154,7 +154,7 @@ boolT ismalloc = false; - unwind_protect frame; + octave::unwind_protect frame; // Replace the outfile pointer with stdout for debugging information. #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)
--- a/libinterp/octave-value/ov-builtin.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/octave-value/ov-builtin.cc Thu May 19 12:56:47 2016 -0400 @@ -108,7 +108,7 @@ if (args.has_magic_colon ()) error ("invalid use of colon in function argument list"); - unwind_protect frame; + octave::unwind_protect frame; octave_call_stack::push (this);
--- a/libinterp/octave-value/ov-class.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/octave-value/ov-class.cc Thu May 19 12:56:47 2016 -0400 @@ -557,7 +557,7 @@ if (obsolete_copies == 0 && meth.is_user_function () && meth.user_function_value ()->subsasgn_optimization_ok ()) { - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (obsolete_copies); obsolete_copies = 2; @@ -994,7 +994,7 @@ void octave_class::print_raw (std::ostream& os, bool) const { - unwind_protect frame; + octave::unwind_protect frame; indent (os); os << " <class " << class_name () << ">"; @@ -1078,7 +1078,7 @@ if (have_ctor) { - unwind_protect frame; + octave::unwind_protect frame; // Simulate try/catch.
--- a/libinterp/octave-value/ov-fcn-handle.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/octave-value/ov-fcn-handle.cc Thu May 19 12:56:47 2016 -0400 @@ -424,7 +424,7 @@ pos = is.tellg (); - unwind_protect_safe frame; + octave::unwind_protect_safe frame; // Set up temporary scope to use for evaluating the text that // defines the anonymous function. @@ -608,7 +608,7 @@ is.read (ctmp2, tmp); ctmp2[tmp] = 0; - unwind_protect_safe frame; + octave::unwind_protect_safe frame; // Set up temporary scope to use for evaluating the text that // defines the anonymous function. @@ -1115,7 +1115,7 @@ H5Eset_auto (err_func, err_func_data); #endif - unwind_protect_safe frame; + octave::unwind_protect_safe frame; // Set up temporary scope to use for evaluating the text that // defines the anonymous function. @@ -2037,7 +2037,7 @@ else { // Simulate try/catch. - unwind_protect frame; + octave::unwind_protect frame; interpreter_try (frame); try
--- a/libinterp/octave-value/ov-mex-fcn.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/octave-value/ov-mex-fcn.cc Thu May 19 12:56:47 2016 -0400 @@ -135,7 +135,7 @@ if (args.has_magic_colon ()) error ("invalid use of colon in function argument list"); - unwind_protect frame; + octave::unwind_protect frame; octave_call_stack::push (this);
--- a/libinterp/octave-value/ov-oncleanup.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/octave-value/ov-oncleanup.cc Thu May 19 12:56:47 2016 -0400 @@ -66,7 +66,7 @@ if (fcn.is_undefined ()) return; - unwind_protect frame; + octave::unwind_protect frame; // Clear interrupts. frame.protect_var (octave_interrupt_state);
--- a/libinterp/octave-value/ov-struct.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/octave-value/ov-struct.cc Thu May 19 12:56:47 2016 -0400 @@ -569,7 +569,7 @@ void octave_struct::print_raw (std::ostream& os, bool) const { - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (Vstruct_levels_to_print); @@ -1251,7 +1251,7 @@ void octave_scalar_struct::print_raw (std::ostream& os, bool) const { - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (Vstruct_levels_to_print);
--- a/libinterp/octave-value/ov-usr-fcn.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/octave-value/ov-usr-fcn.cc Thu May 19 12:56:47 2016 -0400 @@ -124,7 +124,7 @@ { octave_value_list retval; - unwind_protect frame; + octave::unwind_protect frame; if (args.length () != 0 || nargout != 0) error ("invalid call to script %s", file_name.c_str ()); @@ -491,7 +491,7 @@ return retval; #endif - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (call_depth); call_depth++;
--- a/libinterp/octave-value/ov-usr-fcn.h Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/octave-value/ov-usr-fcn.h Thu May 19 12:56:47 2016 -0400 @@ -498,7 +498,7 @@ symbol_table::scope_id local_scope; // pointer to the current unwind_protect frame of this function. - unwind_protect *curr_unwind_protect_frame; + octave::unwind_protect *curr_unwind_protect_frame; #if defined (HAVE_LLVM) jit_function_info *jit_info;
--- a/libinterp/octave.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/octave.cc Thu May 19 12:56:47 2016 -0400 @@ -242,7 +242,7 @@ // normally be evaluated from the normal intepreter loop where // exceptions are already handled. - unwind_protect frame; + octave::unwind_protect frame; frame.add_fcn (load_path::set_add_hook, load_path::get_add_hook ()); @@ -350,7 +350,7 @@ static void execute_startup_files (void) { - unwind_protect frame; + octave::unwind_protect frame; std::string context; @@ -422,7 +422,7 @@ static int execute_eval_option_code (const std::string& code) { - unwind_protect frame; + octave::unwind_protect frame; octave_save_signal_mask (); @@ -467,7 +467,7 @@ static void execute_command_line_file (const std::string& fname) { - unwind_protect frame; + octave::unwind_protect frame; octave_save_signal_mask ();
--- a/libinterp/parse-tree/oct-parse.in.yy Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/parse-tree/oct-parse.in.yy Thu May 19 12:56:47 2016 -0400 @@ -2214,7 +2214,7 @@ { tree_expression *retval = e; - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (discard_error_messages); frame.protect_var (discard_warning_messages); @@ -3839,7 +3839,7 @@ { tree_expression *retval = array_list; - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (discard_error_messages); frame.protect_var (discard_warning_messages); @@ -4140,7 +4140,7 @@ bool require_file, bool force_script, bool autoload, bool relative_lookup, const std::string& warn_for) { - unwind_protect frame; + octave::unwind_protect frame; octave_function *fcn_ptr = 0; @@ -4330,7 +4330,7 @@ { octave_function *retval = 0; - unwind_protect frame; + octave::unwind_protect frame; std::string nm = file_name; @@ -4570,7 +4570,7 @@ file_full_name = octave::sys::env::make_absolute (file_full_name); - unwind_protect frame; + octave::unwind_protect frame; if (source_call_depth.find (file_full_name) == source_call_depth.end ()) source_call_depth[file_full_name] = -1; @@ -5087,7 +5087,7 @@ if (nargin == 0) print_usage (); - unwind_protect frame; + octave::unwind_protect frame; if (nargin > 1) { @@ -5193,7 +5193,7 @@ std::string context = args(0).xstring_value ("assignin: CONTEXT must be a string"); - unwind_protect frame; + octave::unwind_protect frame; if (context == "caller") octave_call_stack::goto_caller_frame (); @@ -5247,7 +5247,7 @@ std::string context = args(0).xstring_value ("evalin: CONTEXT must be a string"); - unwind_protect frame; + octave::unwind_protect frame; if (context == "caller") octave_call_stack::goto_caller_frame ();
--- a/libinterp/parse-tree/pt-arg-list.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/parse-tree/pt-arg-list.cc Thu May 19 12:56:47 2016 -0400 @@ -209,7 +209,7 @@ && ! (object->is_function () || object->is_function_handle ())); - unwind_protect frame; + octave::unwind_protect frame; if (stash_object) {
--- a/libinterp/parse-tree/pt-eval.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/parse-tree/pt-eval.cc Thu May 19 12:56:47 2016 -0400 @@ -287,7 +287,7 @@ // FIXME: need to handle PARFOR loops here using cmd.in_parallel () // and cmd.maxproc_expr (); - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (in_loop_command); @@ -399,7 +399,7 @@ if (debug_mode) do_breakpoint (cmd.is_breakpoint (true)); - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (in_loop_command); @@ -830,7 +830,7 @@ void tree_evaluator::visit_try_catch_command (tree_try_catch_command& cmd) { - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (buffer_error_messages); frame.protect_var (Vdebug_on_error); @@ -902,7 +902,7 @@ void tree_evaluator::do_unwind_protect_cleanup_code (tree_statement_list *list) { - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (octave_interrupt_state); octave_interrupt_state = 0; @@ -1021,7 +1021,7 @@ return; #endif - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (in_loop_command); @@ -1060,7 +1060,7 @@ return; #endif - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (in_loop_command);
--- a/libinterp/parse-tree/pt.cc Thu May 19 08:42:55 2016 -0700 +++ b/libinterp/parse-tree/pt.cc Thu May 19 12:56:47 2016 -0400 @@ -65,7 +65,7 @@ { int parse_status = 0; - unwind_protect frame; + octave::unwind_protect frame; frame.protect_var (buffer_error_messages); frame.protect_var (Vdebug_on_error); frame.protect_var (Vdebug_on_warning);
--- a/liboctave/util/unwind-prot.cc Thu May 19 08:42:55 2016 -0700 +++ b/liboctave/util/unwind-prot.cc Thu May 19 12:56:47 2016 -0400 @@ -28,11 +28,14 @@ #include "lo-error.h" #include "unwind-prot.h" -void -unwind_protect_safe::warn_unhandled_exception (void) const +namespace octave { - (*current_liboctave_warning_handler) - ("unhandled exception in unwind_protect_safe handler. " - "It is a bug in Octave for this to happen. " - "Please help improve Octave by reporting it."); + void + unwind_protect_safe::warn_unhandled_exception (void) const + { + (*current_liboctave_warning_handler) + ("unhandled exception in unwind_protect_safe handler. " + "It is a bug in Octave for this to happen. " + "Please help improve Octave by reporting it."); + } }
--- a/liboctave/util/unwind-prot.h Thu May 19 08:42:55 2016 -0700 +++ b/liboctave/util/unwind-prot.h Thu May 19 12:56:47 2016 -0400 @@ -33,120 +33,133 @@ #include "action-container.h" -class -OCTAVE_API -unwind_protect : public action_container +namespace octave { -public: + class + OCTAVE_API + unwind_protect : public action_container + { + public: + + unwind_protect (void) : lifo () { } - unwind_protect (void) : lifo () { } + // Destructor should not raise an exception, so all actions + // registered should be exception-safe. If you're not sure, see + // unwind_protect_safe. - // Destructor should not raise an exception, so all actions - // registered should be exception-safe. If you're not sure, see - // unwind_protect_safe. + ~unwind_protect (void) { run (); } + + virtual void add (elem *new_elem) + { + lifo.push (new_elem); + } - ~unwind_protect (void) { run (); } + OCTAVE_DEPRECATED ("use 'add (new fcn_arg_elem<void *> (fcn, ptr))' instead") + void add (void (*fcn) (void *), void *ptr = 0) + { + add (new fcn_arg_elem<void *> (fcn, ptr)); + } + + operator bool (void) const { return ! empty (); } + + OCTAVE_DEPRECATED ("use 'run_first' instead") + void run_top (void) { run_first (); } - virtual void add (elem *new_elem) - { - lifo.push (new_elem); - } + void run_first (void) + { + if (! empty ()) + { + // No leak on exception! + std::unique_ptr<elem> ptr (lifo.top ()); + lifo.pop (); + ptr->run (); + } + } - OCTAVE_DEPRECATED ("use 'add (new fcn_arg_elem<void *> (fcn, ptr))' instead") - void add (void (*fcn) (void *), void *ptr = 0) - { - add (new fcn_arg_elem<void *> (fcn, ptr)); - } + OCTAVE_DEPRECATED ("use 'run' instead") + void run_top (int num) { run (num); } - operator bool (void) const { return ! empty (); } + OCTAVE_DEPRECATED ("use 'discard_first' instead") + void discard_top (void) { discard_first (); } + + void discard_first (void) + { + if (! empty ()) + { + elem *ptr = lifo.top (); + lifo.pop (); + delete ptr; + } + } + + OCTAVE_DEPRECATED ("use 'discard' instead") + void discard_top (int num) { discard (num); } + + size_t size (void) const { return lifo.size (); } + + protected: - OCTAVE_DEPRECATED ("use 'run_first' instead") - void run_top (void) { run_first (); } + std::stack<elem *> lifo; + + private: + + // No copying! + + unwind_protect (const unwind_protect&); - void run_first (void) + unwind_protect& operator = (const unwind_protect&); + }; + + // Like unwind_protect, but this one will guard against the + // possibility of seeing an exception (or interrupt) in the cleanup + // actions. Not that we can do much about it, but at least we won't + // crash. + + class + OCTAVE_API + unwind_protect_safe : public unwind_protect { - if (! empty ()) - { - // No leak on exception! - std::unique_ptr<elem> ptr (lifo.top ()); - lifo.pop (); - ptr->run (); - } - } + private: + + void warn_unhandled_exception (void) const; - OCTAVE_DEPRECATED ("use 'run' instead") - void run_top (int num) { run (num); } + public: - OCTAVE_DEPRECATED ("use 'discard_first' instead") - void discard_top (void) { discard_first (); } + unwind_protect_safe (void) : unwind_protect () { } - void discard_first (void) - { - if (! empty ()) + ~unwind_protect_safe (void) { - elem *ptr = lifo.top (); - lifo.pop (); - delete ptr; - } - } - - OCTAVE_DEPRECATED ("use 'discard' instead") - void discard_top (int num) { discard (num); } - - size_t size (void) const { return lifo.size (); } - -protected: - - std::stack<elem *> lifo; - -private: - - // No copying! - - unwind_protect (const unwind_protect&); - - unwind_protect& operator = (const unwind_protect&); -}; - -// Like unwind_protect, but this one will guard against the -// possibility of seeing an exception (or interrupt) in the cleanup -// actions. Not that we can do much about it, but at least we won't -// crash. - -class -OCTAVE_API -unwind_protect_safe : public unwind_protect -{ -private: - - void warn_unhandled_exception (void) const; - -public: - - unwind_protect_safe (void) : unwind_protect () { } - - ~unwind_protect_safe (void) - { - while (! empty ()) - { - try + while (! empty ()) { - run_first (); - } - catch (...) // Yes, the black hole. Remember we're in a destructor. - { - warn_unhandled_exception (); + try + { + run_first (); + } + catch (...) // Yes, the black hole. Remember we're in a destructor. + { + warn_unhandled_exception (); + } } } - } + + private: -private: + // No copying! + + unwind_protect_safe (const unwind_protect_safe&); - // No copying! + unwind_protect_safe& operator = (const unwind_protect_safe&); + }; +} + +#if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS) - unwind_protect_safe (const unwind_protect_safe&); +OCTAVE_DEPRECATED ("use octave::unwind_protect instead") +typedef octave::unwind_protect unwind_protect; - unwind_protect_safe& operator = (const unwind_protect_safe&); -}; +OCTAVE_DEPRECATED ("use octave::unwind_protect_safe instead") +typedef octave::unwind_protect_safe unwind_protect_safe; #endif + +#endif
--- a/liboctave/util/url-transfer.cc Thu May 19 08:42:55 2016 -0700 +++ b/liboctave/util/url-transfer.cc Thu May 19 12:56:47 2016 -0400 @@ -76,7 +76,7 @@ if (good ()) { - unwind_protect_safe frame; + octave::unwind_protect_safe frame; frame.add_fcn (reset_path, this); @@ -106,7 +106,7 @@ break; } - unwind_protect_safe frame2; + octave::unwind_protect_safe frame2; frame2.add_fcn (delete_file, realfile); @@ -143,7 +143,7 @@ if (good ()) { - unwind_protect_safe frame; + octave::unwind_protect_safe frame; frame.add_fcn (reset_path, this); @@ -408,7 +408,7 @@ { struct curl_slist *slist = 0; - unwind_protect frame; + octave::unwind_protect frame; frame.add_fcn (curl_slist_free_all, slist); std::string cmd = "rnfr " + oldname; @@ -576,7 +576,7 @@ struct curl_slist *slist = 0; - unwind_protect frame; + octave::unwind_protect frame; frame.add_fcn (curl_slist_free_all, slist); slist = curl_slist_append (slist, "pwd"); @@ -746,7 +746,7 @@ { struct curl_slist *slist = 0; - unwind_protect frame; + octave::unwind_protect frame; frame.add_fcn (curl_slist_free_all, slist);