Mercurial > octave
changeset 31856:c80cf1588ed0
move default constructor for octave_base_value from .h to .cc file
The default constructor for octave_base_value uses the deprecated
count variable. We want to disable GCC's deprecated-declarations
warning for unavoidable uses in Octave's sources. But we can't do
that in a public header file like ov-base.h because we don't export
environment-specific flags like HAVE_PRAGMA_GCC_DIAGNOSTIC in
octave-config.h. Instead, define the constructor in ov-base.cc where
we can use HAVE_PRAGMA_GCC_DIAGNOSTIC because it is available from
Octave's private config.h file.
* ov-base.cc (octave_base_value::octave_base_value): Define ctor here
instead of in ov-base.h.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 25 Feb 2023 10:28:39 -0500 |
parents | 1daf8bfceac3 |
children | 3daa1cfe091d |
files | libinterp/octave-value/ov-base.cc libinterp/octave-value/ov-base.h |
diffstat | 2 files changed, 15 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/octave-value/ov-base.cc Fri Feb 17 23:27:46 2023 -0500 +++ b/libinterp/octave-value/ov-base.cc Sat Feb 25 10:28:39 2023 -0500 @@ -101,6 +101,20 @@ // DEPRECATED in Octave 8. bool Vsparse_auto_mutate = false; +#if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC) + // Disable this warning for the use of the "count" member variable in + // the default constructor. Push the current state so we can restore + // the warning state. +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + + octave_base_value::octave_base_value () : m_count (1), count (m_count) { } + +#if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC) +# pragma GCC diagnostic pop +#endif + octave_base_value * octave_base_value::empty_clone () const {
--- a/libinterp/octave-value/ov-base.h Fri Feb 17 23:27:46 2023 -0500 +++ b/libinterp/octave-value/ov-base.h Sat Feb 25 10:28:39 2023 -0500 @@ -262,19 +262,7 @@ friend class octave_value; -#if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC) - // Disable this warning for the use of the "count" member variable in - // the default constructor. Push the current state so we can restore - // the warning state. -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wdeprecated-declarations" -#endif - - octave_base_value () : m_count (1), count (m_count) { } - -#if defined (HAVE_PRAGMA_GCC_DIAGNOSTIC) -# pragma GCC diagnostic pop -#endif + octave_base_value (); octave_base_value (const octave_base_value&) : octave_base_value () { }