Mercurial > octave
changeset 33363:e95dabfeadb5
eliminate calls to panic_impossible in pt-pr-code.cc
* pt-pr-code.cc (error_unexpected): New static function. Use it to
replace panic_impossible in tree_print_code visitor functions that
should never be called.
(tree_print_code::visit_index_expression): Use error instead of
panic_impossible to report unexpected index operator.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 08 Apr 2024 20:27:33 -0400 |
parents | 2949b89f9711 |
children | 9108c5b24626 fb44a9db1bc6 |
files | libinterp/parse-tree/pt-pr-code.cc |
diffstat | 1 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-pr-code.cc Mon Apr 08 19:39:34 2024 -0400 +++ b/libinterp/parse-tree/pt-pr-code.cc Mon Apr 08 20:27:33 2024 -0400 @@ -37,6 +37,12 @@ OCTAVE_BEGIN_NAMESPACE(octave) +OCTAVE_NORETURN static void +error_unexpected (const char *name) +{ + error ("unexpected call to %s - please report this bug", name); +} + void tree_print_code::visit_anon_fcn_handle (tree_anon_fcn_handle& afh) { @@ -87,31 +93,31 @@ void tree_print_code::visit_args_block_attribute_list (tree_args_block_attribute_list&) { - panic_impossible (); + error_unexpected ("tree_print_code::visit_args_block_attribute_list"); } void tree_print_code::visit_args_block_validation_list (tree_args_block_validation_list&) { - panic_impossible (); + error_unexpected ("tree_print_code::visit_args_block_validation_list"); } void tree_print_code::visit_arg_validation (tree_arg_validation&) { - panic_impossible (); + error_unexpected ("tree_print_code::visit_arg_validation"); } void tree_print_code::visit_arg_size_spec (tree_arg_size_spec&) { - panic_impossible (); + error_unexpected ("tree_print_code::visit_arg_size_spec"); } void tree_print_code::visit_arg_validation_fcns (tree_arg_validation_fcns&) { - panic_impossible (); + error_unexpected ("tree_print_code::visit_arg_validation_fcns"); } void @@ -615,7 +621,7 @@ break; default: - panic_impossible (); + error ("unexpected: index not '(', '{', or '.' in tree_print_code::visit_index_expression - please report this bug"); } p_arg_lists++;