changeset 33362:2949b89f9711

replace most uses of panic_impossible with error in octave_value classes * ov-base-diag.cc, ov-base-mat.cc, ov-base-scalar.cc, ov-base-sparse.cc, ov-base.cc, ov-bool-mat.cc, ov-cell.cc, ov-class.cc, ov-cx-mat.cc, ov-fcn-handle.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-perm.cc, ov-range.cc, ov-re-mat.cc, ov-str-mat.cc, ov-struct.cc, ov-usr-fcn.cc: Replace all uses of panic_impossible with error.
author John W. Eaton <jwe@octave.org>
date Mon, 08 Apr 2024 19:39:34 -0400
parents a5217e6ed309
children e95dabfeadb5
files libinterp/octave-value/ov-base-diag.cc libinterp/octave-value/ov-base-mat.cc libinterp/octave-value/ov-base-scalar.cc libinterp/octave-value/ov-base-sparse.cc libinterp/octave-value/ov-base.cc libinterp/octave-value/ov-bool-mat.cc libinterp/octave-value/ov-cell.cc libinterp/octave-value/ov-class.cc libinterp/octave-value/ov-cx-mat.cc libinterp/octave-value/ov-fcn-handle.cc libinterp/octave-value/ov-flt-cx-mat.cc libinterp/octave-value/ov-flt-re-mat.cc libinterp/octave-value/ov-perm.cc libinterp/octave-value/ov-range.cc libinterp/octave-value/ov-re-mat.cc libinterp/octave-value/ov-str-mat.cc libinterp/octave-value/ov-struct.cc libinterp/octave-value/ov-usr-fcn.cc
diffstat 18 files changed, 48 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-base-diag.cc	Mon Apr 08 19:39:04 2024 -0400
+++ b/libinterp/octave-value/ov-base-diag.cc	Mon Apr 08 19:39:34 2024 -0400
@@ -68,7 +68,7 @@
       break;
 
     default:
-      panic_impossible ();
+      error ("unexpected: index not '(', '{', or '.' in octave_base_diag<DMT,MT>::subsref - please report this bug");
     }
 
   return retval.next_subsref (type, idx);
@@ -254,7 +254,7 @@
       break;
 
     default:
-      panic_impossible ();
+      error ("unexpected: index not '(', '{', or '.' in octave_base_diag<DMT,MT>::subsasgn - please report this bug");
     }
 
   return retval;
--- a/libinterp/octave-value/ov-base-mat.cc	Mon Apr 08 19:39:04 2024 -0400
+++ b/libinterp/octave-value/ov-base-mat.cc	Mon Apr 08 19:39:34 2024 -0400
@@ -86,7 +86,7 @@
       break;
 
     default:
-      panic_impossible ();
+      error ("unpexpected: index not '(', '{', or '.' in - octave_base_matrix<MT>::subsref please report this bug");
     }
 
   return retval.next_subsref (type, idx);
@@ -145,7 +145,7 @@
       break;
 
     default:
-      panic_impossible ();
+      error ("unpexpected: index not '(', '{', or '.' in - octave_base_matrix<MT>::subsasgn please report this bug");
     }
 
   return retval;
@@ -260,7 +260,7 @@
       switch (n_idx)
         {
         case 0:
-          panic_impossible ();
+          error ("unexpected: zero indices in octave_base_matrix<MT>::assign - please report this bug");
           break;
 
         case 1:
@@ -334,7 +334,7 @@
       switch (n_idx)
         {
         case 0:
-          panic_impossible ();
+          error ("unexpected: zero indices in octave_base_matrix<MT>::assign - please report this bug");
           break;
 
         case 1:
--- a/libinterp/octave-value/ov-base-scalar.cc	Mon Apr 08 19:39:04 2024 -0400
+++ b/libinterp/octave-value/ov-base-scalar.cc	Mon Apr 08 19:39:34 2024 -0400
@@ -61,7 +61,7 @@
       break;
 
     default:
-      panic_impossible ();
+      error ("unexpected: index not '(', '{', or '.' in octave_base_scalar<T>::subsref - please report this bug");
     }
 
   return retval.next_subsref (type, idx);
@@ -99,7 +99,7 @@
       break;
 
     default:
-      panic_impossible ();
+      error ("unexpected: index not '(', '{', or '.' in octave_base_scalar<T>::subsasgn - please report this bug");
     }
 
   return retval;
