Mercurial > octave
changeset 33349:1191eae272fa
eliminate some calls to panic_impossible in pt-eval.cc
* pt-eval.cc (error_unexpected): New static function. Use it to
replace panic_impossible in tree_evaluator visitor functions that
should never be called.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 07 Apr 2024 13:30:54 -0400 |
parents | aa7cd2622228 |
children | 05da909b8c28 |
files | libinterp/parse-tree/pt-eval.cc |
diffstat | 1 files changed, 37 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-eval.cc Sun Apr 07 13:29:18 2024 -0400 +++ b/libinterp/parse-tree/pt-eval.cc Sun Apr 07 13:30:54 2024 -0400 @@ -75,6 +75,12 @@ OCTAVE_BEGIN_NAMESPACE(octave) +OCTAVE_NORETURN static void +error_unexpected (const char *name) +{ + error ("unexpected call to %s - please report this bug", name); +} + // Normal evaluator. class quit_debug_exception @@ -1258,13 +1264,13 @@ void tree_evaluator::visit_anon_fcn_handle (tree_anon_fcn_handle&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_anon_fcn_handle"); } void tree_evaluator::visit_argument_list (tree_argument_list&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_argument_list"); } void @@ -1276,49 +1282,49 @@ void tree_evaluator::visit_args_block_attribute_list (tree_args_block_attribute_list&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_args_block_attribute_list"); } void tree_evaluator::visit_args_block_validation_list (tree_args_block_validation_list&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_args_block_validation_list"); } void tree_evaluator::visit_arg_validation (tree_arg_validation&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_arg_validation"); } void tree_evaluator::visit_arg_size_spec (tree_arg_size_spec&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_arg_size_spec"); } void tree_evaluator::visit_arg_validation_fcns (tree_arg_validation_fcns&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_arg_validation_fcns"); } void tree_evaluator::visit_binary_expression (tree_binary_expression&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_binary_expression"); } void tree_evaluator::visit_boolean_expression (tree_boolean_expression&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_boolean_expression"); } void tree_evaluator::visit_compound_binary_expression (tree_compound_binary_expression&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_compound_binary_expression"); } void @@ -1345,7 +1351,7 @@ void tree_evaluator::visit_colon_expression (tree_colon_expression&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_colon_expression"); } void @@ -3598,7 +3604,7 @@ tree_evaluator::visit_octave_user_script (octave_user_script&) { // ?? - panic_impossible (); + error_unexpected ("tree_evaluator::visit_octave_user_script"); } octave_value_list @@ -3781,19 +3787,19 @@ tree_evaluator::visit_octave_user_function (octave_user_function&) { // ?? - panic_impossible (); + error_unexpected ("tree_evaluator::visit_octave_user_function"); } void tree_evaluator::visit_octave_user_function_header (octave_user_function&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_octave_user_function_header"); } void tree_evaluator::visit_octave_user_function_trailer (octave_user_function&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_octave_user_function_trailer"); } void @@ -3821,13 +3827,13 @@ void tree_evaluator::visit_identifier (tree_identifier&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_identifier"); } void tree_evaluator::visit_if_clause (tree_if_clause&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_if_clause"); } void @@ -3880,25 +3886,25 @@ void tree_evaluator::visit_index_expression (tree_index_expression&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_index_expression"); } void tree_evaluator::visit_matrix (tree_matrix&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_matrix"); } void tree_evaluator::visit_cell (tree_cell&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_cell"); } void tree_evaluator::visit_multi_assignment (tree_multi_assignment&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_multi_assignment"); } void @@ -3920,31 +3926,31 @@ void tree_evaluator::visit_constant (tree_constant&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_constant"); } void tree_evaluator::visit_fcn_handle (tree_fcn_handle&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_fcn_handle"); } void tree_evaluator::visit_parameter_list (tree_parameter_list&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_parameter_list"); } void tree_evaluator::visit_postfix_expression (tree_postfix_expression&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_postfix_expression"); } void tree_evaluator::visit_prefix_expression (tree_prefix_expression&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_prefix_expression"); } void @@ -3975,7 +3981,7 @@ void tree_evaluator::visit_simple_assignment (tree_simple_assignment&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_simple_assignment"); } void @@ -4141,13 +4147,13 @@ void tree_evaluator::visit_switch_case (tree_switch_case&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_switch_case"); } void tree_evaluator::visit_switch_case_list (tree_switch_case_list&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_switch_case_list"); } void @@ -4489,13 +4495,13 @@ void tree_evaluator::visit_superclass_ref (tree_superclass_ref&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_superclass_ref"); } void tree_evaluator::visit_metaclass_query (tree_metaclass_query&) { - panic_impossible (); + error_unexpected ("tree_evaluator::visit_metaclass_query"); } void