changeset 31883:56809fe23e53

eliminate some clang warnings about defaulted functions being deleted * oct-conf-post-public.in.h (OCTAVE_DISABLE_COPY_MOVE_ASGN, OCTAVE_DEFAULT_COPY_MOVE_CTOR, OCTAVE_DEFAULT_CONSTRUCT_DELETE): New macros. * gl-render.cc (opengl_renderer::draw_all_lights): Use reference to base_propertoes since copying is not allowed. * __init_fltk__.cc (fltk_uimenu::remove_from_menu): Likewise, for uimenu::properties. * ls-hdf5.h (hdf5_fstreambase): Disable copy and move instead of requesting defaults. * pager.h (diary_buf): Likewise. * graphics.in.h (base_properties): Likewise. * kpse.h (kpse_path_iterator): Disable assignment. * octave-preserve-stream-state.h (preserve_stream_state): Likewise. * graphics.in.h (radio_property, color_property, double_radio_property, bool_property, any_property): Likewise. * pager.h (pager_buf): Disable copy and move.
author John W. Eaton <jwe@octave.org>
date Fri, 03 Mar 2023 16:04:18 -0500
parents 3bdfda4f7c16
children c3858bef069a
files libinterp/corefcn/genprops.awk libinterp/corefcn/gl-render.cc libinterp/corefcn/graphics.in.h libinterp/corefcn/ls-hdf5.h libinterp/corefcn/pager.h libinterp/dldfcn/__init_fltk__.cc liboctave/util/kpse.h liboctave/util/octave-preserve-stream-state.h oct-conf-post-public.in.h src/octave-svgconvert.cc
diffstat 10 files changed, 59 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/genprops.awk	Fri Mar 03 14:04:18 2023 -0500
+++ b/libinterp/corefcn/genprops.awk	Fri Mar 03 16:04:18 2023 -0500
@@ -284,7 +284,7 @@
   printf ("public:\n");
   printf ("  properties (const graphics_handle& mh, const graphics_handle& p);\n\n");
   printf ("  properties () = delete;\n\n");
-  printf ("  OCTAVE_DEFAULT_COPY_MOVE (properties)\n\n");
+  printf ("  OCTAVE_DISABLE_COPY_MOVE (properties)\n\n");
   printf ("  ~properties () = default;\n\n");
   printf ("  void set (const caseless_str& pname, const octave_value& val);\n\n");
   printf ("  octave_value get (bool all = false) const;\n\n");
--- a/libinterp/corefcn/gl-render.cc	Fri Mar 03 14:04:18 2023 -0500
+++ b/libinterp/corefcn/gl-render.cc	Fri Mar 03 16:04:18 2023 -0500
@@ -2174,7 +2174,7 @@
     {
       graphics_object go = gh_mgr.get_object (children(i));
 
-      base_properties p = go.get_properties ();
+      base_properties& p = go.get_properties ();
 
       if (p.is_visible ()
           || (m_selecting && p.pickableparts_is ("all")))
--- a/libinterp/corefcn/graphics.in.h	Fri Mar 03 14:04:18 2023 -0500
+++ b/libinterp/corefcn/graphics.in.h	Fri Mar 03 16:04:18 2023 -0500
@@ -959,7 +959,10 @@
     : base_property (nm, h),
       m_vals (v), m_current_val (def) { }
 
-  OCTAVE_DEFAULT_COPY_MOVE_DELETE (radio_property)
+  OCTAVE_DEFAULT_COPY_MOVE_CTOR (radio_property)
+  OCTAVE_DISABLE_COPY_MOVE_ASGN (radio_property)
+
+  ~radio_property () = default;
 
   octave_value get () const { return octave_value (m_current_val); }
 
@@ -1116,7 +1119,10 @@
       m_radio_val (v.m_radio_val), m_current_val (v.m_current_val)
   { }
 
-  OCTAVE_DEFAULT_COPY_MOVE_DELETE (color_property)
+  OCTAVE_DEFAULT_COPY_MOVE_CTOR (color_property)
+  OCTAVE_DISABLE_COPY_MOVE_ASGN (color_property)
+
+  ~color_property () = default;
 
   octave_value get () const
   {
@@ -1330,7 +1336,10 @@
       m_radio_val (v.m_radio_val), m_current_val (v.m_current_val)
   { }
 
-  OCTAVE_DEFAULT_COPY_MOVE_DELETE (double_radio_property)
+  OCTAVE_DEFAULT_COPY_MOVE_CTOR (double_radio_property)
+  OCTAVE_DISABLE_COPY_MOVE_ASGN (double_radio_property)
+
+  ~double_radio_property () = default;
 
   octave_value get () const
   {
@@ -1645,7 +1654,10 @@
                                            "{on}|off" : "on|{off}"), val)
   { }
 
-  OCTAVE_DEFAULT_COPY_MOVE_DELETE (bool_property)
+  OCTAVE_DEFAULT_COPY_MOVE_CTOR (bool_property)
+  OCTAVE_DISABLE_COPY_MOVE_ASGN (bool_property)
+
+  ~bool_property () = default;
 
   bool is_on () const { return is ("on"); }
 
@@ -1731,10 +1743,8 @@
                 const octave_value& m = Matrix ())
     : base_property (nm, h), m_data (m) { }
 
