diff liboctave/array/idx-vector.cc @ 33248:7f73e4805a1f

replace calls to assert with liboctave_panic functions liboctave * lo-error.h (liboctave_panic_impossible, liboctave_panic_if, liboctave_panic_unless): New macros. Replace all calls to assert with panic_if, panic_impossible, or panic_unless as appropriate. Include "lo-error.h" as needed. Don't include <cassert>. Affected files: Array-base.cc, Array-util.cc, Array.h, CSparse.cc, DiagArray2.cc, 1 DiagArray2.h, Sparse.cc, Sparse.h, dim-vector.h, idx-vector.cc, idx-vector.h, CollocWt.cc, Quad.cc, oct-rand.cc, qrp.cc, svd.cc, Sparse-perm-op-defs.h, and oct-sort.cc.
author John W. Eaton <jwe@octave.org>
date Sun, 24 Mar 2024 18:12:34 -0400
parents f53ac65ffba6
children c9517a0c9cc2
line wrap: on
line diff
--- a/liboctave/array/idx-vector.cc	Mon Mar 25 00:43:53 2024 -0400
+++ b/liboctave/array/idx-vector.cc	Sun Mar 24 18:12:34 2024 -0400
@@ -1030,7 +1030,7 @@
 
   idx_vector_rep *r = dynamic_cast<idx_vector_rep *> (m_rep);
 
-  assert (r != nullptr);
+  liboctave_panic_unless (r != nullptr);
 
   return r->get_data ();
 }
@@ -1088,7 +1088,7 @@
       break;
 
     default:
-      assert (false);
+      liboctave_panic_impossible ();
       break;
     }
 }
@@ -1156,7 +1156,7 @@
 idx_vector
 idx_vector::inverse_permutation (octave_idx_type n) const
 {
-  assert (n == length (n));
+  liboctave_panic_unless (n == length (n));
 
   idx_vector retval;
 
@@ -1252,7 +1252,7 @@
       break;
 
     default:
-      assert (false);
+      liboctave_panic_impossible ();
       break;
     }
 }