Mercurial > octave
changeset 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.
line wrap: on
line diff
--- a/build-aux/mk-octave-config-h.sh Sat Aug 14 10:40:21 2021 -0400 +++ b/build-aux/mk-octave-config-h.sh Sat Aug 14 11:13:17 2021 -0400 @@ -174,7 +174,7 @@ # endif # endif -# define OCTAVE_USE_DEPRECATED_FUNCTIONS 1 +# define OCTAVE_PROVIDE_DEPRECATED_SYMBOLS 1 # if defined (__cplusplus) template <typename T>
--- a/libinterp/corefcn/error.h Sat Aug 14 10:40:21 2021 -0400 +++ b/libinterp/corefcn/error.h Sat Aug 14 11:13:17 2021 -0400 @@ -334,9 +334,12 @@ OCTINTERP_API void save_exception (const execution_exception& ee); + // FIXME + //#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (7, "second argument is no longer accepted") OCTINTERP_API void display_exception (const execution_exception& ee, std::ostream& os) const; + //#endif OCTINTERP_API void display_exception (const execution_exception& ee) const; @@ -520,10 +523,12 @@ extern OCTINTERP_API void interpreter_try (octave::unwind_protect&); +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (6, "this variable is obsolete and always has the value 0") extern OCTINTERP_API int error_state; OCTAVE_DEPRECATED (6, "this function is obsolete and should not be needed") inline void reset_error_handler (void) { } +#endif #endif
--- a/libinterp/corefcn/errwarn.h Sat Aug 14 10:40:21 2021 -0400 +++ b/libinterp/corefcn/errwarn.h Sat Aug 14 11:13:17 2021 -0400 @@ -188,13 +188,11 @@ extern OCTINTERP_API void warn_wrong_type_arg (const char *name, const octave_value& tc); -#if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS) - +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (6, "this function will be removed in a future version of Octave") inline void warn_divide_by_zero (void) { } - #endif #endif
--- a/libinterp/corefcn/file-io.h Sat Aug 14 10:40:21 2021 -0400 +++ b/libinterp/corefcn/file-io.h Sat Aug 14 11:13:17 2021 -0400 @@ -32,10 +32,12 @@ #include <string> +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (6, "use 'interpreter::mark_for_deletion' instead") extern OCTINTERP_API void mark_for_deletion (const std::string&); OCTAVE_DEPRECATED (6, "use 'interpreter::cleanup_tmp_files' instead") extern OCTINTERP_API void cleanup_tmp_files (void); +#endif #endif
--- a/libinterp/corefcn/graphics-toolkit.h Sat Aug 14 10:40:21 2021 -0400 +++ b/libinterp/corefcn/graphics-toolkit.h Sat Aug 14 11:13:17 2021 -0400 @@ -285,10 +285,12 @@ }; } +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (6, "use 'octave::graphics_toolkit' instead") typedef octave::graphics_toolkit graphics_toolkit; OCTAVE_DEPRECATED (6, "use 'octave::base_graphics_toolkit' instead") typedef octave::base_graphics_toolkit base_graphics_toolkit; +#endif #endif
--- a/libinterp/corefcn/hook-fcn.h Sat Aug 14 10:40:21 2021 -0400 +++ b/libinterp/corefcn/hook-fcn.h Sat Aug 14 11:13:17 2021 -0400 @@ -213,6 +213,7 @@ }; } +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (7, "use 'octave::base_hook_function' instead") typedef octave::base_hook_function base_hook_function; @@ -227,5 +228,6 @@ OCTAVE_DEPRECATED (7, "use 'octave::hook_function_list' instead") typedef octave::hook_function_list hook_function_list; +#endif #endif
--- a/libinterp/corefcn/input.h Sat Aug 14 10:40:21 2021 -0400 +++ b/libinterp/corefcn/input.h Sat Aug 14 11:13:17 2021 -0400 @@ -48,8 +48,10 @@ // the next user prompt. extern OCTINTERP_API bool Vdrawnow_requested; +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (6, "'Vtrack_line_num' is an obsolete internal variable; any uses should be removed") extern OCTINTERP_API bool Vtrack_line_num; +#endif extern OCTINTERP_API octave::sys::time Vlast_prompt_time;
--- a/libinterp/corefcn/interpreter.cc Sat Aug 14 10:40:21 2021 -0400 +++ b/libinterp/corefcn/interpreter.cc Sat Aug 14 11:13:17 2021 -0400 @@ -1992,7 +1992,8 @@ return found; } - void interpreter::add_atexit_function (const std::string& fname) + // Remove when corresponding public deprecated function is removed. + void interpreter::add_atexit_function_deprecated (const std::string& fname) { interpreter& interp = __get_interpreter__ ("interpreter::add_atexit_function"); @@ -2000,7 +2001,8 @@ interp.add_atexit_fcn (fname); } - bool interpreter::remove_atexit_function (const std::string& fname) + // Remove when corresponding public deprecated function is removed. + bool interpreter::remove_atexit_function_deprecated (const std::string& fname) { interpreter& interp = __get_interpreter__ ("interpreter::remove_atexit_function");
--- a/libinterp/corefcn/interpreter.h Sat Aug 14 10:40:21 2021 -0400 +++ b/libinterp/corefcn/interpreter.h Sat Aug 14 11:13:17 2021 -0400 @@ -538,11 +538,29 @@ bool remove_atexit_fcn (const std::string& fname); + private: + + // Remove when corresponding public deprecated function is removed. + static void add_atexit_function_deprecated (const std::string& fname); + + // Remove when corresponding public deprecated function is removed. + static bool remove_atexit_function_deprecated (const std::string& fname); + + public: + +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (6, "use interpreter::add_atexit_fcn member function instead") - static void add_atexit_function (const std::string& fname); + static void add_atexit_function (const std::string& fname) + { + add_atexit_function_deprecated (fname); + } OCTAVE_DEPRECATED (6, "use interpreter::remove_atexit_fcn member function instead") - static bool remove_atexit_function (const std::string& fname); + static bool remove_atexit_function (const std::string& fname) + { + return remove_atexitfunction_deprecated (fname); + } + #endif static interpreter * the_interpreter (void) { return instance; }
--- a/libinterp/corefcn/symtab.cc Sat Aug 14 10:40:21 2021 -0400 +++ b/libinterp/corefcn/symtab.cc Sat Aug 14 11:13:17 2021 -0400 @@ -722,93 +722,93 @@ return octave_value (info_map); } - // DEPRECATED - bool symbol_table::at_top_level (void) + // Remove when corresponding public deprecated function is removed. + bool symbol_table::at_top_level_deprecated (void) { return m_interpreter.at_top_level (); } - // DEPRECATED - octave_value symbol_table::varval (const std::string& name) const + // Remove when corresponding public deprecated function is removed. + octave_value symbol_table::varval_deprecated (const std::string& name) const { return m_interpreter.varval (name); } - // DEPRECATED - octave_value symbol_table::global_varval (const std::string& name) const + // Remove when corresponding public deprecated function is removed. + octave_value symbol_table::global_varval_deprecated (const std::string& name) const { return m_interpreter.global_varval (name); } - // DEPRECATED - octave_value symbol_table::top_level_varval (const std::string& name) const + // Remove when corresponding public deprecated function is removed. + octave_value symbol_table::top_level_varval_deprecated (const std::string& name) const { return m_interpreter.top_level_varval (name); } - // DEPRECATED - std::list<std::string> symbol_table::global_variable_names (void) + // Remove when corresponding public deprecated function is removed. + std::list<std::string> symbol_table::global_variable_names_deprecated (void) { return m_interpreter.global_variable_names (); } - // DEPRECATED - std::list<std::string> symbol_table::top_level_variable_names (void) + // Remove when corresponding public deprecated function is removed. + std::list<std::string> symbol_table::top_level_variable_names_deprecated (void) { return m_interpreter.top_level_variable_names (); } - // DEPRECATED - std::list<std::string> symbol_table::variable_names (void) + // Remove when corresponding public deprecated function is removed. + std::list<std::string> symbol_table::variable_names_deprecated (void) { return m_interpreter.variable_names (); } - // DEPRECATED - void symbol_table::assign (const std::string& name, const octave_value& value) + // Remove when corresponding public deprecated function is removed. + void symbol_table::assign_deprecated (const std::string& name, const octave_value& value) { return m_interpreter.assign (name, value); } - // DEPRECATED - void symbol_table::clear_all (bool force) + // Remove when corresponding public deprecated function is removed. + void symbol_table::clear_all_deprecated (bool force) { return m_interpreter.clear_all (force); } - // DEPRECATED - void symbol_table::clear_global (const std::string& name) + // Remove when corresponding public deprecated function is removed. + void symbol_table::clear_global_deprecated (const std::string& name) { return m_interpreter.clear_global_variable (name); } - // DEPRECATED - void symbol_table::clear_global_pattern (const std::string& pattern) + // Remove when corresponding public deprecated function is removed. + void symbol_table::clear_global_pattern_deprecated (const std::string& pattern) { return m_interpreter.clear_global_variable_pattern (pattern); } - // DEPRECATED - void symbol_table::clear_symbol (const std::string& name) + // Remove when corresponding public deprecated function is removed. + void symbol_table::clear_symbol_deprecated (const std::string& name) { return m_interpreter.clear_symbol (name); } - // DEPRECATED - void symbol_table::clear_symbol_pattern (const std::string& pattern) + // Remove when corresponding public deprecated function is removed. + void symbol_table::clear_symbol_pattern_deprecated (const std::string& pattern) { return m_interpreter.clear_symbol_pattern (pattern); } - // DEPRECATED - void symbol_table::global_assign (const std::string& name, + // Remove when corresponding public deprecated function is removed. + void symbol_table::global_assign_deprecated (const std::string& name, const octave_value& value) { return m_interpreter.global_assign (name, value); } - // DEPRECATED - void symbol_table::top_level_assign (const std::string& name, + // Remove when corresponding public deprecated function is removed. + void symbol_table::top_level_assign_deprecated (const std::string& name, const octave_value& value) { return m_interpreter.top_level_assign (name, value);
--- a/libinterp/corefcn/symtab.h Sat Aug 14 10:40:21 2021 -0400 +++ b/libinterp/corefcn/symtab.h Sat Aug 14 11:13:17 2021 -0400 @@ -189,58 +189,165 @@ // compatibility. New code should use the functions provided by the // interpreter class. + private: + + // Remove when corresponding public deprecated function is removed. + bool at_top_level_deprecated (void); + + // Remove when corresponding public deprecated function is removed. + octave_value varval_deprecated (const std::string& name) const; + + // Remove when corresponding public deprecated function is removed. + octave_value global_varval_deprecated (const std::string& name) const; + + // Remove when corresponding public deprecated function is removed. + octave_value top_level_varval_deprecated (const std::string& name) const; + + // Remove when corresponding public deprecated function is removed. + std::list<std::string> global_variable_names_deprecated (void); + + // Remove when corresponding public deprecated function is removed. + std::list<std::string> top_level_variable_names_deprecated (void); + + // Remove when corresponding public deprecated function is removed. + std::list<std::string> variable_names_deprecated (void); + + // Remove when corresponding public deprecated function is removed. + void assign_deprecated (const std::string& name, + const octave_value& value = octave_value ()); + + // Remove when corresponding public deprecated function is removed. + // Note, FORCE_ADD no longer has any meaning. + void assign_deprecated (const std::string& name, const octave_value& value, + bool /*force_add*/); + + // Remove when corresponding public deprecated function is removed. + void clear_all_deprecated (bool force = false); + + // Remove when corresponding public deprecated function is removed. + void clear_global_deprecated (const std::string& name); + + // Remove when corresponding public deprecated function is removed. + void clear_global_pattern_deprecated (const std::string& pattern); + + // Remove when corresponding public deprecated function is removed. + void clear_symbol_deprecated (const std::string& name); + + // Remove when corresponding public deprecated function is removed. + void clear_symbol_pattern_deprecated (const std::string& pattern); + + // Remove when corresponding public deprecated function is removed. + void global_assign_deprecated (const std::string& name, + const octave_value& value = octave_value ()); + + // Remove when corresponding public deprecated function is removed. + void top_level_assign_deprecated (const std::string& name, + const octave_value& value = octave_value ()); + + public: + +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (6, "use 'interpreter::at_top_level' instead") - bool at_top_level (void); + bool at_top_level (void) + { + return at_top_level_deprecated (); + } OCTAVE_DEPRECATED (6, "use 'interpreter::varval' instead") - octave_value varval (const std::string& name) const; + octave_value varval (const std::string& name) const + { + return varval_deprecated (name); + } OCTAVE_DEPRECATED (6, "use 'interpreter::global_varval' instead") - octave_value global_varval (const std::string& name) const; + octave_value global_varval (const std::string& name) const + { + return global_varval_deprecated (name); + } OCTAVE_DEPRECATED (6, "use 'interpreter::top_level_varval' instead") - octave_value top_level_varval (const std::string& name) const; + octave_value top_level_varval (const std::string& name) const + { + return top_level_varval_deprecated (name); + } OCTAVE_DEPRECATED (6, "use 'interpreter::global_variable_names' instead") - std::list<std::string> global_variable_names (void); + std::list<std::string> global_variable_names (void) + { + return global_variable_names_deprecated (); + } OCTAVE_DEPRECATED (6, "use 'interpreter::top_level_variable_names' instead") - std::list<std::string> top_level_variable_names (void); + std::list<std::string> top_level_variable_names (void) + { + return top_level_variable_names (); + } OCTAVE_DEPRECATED (6, "use 'interpreter::variable_names' instead") - std::list<std::string> variable_names (void); + std::list<std::string> variable_names (void) + { + return variable_names_deprecated (); + } OCTAVE_DEPRECATED (6, "use 'interpreter::assign' instead") void assign (const std::string& name, const octave_value& value = octave_value ()); + { + assign_deprecated (name, value); + } // Note, FORCE_ADD no longer has any meaning. OCTAVE_DEPRECATED (6, "use 'interpreter::assign' instead") void assign (const std::string& name, const octave_value& value, bool /*force_add*/); + { + assign_deprecated (name, value); + } OCTAVE_DEPRECATED (6, "use 'interpreter::clear_all' instead") void clear_all (bool force = false); + { + clear_all_deprecated (force); + } OCTAVE_DEPRECATED (6, "use 'interpreter::clear_global' instead") - void clear_global (const std::string& name); + void clear_global (const std::string& name) + { + clear_global_deprecated (name); + } OCTAVE_DEPRECATED (6, "use 'interpreter::clear_global_pattern' instead") - void clear_global_pattern (const std::string& pattern); + void clear_global_pattern (const std::string& pattern) + { + clear_global_pattern_deprecated (pattern); + } OCTAVE_DEPRECATED (6, "use 'interpreter::clear_symbol' instead") - void clear_symbol (const std::string& name); + void clear_symbol (const std::string& name) + { + clear_symbol_deprecated (name); + } OCTAVE_DEPRECATED (6, "use 'interpreter::clear_symbol_pattern' instead") - void clear_symbol_pattern (const std::string& pattern); + void clear_symbol_pattern (const std::string& pattern) + { + clear_symbol_pattern_deprecated (pattern); + } OCTAVE_DEPRECATED (6, "use 'interpreter::global_assign' instead") void global_assign (const std::string& name, const octave_value& value = octave_value ()); + { + global_assign_deprecated (name, value); + } OCTAVE_DEPRECATED (6, "use 'interpreter::top_level_assign' instead") void top_level_assign (const std::string& name, - const octave_value& value = octave_value ()); + const octave_value& value = octave_value ()) + { + top_level_assign_deprecated (name, value); + } +#endif private:
--- a/libinterp/corefcn/variables.h Sat Aug 14 10:40:21 2021 -0400 +++ b/libinterp/corefcn/variables.h Sat Aug 14 11:13:17 2021 -0400 @@ -56,11 +56,13 @@ is_valid_function (const std::string&, const std::string& = "", bool warn = false); +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (6, "use 'octave::get_function_handle' instead") extern OCTINTERP_API octave_function * extract_function (const octave_value& arg, const std::string& warn_for, const std::string& fname, const std::string& header, const std::string& trailer); +#endif extern OCTINTERP_API int symbol_exist (const std::string& name, const std::string& type = "any");
--- a/libinterp/octave-value/ov-fcn-handle.h Sat Aug 14 10:40:21 2021 -0400 +++ b/libinterp/octave-value/ov-fcn-handle.h Sat Aug 14 11:13:17 2021 -0400 @@ -374,9 +374,11 @@ namespace octave { +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (6, "use 'tree_evaluator::make_fcn_handle' instead") extern octave_value make_fcn_handle (interpreter& interp, const std::string& name); +#endif } #endif
--- 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,
--- a/libinterp/octave-value/ov.h Sat Aug 14 10:40:21 2021 -0400 +++ b/libinterp/octave-value/ov.h Sat Aug 14 11:13:17 2021 -0400 @@ -286,10 +286,35 @@ bool cache_index = false); OCTINTERP_API octave_value (const Array<std::string>& cellstr); OCTINTERP_API octave_value (const octave::idx_vector& idx, bool lazy = true); + +private: + + // Remove when public constructors that use this function are removed. + static OCTINTERP_API octave_base_value * + make_range_rep_deprecated (double base, double inc, double limit); + + // Remove when public constructors that use this function are removed. + static OCTINTERP_API octave_base_value * + make_range_rep_deprecated (const Range& r, bool force_range); + +public: + +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (7, "use 'octave_value (range<double>&)' instead") - OCTINTERP_API octave_value (double base, double limit, double inc); + OCTINTERP_API octave_value (double base, double limit, double inc) + : rep (make_range_rep_deprecated (base, inc, limit)) + { + maybe_mutate (); + } + OCTAVE_DEPRECATED (7, "use 'octave_value (range<double>&)' instead") - OCTINTERP_API octave_value (const Range& r, bool force_range = false); + OCTINTERP_API octave_value (const Range& r, bool force_range) + : rep (make_range_rep_deprecated (r, force_range)) + { + maybe_mutate (); + } +#endif + OCTINTERP_API octave_value (const octave::range<char>& r, char type, bool force_range = false); OCTINTERP_API octave_value (const octave::range<float>& r, @@ -510,12 +535,14 @@ return rep->do_index_op (idx, resize_ok); } +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (7, "use 'octave_value::index_op' instead") octave_value do_index_op (const octave_value_list& idx, bool resize_ok = false) { return index_op (idx, resize_ok); } +#endif OCTINTERP_API octave_value subsasgn (const std::string& type, const std::list<octave_value_list>& idx, @@ -1397,22 +1424,26 @@ OCTINTERP_API octave_value& non_const_unary_op (unary_op op); +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (7, "use 'octave_value::non_const_unary_op' instead") octave_value& do_non_const_unary_op (unary_op op) { return non_const_unary_op (op); } +#endif OCTINTERP_API octave_value& non_const_unary_op (unary_op op, const std::string& type, const std::list<octave_value_list>& idx); +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (7, "use 'octave_value::non_const_unary_op' instead") octave_value& do_non_const_unary_op (unary_op op, const std::string& type, const std::list<octave_value_list>& idx) { return non_const_unary_op (op, type, idx); } +#endif const octave_base_value& get_rep (void) const { return *rep; } @@ -1663,6 +1694,7 @@ } } +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (7, "use 'octave::unary_op' instead") inline octave_value do_unary_op (octave::type_info& ti, octave_value::unary_op op, @@ -1676,8 +1708,8 @@ do_unary_op (octave_value::unary_op op, const octave_value& a) { return octave::unary_op (op, a); +} -} OCTAVE_DEPRECATED (7, "use 'octave::binary_op' instead") inline octave_value do_binary_op (octave::type_info& ti, octave_value::binary_op op, @@ -1741,6 +1773,7 @@ { return octave::colon_op (base, limit, is_for_cmd_expr); } +#endif #define OV_UNOP_FN(name) \ inline octave_value \
--- a/libinterp/parse-tree/bp-table.h Sat Aug 14 10:40:21 2021 -0400 +++ b/libinterp/parse-tree/bp-table.h Sat Aug 14 11:13:17 2021 -0400 @@ -76,6 +76,7 @@ typedef fname_bp_map::const_iterator const_fname_bp_map_iterator; typedef fname_bp_map::iterator fname_bp_map_iterator; +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (7, "use 'bp_table::add_breakpoints_in_function' instead") int add_breakpoint (const std::string& fname = "", const std::string& class_name = "", @@ -93,6 +94,7 @@ { return add_breakpoints_in_function (fname, class_name, lines, condition); } +#endif // Add a breakpoint at the nearest executable line in a function. int add_breakpoint_in_function (const std::string& fname = "", @@ -118,6 +120,7 @@ const bp_lines& lines = bp_lines (), const std::string& condition = ""); +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (7, "use 'bp_table::remove_breakpoint_from_function' instead") int remove_breakpoint (const std::string& fname = "", int line = 1) @@ -131,6 +134,7 @@ { return remove_breakpoints_from_function (fname, lines); } +#endif // Remove a breakpoint from the given line in file. int remove_breakpoint_from_function (const std::string& fname = "", @@ -153,12 +157,14 @@ const bp_lines& lines = bp_lines ()); +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (7, "use 'bp_table::remove_all_breakpoints_from_function' instead") bp_lines remove_all_breakpoints_in_file (const std::string& fname, bool silent = false) { return remove_all_breakpoints_from_function (fname, silent); } +#endif // Remove all the breakpoints from a file. bp_lines remove_all_breakpoints_from_file (const std::string& file,
--- a/libinterp/parse-tree/oct-lvalue.h Sat Aug 14 10:40:21 2021 -0400 +++ b/libinterp/parse-tree/oct-lvalue.h Sat Aug 14 11:13:17 2021 -0400 @@ -80,11 +80,13 @@ void unary_op (octave_value::unary_op op); +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (7, "use 'octave_lvalue::unary_op' instead") void do_unary_op (octave_value::unary_op op) { return unary_op (op); } +#endif octave_value value (void) const;
--- a/liboctave/array/Array.h Sat Aug 14 10:40:21 2021 -0400 +++ b/liboctave/array/Array.h Sat Aug 14 11:13:17 2021 -0400 @@ -573,8 +573,10 @@ const T * data (void) const { return m_slice_data; } +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (7, "for read-only access, use 'data' method instead") const T * fortran_vec (void) const { return data (); } +#endif OCTARRAY_API T * fortran_vec (void);
--- a/liboctave/array/DiagArray2.h Sat Aug 14 10:40:21 2021 -0400 +++ b/liboctave/array/DiagArray2.h Sat Aug 14 11:13:17 2021 -0400 @@ -168,8 +168,10 @@ const T * data (void) const { return Array<T>::data (); } +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (7, "for read-only access, use 'data' method instead") const T * fortran_vec (void) const { return Array<T>::data (); } +#endif T * fortran_vec (void) { return Array<T>::fortran_vec (); }
--- a/liboctave/array/Range.cc Sat Aug 14 10:40:21 2021 -0400 +++ b/liboctave/array/Range.cc Sat Aug 14 11:13:17 2021 -0400 @@ -728,37 +728,43 @@ return is; } -Range -operator - (const Range& r) +// DEPRECATED in Octave 7. +Range operator - (const Range& r) { return Range (-r.base (), -r.limit (), -r.increment (), r.numel ()); } +// DEPRECATED in Octave 7. Range operator + (double x, const Range& r) { return Range (x + r.base (), x + r.limit (), r.increment (), r.numel ()); } +// DEPRECATED in Octave 7. Range operator + (const Range& r, double x) { return Range (r.base () + x, r.limit () + x, r.increment (), r.numel ()); } +// DEPRECATED in Octave 7. Range operator - (double x, const Range& r) { return Range (x - r.base (), x - r.limit (), -r.increment (), r.numel ()); } +// DEPRECATED in Octave 7. Range operator - (const Range& r, double x) { return Range (r.base () - x, r.limit () - x, r.increment (), r.numel ()); } +// DEPRECATED in Octave 7. Range operator * (double x, const Range& r) { return Range (x * r.base (), x * r.limit (), x * r.increment (), r.numel ()); } +// DEPRECATED in Octave 7. Range operator * (const Range& r, double x) { return Range (r.base () * x, r.limit () * x, r.increment () * x, r.numel ());
--- a/liboctave/array/Range.h Sat Aug 14 10:40:21 2021 -0400 +++ b/liboctave/array/Range.h Sat Aug 14 11:13:17 2021 -0400 @@ -375,6 +375,7 @@ { public: +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (7, "use the 'octave::range<double>' class instead") Range (void) : m_base (0), m_limit (0), m_inc (0), m_numel (0) @@ -390,6 +391,7 @@ : m_base (r.base ()), m_limit (r.final_value ()), m_inc (r.increment ()), m_numel (r.numel ()) { } +#endif Range (const Range& r) = default; @@ -397,6 +399,7 @@ ~Range (void) = default; +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (7, "use the 'octave::range<double>' class instead") Range (double b, double l) : m_base (b), m_limit (l), m_inc (1), m_numel (numel_internal ()) @@ -426,6 +429,7 @@ if (! octave::math::isinf (m_limit)) m_limit = limit_internal (); } +#endif // The range has a finite number of elements. bool ok (void) const @@ -537,6 +541,7 @@ { } }; +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (7, "arithmetic operations on Range objects are unreliable") extern OCTAVE_API Range operator - (const Range& r); @@ -557,5 +562,6 @@ OCTAVE_DEPRECATED (7, "arithmetic operations on Range objects are unreliable") extern OCTAVE_API Range operator * (const Range& r, double x); +#endif #endif
--- a/liboctave/numeric/CollocWt.h Sat Aug 14 10:40:21 2021 -0400 +++ b/liboctave/numeric/CollocWt.h Sat Aug 14 11:13:17 2021 -0400 @@ -208,7 +208,9 @@ }; } +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (7, "use 'octave::CollocWt' instead") typedef octave::CollocWt CollocWt; +#endif #endif
--- a/liboctave/numeric/oct-convn.h Sat Aug 14 10:40:21 2021 -0400 +++ b/liboctave/numeric/oct-convn.h Sat Aug 14 11:13:17 2021 -0400 @@ -175,6 +175,7 @@ } } +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (7, "use 'octave::convn' instead") inline NDArray convn (const NDArray& a, const NDArray& b, convn_type ct) @@ -320,5 +321,6 @@ { return octave::convn (a, c, r, octave::convert_enum (ct)); } +#endif #endif
--- a/liboctave/numeric/oct-norm.h Sat Aug 14 10:40:21 2021 -0400 +++ b/liboctave/numeric/oct-norm.h Sat Aug 14 11:13:17 2021 -0400 @@ -104,6 +104,7 @@ extern OCTAVE_API ColumnVector xrownorms (const SparseComplexMatrix&, double p = 2); } +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (7, "use 'octave::xnorm' instead") inline double xnorm (const ColumnVector& v, double p = 2) { @@ -295,5 +296,6 @@ { return octave::xrownorms (m, p); } +#endif #endif
--- a/liboctave/numeric/oct-spparms.h Sat Aug 14 10:40:21 2021 -0400 +++ b/liboctave/numeric/oct-spparms.h Sat Aug 14 11:13:17 2021 -0400 @@ -116,7 +116,9 @@ }; } +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (7, "use 'octave::sparse_params' instead") typedef octave::sparse_params octave_sparse_params; +#endif #endif
--- a/liboctave/util/lo-array-errwarn.h Sat Aug 14 10:40:21 2021 -0400 +++ b/liboctave/util/lo-array-errwarn.h Sat Aug 14 11:13:17 2021 -0400 @@ -131,10 +131,12 @@ err_index_out_of_range (int ndims, int dim, octave_idx_type idx, octave_idx_type ext, const dim_vector& dv); +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (6, "use err_index_out_of_range (int, int, octave_idx_type, octave_idx_type, const dim_vector&) instead") OCTAVE_NORETURN extern OCTAVE_API void err_index_out_of_range (int ndims, int dim, octave_idx_type idx, octave_idx_type ext); +#endif OCTAVE_NORETURN extern OCTAVE_API void err_del_index_out_of_range (bool is1d, octave_idx_type iext,
--- a/liboctave/util/lo-utils.h Sat Aug 14 10:40:21 2021 -0400 +++ b/liboctave/util/lo-utils.h Sat Aug 14 11:13:17 2021 -0400 @@ -137,6 +137,7 @@ } } +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) template <typename F, typename T, bool zero> OCTAVE_DEPRECATED (7, "use 'octave::any_all_test' instead") bool @@ -276,5 +277,6 @@ { octave::write_value<FloatComplex> (os, value); } +#endif #endif
--- a/liboctave/util/quit.h Sat Aug 14 10:40:21 2021 -0400 +++ b/liboctave/util/quit.h Sat Aug 14 11:13:17 2021 -0400 @@ -224,13 +224,16 @@ */ extern OCTAVE_API sig_atomic_t octave_interrupt_state; +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (6, "'octave_exception_state' is an obsolete internal variable; any uses should be removed") extern OCTAVE_API sig_atomic_t octave_exception_state; +#endif extern OCTAVE_API volatile sig_atomic_t octave_signal_caught; extern OCTAVE_API void octave_handle_signal (void); +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (6, "use 'throw octave::interrupt_exception' instead") OCTAVE_NORETURN extern OCTAVE_API void octave_throw_interrupt_exception (void); @@ -242,6 +245,7 @@ OCTAVE_DEPRECATED (6, "use 'throw' instead") extern OCTAVE_API void octave_rethrow_exception (void); +#endif #if defined (__cplusplus) @@ -308,8 +312,10 @@ extern OCTAVE_API void (*octave_signal_hook) (void); extern OCTAVE_API void (*octave_interrupt_hook) (void); +#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS) OCTAVE_DEPRECATED (6, "'octave_bad_alloc_hook' is obsolete and no longer used") extern OCTAVE_API void (*octave_bad_alloc_hook) (void); +#endif #endif
--- a/oct-conf-post.in.h Sat Aug 14 10:40:21 2021 -0400 +++ b/oct-conf-post.in.h Sat Aug 14 11:13:17 2021 -0400 @@ -94,15 +94,15 @@ # endif #endif -/* This macro could have a better name... It is intended to be used - only to enable inline functions or typedefs that provide access to - symbols that have been moved to the octave namespace. It may be - temporarily useful to define this macro when moving a symbol to the - octave namespace but it should not be defined when building - released versions of Octave, as building those should not require - deprecated symbols. It is defined in octave-config.h, so users of - Octave may continue to access symbols using the deprecated names. */ -/* #undef OCTAVE_USE_DEPRECATED_FUNCTIONS */ +/* This macro is intended to be used only to enable inline functions or + typedefs that provide access to symbols that have been moved to the + octave namespace. It may be temporarily useful to define this macro + when moving a symbol to the octave namespace but it should not be + defined when building released versions of Octave, as building those + should not require deprecated symbols. It is defined in + octave-config.h, so users of Octave may continue to access symbols + using the deprecated names. */ +/* #undef OCTAVE_PROVIDE_DEPRECATED_SYMBOLS */ #if defined (__cplusplus) template <typename T>