-  any_property (const any_property&) = default;
-
-  // FIXME: should we define assignment?
-  any_property& operator = (const any_property&) = default;
+  OCTAVE_DEFAULT_COPY_MOVE_CTOR (any_property)
+  OCTAVE_DISABLE_COPY_MOVE_ASGN (any_property)
 
   ~any_property () = default;
 
@@ -2238,7 +2248,7 @@
                    const graphics_handle& mh = graphics_handle (),
                    const graphics_handle& p = graphics_handle ());
 
-  OCTAVE_DEFAULT_COPY_MOVE (base_properties)
+  OCTAVE_DISABLE_COPY_MOVE (base_properties)
 
   virtual ~base_properties () = default;
 
--- a/libinterp/corefcn/ls-hdf5.h	Fri Mar 03 14:04:18 2023 -0500
+++ b/libinterp/corefcn/ls-hdf5.h	Fri Mar 03 16:04:18 2023 -0500
@@ -51,7 +51,7 @@
 
   hdf5_fstreambase () : file_id (-1), current_item () { }
 
-  OCTAVE_DEFAULT_COPY_MOVE (hdf5_fstreambase)
+  OCTAVE_DISABLE_COPY_MOVE (hdf5_fstreambase)
 
   ~hdf5_fstreambase () { close (); }
 
