changeset 26919:c33ac5ca0a7a

avoid some overloaded virtual warnings (bug #55741) * ov-base-diag.h, ov-base-sparse.h, ov-complex.h, ov-float.h, ov-flt-complex.h, ov-lazy-idx.h, ov-perm.h, ov-scalar.h, ov-str-mat.h: Avoid overloaded virtual method warnings for classes derived from octave_function that partially overload the two virtual diag methods by adding using declarations.
author John W. Eaton <jwe@octave.org>
date Fri, 15 Mar 2019 06:38:07 +0000
parents 0a13d8d19790
children e0111653adcf
files libinterp/octave-value/ov-base-diag.h libinterp/octave-value/ov-base-sparse.h libinterp/octave-value/ov-complex.h libinterp/octave-value/ov-float.h libinterp/octave-value/ov-flt-complex.h libinterp/octave-value/ov-lazy-idx.h libinterp/octave-value/ov-perm.h libinterp/octave-value/ov-scalar.h libinterp/octave-value/ov-str-mat.h
diffstat 9 files changed, 50 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-base-diag.h	Fri Mar 15 06:36:56 2019 +0000
+++ b/libinterp/octave-value/ov-base-diag.h	Fri Mar 15 06:38:07 2019 +0000
@@ -109,6 +109,11 @@
   MatrixType matrix_type (const MatrixType&) const
   { return matrix_type (); }
 
+  // We don't need to override both forms of the diag method.  The using
+  // declaration will avoid warnings about partially-overloaded virtual
+  // functions.
+  using octave_base_value::diag;
+
   octave_value diag (octave_idx_type k = 0) const;
 
   octave_value sort (octave_idx_type dim = 0, sortmode mode = ASCENDING) const
--- a/libinterp/octave-value/ov-base-sparse.h	Fri Mar 15 06:36:56 2019 +0000
+++ b/libinterp/octave-value/ov-base-sparse.h	Fri Mar 15 06:38:07 2019 +0000
@@ -127,6 +127,11 @@
   octave_value all (int dim = 0) const { return matrix.all (dim); }
   octave_value any (int dim = 0) const { return matrix.any (dim); }
 
+  // We don't need to override both forms of the diag method.  The using
+  // declaration will avoid warnings about partially-overloaded virtual
+  // functions.
+  using octave_base_value::diag;
+
   octave_value diag (octave_idx_type k = 0) const
   { return octave_value (matrix.diag (k)); }
 
--- a/libinterp/octave-value/ov-complex.h	Fri Mar 15 06:36:56 2019 +0000
+++ b/libinterp/octave-value/ov-complex.h	Fri Mar 15 06:38:07 2019 +0000
@@ -159,6 +159,11 @@
   octave_value as_double (void) const;
   octave_value as_single (void) const;
 
+  // We don't need to override both forms of the diag method.  The using
+  // declaration will avoid warnings about partially-overloaded virtual
+  // functions.
+  using octave_base_scalar<Complex>::diag;
+
   octave_value diag (octave_idx_type m, octave_idx_type n) const;
 
   void increment (void) { scalar += 1.0; }
--- a/libinterp/octave-value/ov-float.h	Fri Mar 15 06:36:56 2019 +0000
+++ b/libinterp/octave-value/ov-float.h	Fri Mar 15 06:38:07 2019 +0000
@@ -229,6 +229,11 @@
   octave_value as_uint32 (void) const;
   octave_value as_uint64 (void) const;
 
+  // We don't need to override both forms of the diag method.  The using
+  // declaration will avoid warnings about partially-overloaded virtual
+  // functions.
+  using octave_base_scalar<float>::diag;
+
   octave_value diag (octave_idx_type m, octave_idx_type n) const;
 
   octave_value convert_to_str_internal (bool pad, bool force, char type) const;
--- a/libinterp/octave-value/ov-flt-complex.h	Fri Mar 15 06:36:56 2019 +0000
+++ b/libinterp/octave-value/ov-flt-complex.h	Fri Mar 15 06:38:07 2019 +0000
@@ -155,6 +155,11 @@
   octave_value as_double (void) const;
   octave_value as_single (void) const;
 
+  // We don't need to override both forms of the diag method.  The using
+  // declaration will avoid warnings about partially-overloaded virtual
+  // functions.
+  using octave_base_scalar<FloatComplex>::diag;
+
   octave_value diag (octave_idx_type m, octave_idx_type n) const;
 
   void increment (void) { scalar += 1.0; }
--- a/libinterp/octave-value/ov-lazy-idx.h	Fri Mar 15 06:36:56 2019 +0000
+++ b/libinterp/octave-value/ov-lazy-idx.h	Fri Mar 15 06:38:07 2019 +0000
@@ -182,6 +182,11 @@
   FORWARD_VALUE_QUERY1 (SparseMatrix, sparse_matrix_value)
   FORWARD_VALUE_QUERY1 (SparseComplexMatrix, sparse_complex_matrix_value)
 
+  // We don't need to override both forms of the diag method.  The using
+  // declaration will avoid warnings about partially-overloaded virtual
+  // functions.
+  using octave_base_value::diag;
+
   octave_value diag (octave_idx_type k = 0) const
   {
     return make_value ().diag (k);
--- a/libinterp/octave-value/ov-perm.h	Fri Mar 15 06:36:56 2019 +0000
+++ b/libinterp/octave-value/ov-perm.h	Fri Mar 15 06:38:07 2019 +0000
@@ -91,6 +91,11 @@
   MatrixType matrix_type (const MatrixType&) const
   { return matrix_type (); }
 
+  // We don't need to override both forms of the diag method.  The using
+  // declaration will avoid warnings about partially-overloaded virtual
+  // functions.
+  using octave_base_value::diag;
+
   octave_value diag (octave_idx_type k = 0) const
   { return to_dense () .diag (k); }
 
--- a/libinterp/octave-value/ov-scalar.h	Fri Mar 15 06:36:56 2019 +0000
+++ b/libinterp/octave-value/ov-scalar.h	Fri Mar 15 06:38:07 2019 +0000
@@ -232,6 +232,11 @@
   octave_value as_uint32 (void) const;
   octave_value as_uint64 (void) const;
 
+  // We don't need to override both forms of the diag method.  The using
+  // declaration will avoid warnings about partially-overloaded virtual
+  // functions.
+  using octave_base_scalar<double>::diag;
+
   octave_value diag (octave_idx_type m, octave_idx_type n) const;
 
   octave_value convert_to_str_internal (bool pad, bool force, char type) const;
--- a/libinterp/octave-value/ov-str-mat.h	Fri Mar 15 06:36:56 2019 +0000
+++ b/libinterp/octave-value/ov-str-mat.h	Fri Mar 15 06:38:07 2019 +0000
@@ -106,6 +106,11 @@
 
   octave_value resize (const dim_vector& dv, bool fill = false) const;
 
+  // We don't need to override both forms of the diag method.  The using
+  // declaration will avoid warnings about partially-overloaded virtual
+  // functions.
+  using octave_char_matrix::diag;
+
   octave_value diag (octave_idx_type k = 0) const
   { return octave_value (matrix.diag (k)); }
 
@@ -237,6 +242,11 @@
     return octave_value (retval, '\'');
   }
 
+  // We don't need to override both forms of the diag method.  The using
+  // declaration will avoid warnings about partially-overloaded virtual
+  // functions.
+  using octave_char_matrix_str::diag;
+
   octave_value diag (octave_idx_type k = 0) const
   { return octave_value (matrix.diag (k), '\''); }