changeset 33348:aa7cd2622228

eliminate some uses of panic_impossible in gl-render.cc * gl-render.cc (error_unexpected): New static function. Use it to replace panic_impossible in functions that should never be called unless HAVE_OPENGL is defined.
author John W. Eaton <jwe@octave.org>
date Sun, 07 Apr 2024 13:29:18 -0400
parents ea0da8f24871
children 1191eae272fa
files libinterp/corefcn/gl-render.cc
diffstat 1 files changed, 52 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/gl-render.cc	Sun Apr 07 11:05:18 2024 -0400
+++ b/libinterp/corefcn/gl-render.cc	Sun Apr 07 13:29:18 2024 -0400
@@ -678,6 +678,12 @@
   // Dummy class.
 };
 
+OCTAVE_NORETURN static void
+error_unexpected (const char *name)
+{
+  error ("unexpected call to %s when HAVE_OPENGL is not defined - please report this bug", name);
+}
+
 #endif
 
 opengl_renderer::opengl_renderer (opengl_functions& glfcns)
@@ -895,7 +901,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::init_gl_context");
 
 #endif
 }
@@ -971,7 +977,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::render_grid");
 
 #endif
 }
@@ -1053,7 +1059,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::render_tickmarks");
 
 #endif
 }
@@ -1123,7 +1129,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::render_ticktexts");
 
 #endif
 }
@@ -1149,7 +1155,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::draw_zoom_rect");
 
 #endif
 }
@@ -1214,7 +1220,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::draw_zoom_box");
 
 #endif
 }
@@ -1251,7 +1257,7 @@
   octave_unused_parameter (width);
   octave_unused_parameter (height);
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::get_pixels");
 
 #endif
 }
@@ -1268,7 +1274,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::finish");
 
 #endif
 }
@@ -1326,7 +1332,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::setup_opengl_transformation");
 
 #endif
 }
@@ -1386,7 +1392,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::draw_axes_planes");
 
 #endif
 }
@@ -1546,7 +1552,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::draw_axes_boxes");
 
 #endif
 }
@@ -1747,7 +1753,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::draw_axes_x_grid");
 
 #endif
 }
@@ -1949,7 +1955,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::draw_axes_y_grid");
 
 #endif
 }
@@ -2174,7 +2180,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::draw_axes_grids");
 
 #endif
 }
@@ -2221,7 +2227,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::draw_all_lights");
 
 #endif
 }
@@ -2310,7 +2316,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::draw_axes_children");
 
 #endif
 }
@@ -2382,7 +2388,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::draw_axes");
 
 #endif
 }
@@ -2528,7 +2534,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::draw_line");
 
 #endif
 }
@@ -3193,7 +3199,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::draw_surface");
 
 #endif
 }
@@ -3740,7 +3746,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::draw_patch");
 
 #endif
 }
@@ -3849,7 +3855,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::draw_scatter");
 
 #endif
 }
@@ -3886,7 +3892,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::draw_light");
 
 #endif
 }
@@ -3917,7 +3923,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::set_ortho_coordinates");
 
 #endif
 }
@@ -3938,7 +3944,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::restore_previous_coordinates");
 
 #endif
 }
@@ -3976,7 +3982,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::draw_text");
 
 #endif
 }
@@ -4062,7 +4068,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::draw_text_background");
 
 #endif
 }
@@ -4085,7 +4091,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::draw_image");
 
 #endif
 }
@@ -4168,7 +4174,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::draw_texture_image");
 
 #endif
 }
@@ -4204,7 +4210,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::set_viewport");
 
 #endif
 }
@@ -4231,7 +4237,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::get_viewport_scaled");
 
 #endif
 
@@ -4255,7 +4261,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::set_color");
 
 #endif
 }
@@ -4297,7 +4303,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::set_polygon_offset");
 
 #endif
 }
@@ -4316,7 +4322,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::set_linewidth");
 
 #endif
 }
@@ -4377,7 +4383,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::set_linestyle");
 
 #endif
 }
@@ -4427,7 +4433,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::set_clipbox");
 
 #endif
 }
@@ -4456,7 +4462,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::set_clipping");
 
 #endif
 }
@@ -4489,7 +4495,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::init_marker");
 
 #endif
 }
@@ -4510,7 +4516,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::change_marker");
 
 #endif
 }
@@ -4534,7 +4540,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::end_marker");
 
 #endif
 }
@@ -4586,7 +4592,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::draw_marker");
 
 #endif
 }
@@ -4609,7 +4615,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::init_maxlights");
 
 #endif
 }
@@ -4636,7 +4642,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::get_string");
   return std::string ();
 
 #endif
@@ -4671,7 +4677,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::set_normal");
 
 #endif
 }
@@ -4885,7 +4891,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::make_marker_list");
 
 #endif
 }
@@ -4945,7 +4951,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::render_text");
 
 #endif
 }
@@ -5001,7 +5007,7 @@
   // This shouldn't happen because construction of opengl_renderer
   // objects is supposed to be impossible if OpenGL is not available.
 
-  panic_impossible ();
+  error_unexpected ("opengl_renderer::render_text");
 
 #endif
 }