--- a/libinterp/corefcn/pager.h	Fri Mar 03 14:04:18 2023 -0500
+++ b/libinterp/corefcn/pager.h	Fri Mar 03 16:04:18 2023 -0500
@@ -97,7 +97,8 @@
 {
 public:
 
-  OCTAVE_DEFAULT_CONSTRUCT_COPY_MOVE_DELETE (diary_buf)
+  OCTAVE_DEFAULT_CONSTRUCT_DELETE (diary_buf)
+  OCTAVE_DISABLE_COPY_MOVE (diary_buf)
 
 protected:
 
--- a/libinterp/dldfcn/__init_fltk__.cc	Fri Mar 03 14:04:18 2023 -0500
+++ b/libinterp/dldfcn/__init_fltk__.cc	Fri Mar 03 16:04:18 2023 -0500
@@ -653,8 +653,8 @@
 
         if (kgo.valid_object ())
           {
-            uimenu::properties& kprop = dynamic_cast<uimenu::properties&>
-                                        (kgo.get_properties ());
+            uimenu::properties& kprop
+              = dynamic_cast<uimenu::properties&> (kgo.get_properties ());
 
             // if no pos yet, delay adding menu until after other menus
             int pos = kprop.get_position ();
@@ -674,8 +674,8 @@
 
         if (kgo.valid_object ())
           {
-            uimenu::properties& kprop = dynamic_cast<uimenu::properties&>
-                                        (kgo.get_properties ());
+            uimenu::properties& kprop
+              = dynamic_cast<uimenu::properties&> (kgo.get_properties ());
             add_to_menu (kprop);
             update_position (kprop, ++count);
           }
@@ -699,8 +699,8 @@
 
         if (kgo.valid_object ())
           {
-            uimenu::properties& kprop = dynamic_cast<uimenu::properties&>
-                                        (kgo.get_properties ());
+            uimenu::properties& kprop
+              = dynamic_cast<uimenu::properties&> (kgo.get_properties ());
 
             // if no pos yet, delay adding menu until after other menus
             int pos = kprop.get_position ();
@@ -721,8 +721,8 @@
 
         if (kgo.valid_object ())
           {
-            uimenu::properties& kprop = dynamic_cast<uimenu::properties&>
-                                        (kgo.get_properties ());
+            uimenu::properties& kprop
+              = dynamic_cast<uimenu::properties&> (kgo.get_properties ());
             add_to_menu (kprop);
             update_position (kprop, ++count);
           }
@@ -745,8 +745,8 @@
 
         if (kgo.valid_object ())
           {
-            uimenu::properties kprop = dynamic_cast<uimenu::properties&>
-                                       (kgo.get_properties ());
+            uimenu::properties& kprop
+              = dynamic_cast<uimenu::properties&> (kgo.get_properties ());
             remove_from_menu (kprop);
           }
       }
--- a/liboctave/util/kpse.h	Fri Mar 03 14:04:18 2023 -0500
+++ b/liboctave/util/kpse.h	Fri Mar 03 16:04:18 2023 -0500
@@ -46,7 +46,10 @@
     set_end ();
   }
 
-  OCTAVE_DEFAULT_COPY_MOVE_DELETE (kpse_path_iterator)
+  OCTAVE_DEFAULT_COPY_MOVE_CTOR (kpse_path_iterator)
+  OCTAVE_DISABLE_COPY_MOVE_ASGN (kpse_path_iterator)
+
+  ~kpse_path_iterator () = default;
 
   kpse_path_iterator operator ++ (int)
   {
--- a/liboctave/util/octave-preserve-stream-state.h	Fri Mar 03 14:04:18 2023 -0500
+++ b/liboctave/util/octave-preserve-stream-state.h	Fri Mar 03 16:04:18 2023 -0500
@@ -44,7 +44,8 @@
       m_owidth (s.width ()), m_ofill (s.fill ())
   { }
 
-  OCTAVE_DEFAULT_COPY_MOVE (preserve_stream_state)
+  OCTAVE_DEFAULT_COPY_MOVE_CTOR (preserve_stream_state)
+  OCTAVE_DISABLE_COPY_MOVE_ASGN (preserve_stream_state)
 
   ~preserve_stream_state ()
   {
--- a/oct-conf-post-public.in.h	Fri Mar 03 14:04:18 2023 -0500
+++ b/oct-conf-post-public.in.h	Fri Mar 03 16:04:18 2023 -0500
@@ -335,6 +335,11 @@
   OCTAVE_DISABLE_COPY (X)                       \
   OCTAVE_DISABLE_MOVE (X)
 
+#  define OCTAVE_DISABLE_COPY_MOVE_ASGN(X)      \
+  X& operator = (const X&) = delete;            \
+  X& operator = (X&&) = delete;                 \
+  X& operator = (const X&&) = delete;
+
 #  define OCTAVE_DISABLE_CONSTRUCT_COPY_MOVE(X) \
   X () = delete;                                \
   OCTAVE_DISABLE_COPY (X)                       \
@@ -358,6 +363,10 @@
   OCTAVE_DEFAULT_COPY (X)                       \
   OCTAVE_DEFAULT_MOVE (X)
 
+#  define OCTAVE_DEFAULT_COPY_MOVE_CTOR(X)      \
+  X (const X&) = default;                       \
+  X (X&&) = default;
+
 #  define OCTAVE_DEFAULT_CONSTRUCT_COPY(X)      \
   X () = default;                               \
   OCTAVE_DEFAULT_COPY (X)
@@ -374,15 +383,18 @@
   OCTAVE_DEFAULT_COPY_MOVE (X)                  \
   ~X () = default;
 
-#  define OCTAVE_DEFAULT_CONSTRUCT_COPY_DELETE(X)       \
-  X () = default;                                       \
-  OCTAVE_DEFAULT_COPY (X)                               \
+#  define OCTAVE_DEFAULT_CONSTRUCT_DELETE(X)    \
+  X () = default;                               \
   ~X () = default;
 
+#  define OCTAVE_DEFAULT_CONSTRUCT_COPY_DELETE(X)       \
+  OCTAVE_DEFAULT_CONSTRUCT_DELETE (X)                   \
+  OCTAVE_DEFAULT_COPY (X)                               \
+
 #  define OCTAVE_DEFAULT_CONSTRUCT_COPY_MOVE_DELETE(X)  \
-  X () = default;                                       \
-  OCTAVE_DEFAULT_COPY_MOVE (X)                          \
-  ~X () = default;
+  OCTAVE_DEFAULT_CONSTRUCT_DELETE (X)                   \
+  OCTAVE_DEFAULT_COPY_MOVE (X)
+
 #endif
 
 typedef OCTAVE_IDX_TYPE octave_idx_type;
--- a/src/octave-svgconvert.cc	Fri Mar 03 14:04:18 2023 -0500
+++ b/src/octave-svgconvert.cc	Fri Mar 03 16:04:18 2023 -0500
@@ -73,7 +73,7 @@
     setWindow (sz.toRect ());
   }
 
-  OCTAVE_DEFAULT_COPY_MOVE (pdfpainter)
+  OCTAVE_DISABLE_COPY_MOVE (pdfpainter)
 
   ~pdfpainter () { end (); }