Mercurial > octave
diff libinterp/octave-value/ov.cc @ 29954:4c88a452519c
rename OCTAVE_USE_DEPRECATED_FUNCTIONS macro and attempt to make it work
For ordinary functions declared in a header file and defined in a
corresponding source file, it should be OK to omit the declaration in
the header file based on the value of
OCTAVE_PROVIDE_DEPRECATED_SYMBOLS. But it is an error to attempt to
define a member function that has not been declared in the class
declaration. So for these, we rename the original function to be
FOO_deprecated and then provide a wrapper function called FOO that is
completely defined in the header file and simply calls the
FOO_deprecated function.
* mk-octave-config-h.sh, oct-conf-post.in.h
(OCTAVE_PROVIDE_DEPRECATED_SYMBOLS): Rename from
OCTAVE_USE_DEPRECATED_FUNCTIONS. Change all uses. For deprecated
member fucntions, use private FOO_deprecated member functions and
conditionally defined inline public wrappers to allow declarations of
deprecated symbosl to be omitted if OCTAVE_PROVIDE_DEPRECATED_SYMBOLS
is not defined.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 14 Aug 2021 11:13:17 -0400 |
parents | aa98b5fdfbbb |
children | 32c3a5805893 |
line wrap: on
line diff
--- a/libinterp/octave-value/ov.cc Sat Aug 14 10:40:21 2021 -0400 +++ b/libinterp/octave-value/ov.cc Sat Aug 14 11:13:17 2021 -0400 @@ -1068,24 +1068,25 @@ maybe_mutate (); } -octave_value::octave_value (double base, double limit, double inc) - : rep (new ov_range<double> (octave::range<double> (base, inc, limit))) +// Remove when public constructor that uses this function is removed. +octave_base_value * +make_range_rep_deprecated (double base, double inc, double limit) { - maybe_mutate (); + return dynamic_cast<octave_base_value *> + (new ov_range<double> (octave::range<double> (base, inc, limit))); } -octave_value::octave_value (const Range& r, bool force_range) - : rep (nullptr) +// Remove when public constructor that uses this function is removed. +octave_base_value * +make_range_rep_deprecated (const Range& r, bool force_range) { if (! force_range && ! r.ok ()) error ("invalid range"); if (force_range || ! Vdisable_range) - rep = dynamic_cast<octave_base_value *> (new ov_range<double> (octave::range<double> (r.base (), r.increment (), r.limit ()))); + return make_range_rep_deprecated (r.base (), r.increment (), r.limit ()); else - rep = dynamic_cast<octave_base_value *> (new octave_matrix (r.matrix_value ())); - - maybe_mutate (); + return dynamic_cast<octave_base_value *> (new octave_matrix (r.matrix_value ())); } octave_value::octave_value (const octave::range<char>& r, char type,