Mercurial > hg > octave-lyh
changeset 8142:54b41376e381
ov-usr-fcn.cc (octave_user_function::do_multi_index_op): add symbol_table::clear_variables cleanup function to the unwind_protect stack after the parameter list cleanup functions
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 24 Sep 2008 13:31:04 -0400 |
parents | 31d7885d9869 |
children | 3a4694d67dbb |
files | src/ChangeLog src/ov-usr-fcn.cc |
diffstat | 2 files changed, 19 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2008-09-24 John W. Eaton <jwe@octave.org> + * ov-usr-fcn.cc (octave_user_function::do_multi_index_op): + Add symbol_table::clear_variables cleanup function to the + unwind_protect stack after the parameter list cleanup functions. + * load-path.cc (load_path::do_initialize): Check for OCTAVE_PATH in the environment, not OCTAVE_LOADPATH.
--- a/src/ov-usr-fcn.cc +++ b/src/ov-usr-fcn.cc @@ -375,11 +375,6 @@ unwind_protect::add (symbol_table::pop_context); } - else - { - // Force symbols to be undefined again when this function exits. - unwind_protect::add (symbol_table::clear_variables); - } // Save and restore args passed for recursive calls. @@ -411,6 +406,21 @@ unwind_protect::add (clear_param_list, ret_list); + if (call_depth == 0) + { + // Force symbols to be undefined again when this function + // exits. + // + // This cleanup function is added to the unwind_protect stack + // after the calls to clear the parameter lists so that local + // variables will be cleared before the parameter lists are + // cleared. That way, any function parameters that have been + // declared global will be unmarked as global before they are + // undefined by the clear_param_list cleanup function. + + unwind_protect::add (symbol_table::clear_variables); + } + // The following code is in a separate scope to avoid warnings from // G++ about `goto abort' crossing the initialization of some // variables.