--- a/libinterp/octave-value/ov-base-sparse.cc	Mon Apr 08 19:39:04 2024 -0400
+++ b/libinterp/octave-value/ov-base-sparse.cc	Mon Apr 08 19:39:34 2024 -0400
@@ -128,7 +128,7 @@
       break;
 
     default:
-      panic_impossible ();
+      error ("unexpected: index not '(', '{', or '.' in octave_base_sparse<T>::subsref - please report this bug");
     }
 
   return retval.next_subsref (type, idx);
@@ -173,7 +173,7 @@
       break;
 
     default:
-      panic_impossible ();
+      error ("unexpected: index not '(', '{', or '.' in octave_base_sparse<T>::subsasgn - please report this bug");
     }
 
   return retval;
--- a/libinterp/octave-value/ov-base.cc	Mon Apr 08 19:39:04 2024 -0400
+++ b/libinterp/octave-value/ov-base.cc	Mon Apr 08 19:39:34 2024 -0400
@@ -340,7 +340,7 @@
           break;
 
         default:
-          panic_impossible ();
+          error ("unexpected: index not '(', '{', or '.' in octave_base_value::subsasgn - please report this bug");
         }
     }
   else
@@ -1504,7 +1504,7 @@
           break;
 
         default:
-          panic_impossible ();
+          error ("unexpected: index not '(', '{', or '.' in make_idx_args - please report this bug");
           break;
         }
     }
--- a/libinterp/octave-value/ov-bool-mat.cc	Mon Apr 08 19:39:04 2024 -0400
+++ b/libinterp/octave-value/ov-bool-mat.cc	Mon Apr 08 19:39:34 2024 -0400
@@ -331,10 +331,10 @@
       else if (nr == 0 || nc == 0)
         m_matrix = boolMatrix (nr, nc);
       else
-        panic_impossible ();
+        error ("unexpected dimensions in octave_bool_matrix::load_ascii - please report this bug");
     }
   else
-    panic_impossible ();
+    error ("unexpected dimensions keyword (= '%s') octave_bool_matrix::load_ascii - please report this bug", kw.c_str ());
 
   return true;
 }
--- a/libinterp/octave-value/ov-cell.cc	Mon Apr 08 19:39:04 2024 -0400
+++ b/libinterp/octave-value/ov-cell.cc	Mon Apr 08 19:39:34 2024 -0400
@@ -108,7 +108,7 @@
       break;
 
     default:
-      panic_impossible ();
+      error ("unexpected: index not '(', '{', or '.' in octave_cell::simple_subsref - please report this bug");
     }
 
   return retval;
@@ -154,7 +154,7 @@
       break;
 
     default:
-      panic_impossible ();
+      error ("unexpected: index not '(', '{', or '.' in octave_cell::subsref - please report this bug");
     }
 
   // FIXME: perhaps there should be an
@@ -204,7 +204,7 @@
       break;
 
     default:
-      panic_impossible ();
+      error ("unexpected: index not '(', '{', or '.' in octave_cell::subsref - please report this bug");
     }
 
   // FIXME: perhaps there should be an
@@ -311,7 +311,7 @@
           break;
 
         default:
-          panic_impossible ();
+          error ("unexpected: index not '(', '{', or '.' in octave_cell::subsasgn - please report this bug");
         }
     }
 
@@ -385,7 +385,7 @@
       break;
 
     default:
-      panic_impossible ();
+      error ("unexpected: index not '(', '{', or '.' in octave_cell::subsasgn - please report this bug");
     }
 
   return retval;
@@ -849,10 +849,10 @@
       else if (nr == 0 || nc == 0)
         m_matrix = Cell (nr, nc);
       else
-        panic_impossible ();
+        error ("unexpected dimensions in octave_cell::load_ascii - please report this bug");
     }
   else
-    panic_impossible ();
+    error ("unexpected dimensions keyword (= '%s') octave_cell::load_ascii - please report this bug", kw.c_str ());
 
   return true;
 }
--- a/libinterp/octave-value/ov-class.cc	Mon Apr 08 19:39:04 2024 -0400
+++ b/libinterp/octave-value/ov-class.cc	Mon Apr 08 19:39:34 2024 -0400
@@ -438,7 +438,7 @@
           break;
 
         default:
-          panic_impossible ();
+          error ("unpexpected: index not '(', '{', or '.' in - octave_class::subsref please report this bug");
         }
 
       // FIXME: perhaps there should be an
@@ -748,7 +748,7 @@
           break;
 
         default:
-          panic_impossible ();
+          error ("unpexpected: index not '(', '{', or '.' in - octave_class::subsasgn_common please report this bug");
         }
     }
 
@@ -833,7 +833,7 @@
       break;
 
     default:
-      panic_impossible ();
+      error ("unpexpected: index not '(', '{', or '.' in - octave_class::subsref please report this bug");
     }
 
   return retval;
@@ -1285,7 +1285,7 @@
       m_c_name = classname;
     }
   else
-    panic_impossible ();
+    error ("unexpected: len < 0 in octave_class::load_ascii - please report this bug");
 
   return true;
 }
@@ -1412,7 +1412,7 @@
   else if (len == 0)
     m_map = octave_map (dim_vector (1, 1));
   else
-    panic_impossible ();
+    error ("unexpected: len < 0 in octave_class::load_binary - please report this bug");
 
   return success;
 }
--- a/libinterp/octave-value/ov-cx-mat.cc	Mon Apr 08 19:39:04 2024 -0400
+++ b/libinterp/octave-value/ov-cx-mat.cc	Mon Apr 08 19:39:34 2024 -0400
@@ -409,10 +409,10 @@
       else if (nr == 0 || nc == 0)
         m_matrix = ComplexMatrix (nr, nc);
       else
-        panic_impossible ();
+        error ("unexpected dimensions in octave_complex_matrix::load_ascii - please report this bug");
     }
   else
-    panic_impossible ();
+    error ("unexpected dimensions keyword (= '%s') octave_complex_matrix::load_ascii - please report this bug", kw.c_str ());
 
   return true;
 }
--- a/libinterp/octave-value/ov-fcn-handle.cc	Mon Apr 08 19:39:04 2024 -0400
+++ b/libinterp/octave-value/ov-fcn-handle.cc	Mon Apr 08 19:39:34 2024 -0400
@@ -825,7 +825,7 @@
       error ("function handle cannot be indexed with %c", type[0]);
 
     default:
-      panic_impossible ();
+      error ("unexpected: index not '(', '{', or '.' in base_fcn_handle::subsref - please report this bug");
     }
 
   // FIXME: perhaps there should be an
--- a/libinterp/octave-value/ov-flt-cx-mat.cc	Mon Apr 08 19:39:04 2024 -0400
+++ b/libinterp/octave-value/ov-flt-cx-mat.cc	Mon Apr 08 19:39:34 2024 -0400
@@ -384,10 +384,10 @@
       else if (nr == 0 || nc == 0)
         m_matrix = FloatComplexMatrix (nr, nc);
       else
-        panic_impossible ();
+        error ("unexpected dimensions in octave_float_complex_matrix::load_ascii - please report this bug");
     }
   else
-    panic_impossible ();
+    error ("unexpected dimensions keyword (= '%s') octave_float_complex_matrix::load_ascii - please report this bug", kw.c_str ());
 
   return true;
 }
--- a/libinterp/octave-value/ov-flt-re-mat.cc	Mon Apr 08 19:39:04 2024 -0400
+++ b/libinterp/octave-value/ov-flt-re-mat.cc	Mon Apr 08 19:39:34 2024 -0400
@@ -460,10 +460,10 @@
       else if (nr == 0 || nc == 0)
         m_matrix = FloatMatrix (nr, nc);
       else
-        panic_impossible ();
+        error ("unexpected dimensions in octave_float_matrix::load_ascii - please report this bug");
     }
   else
-    panic_impossible ();
+    error ("unexpected dimensions keyword (= '%s') octave_float_matrix::load_ascii - please report this bug", kw.c_str ());
 
   return true;
 }
--- a/libinterp/octave-value/ov-perm.cc	Mon Apr 08 19:39:04 2024 -0400
+++ b/libinterp/octave-value/ov-perm.cc	Mon Apr 08 19:39:34 2024 -0400
@@ -62,7 +62,7 @@
       break;
 
     default:
-      panic_impossible ();
+      error ("unexpected: index not '(', '{', or '.' in octave_perm_matrix::subsref - please report this bug");
     }
 
   return retval.next_subsref (type, idx);
--- a/libinterp/octave-value/ov-range.cc	Mon Apr 08 19:39:04 2024 -0400
+++ b/libinterp/octave-value/ov-range.cc	Mon Apr 08 19:39:34 2024 -0400
@@ -163,7 +163,7 @@
       break;
 
     default:
-      panic_impossible ();
+      error ("unexpected: index not '(', '{', or '.' in ov_range<T>::subsref - please report this bug");
     }
 
   return retval.next_subsref (type, idx);
--- a/libinterp/octave-value/ov-re-mat.cc	Mon Apr 08 19:39:04 2024 -0400
+++ b/libinterp/octave-value/ov-re-mat.cc	Mon Apr 08 19:39:34 2024 -0400
@@ -563,10 +563,10 @@
       else if (nr == 0 || nc == 0)
         m_matrix = Matrix (nr, nc);
       else
-        panic_impossible ();
+        error ("unexpected dimensions in octave_matrix::load_ascii - please report this bug");
     }
   else
-    panic_impossible ();
+    error ("unexpected dimensions keyword (= '%s') octave_matrix::load_ascii - please report this bug", kw.c_str ());
 
   return true;
 }
--- a/libinterp/octave-value/ov-str-mat.cc	Mon Apr 08 19:39:04 2024 -0400
+++ b/libinterp/octave-value/ov-str-mat.cc	Mon Apr 08 19:39:34 2024 -0400
@@ -344,8 +344,7 @@
           os << "# length: " << len << "\n";
           std::string tstr = chm.row_as_string (i);
           const char *tmp = tstr.data ();
-          if (tstr.length () > len)
-            panic_impossible ();
+          panic_if (tstr.length () > len);
           os.write (tmp, len);
           os << "\n";
         }
@@ -463,7 +462,7 @@
         }
     }
   else
-    panic_impossible ();
+    error ("unexpected dimensions keyword (= '%s') octave_char_matrix::load_ascii - please report this bug", kw.c_str ());
 
   return true;
 }
--- a/libinterp/octave-value/ov-struct.cc	Mon Apr 08 19:39:04 2024 -0400
+++ b/libinterp/octave-value/ov-struct.cc	Mon Apr 08 19:39:34 2024 -0400
@@ -190,7 +190,7 @@
       break;
 
     default:
-      panic_impossible ();
+      error ("unexpected: index not '(', '{', or '.' in octave_struct::subsref - please report this bug");
     }
 
   // FIXME: perhaps there should be an
@@ -259,7 +259,7 @@
       break;
 
     default:
-      panic_impossible ();
+      error ("unexpected: index not '(', '{', or '.' in octave_struct::subsref - please report this bug");
     }
 
   // FIXME: perhaps there should be an
@@ -434,7 +434,7 @@
           break;
 
         default:
-          panic_impossible ();
+          error ("unexpected: index not '(', '{', or '.' in octave_struct::subsasgn - please report this bug");
         }
     }
 
@@ -559,7 +559,7 @@
       break;
 
     default:
-      panic_impossible ();
+      error ("unexpected: index not '(', '{', or '.' in octave_struct::subsasgn - please report this bug");
     }
 
   retval.maybe_mutate ();
@@ -833,7 +833,7 @@
   else if (len == 0)
     m_map = octave_map (dv);
   else
-    panic_impossible ();
+    error ("unexpected: len < 0 in octave_struct::load_ascii - please report this bug");
 
   return success;
 }
@@ -1519,7 +1519,7 @@
   else if (len == 0)
     m_map = octave_scalar_map ();
   else
-    panic_impossible ();
+    error ("unexpected: len < 0 in octave_scalar_struct::load_ascii - please report this bug");
 
   return true;
 }
--- a/libinterp/octave-value/ov-usr-fcn.cc	Mon Apr 08 19:39:04 2024 -0400
+++ b/libinterp/octave-value/ov-usr-fcn.cc	Mon Apr 08 19:39:34 2024 -0400
@@ -709,11 +709,11 @@
 
   if (val.is_defined ())
     {
-      // Fail spectacularly if SAVED_WARNING_STATES is not an
-      // octave_map (or octave_scalar_map) object.
+      // Fail if SAVED_WARNING_STATES is not an octave_map (or
+      // octave_scalar_map) object.
 
       if (! val.isstruct ())
-        panic_impossible ();
+        error ("unexpected: SAVED_WARNING_STATES is not a struct in octave_user_function::restore_warning_states - please report this bug");
 
       octave_map m = val.map_value ();