Packages failing to build after removing deprecated functions

I noticed that some of the mxe-octave builders are failing after we removed deprecated functions from the development sources. For example,
the log file for the w32-on-debian builder shows:

Failed to build package of-control!
  154 | extern OCTINTERP_API octave_value xpow (const FloatComplexDiagMatrix& a,
      |                                   ^~~~
make[2]: *** [Makefile:64: __control_slicot_functions__.oct] Error 1

We provide warnings about deprecated functions for two releases, but I guess it doesn’t really help if package Makefiles do this:

PKG_CXXFLAGS := -Wall -Wno-deprecated-declarations $(PKG_CXXFLAGS_APPEND)

to suppress the warnings.

I know that a changing API can be annoying, but unless you are diving deep into parts of Octave that you should probably really stay away from (the parser and evaluator, for example) then I think most recent deprecated functions are about moving symbols inside the octave namespace. If you want to avoid having to make a lot of tedious changes, then I would recommend adding a using namespace octave; directive to source files instead of ignoring all warnings about deprecated functions. Then we could find and fix problems due to significant API changes before the functions are actually removed.

1 Like

Adding using namespace octave; doesn’t work in some cases unfortunately.
I tried to do that in the tisean package. But then compilation fails with the following errors:

In file included from /home/osboxes/mxe-octave/usr/x86_64-w64-mingw32/include/octave-9.0.0/octave/../octave/defun-dld.h:35,
                 from /home/osboxes/mxe-octave/usr/x86_64-w64-mingw32/include/octave-9.0.0/octave/../octave/oct.h:35,
                 from In function 'octave_function* G__lyap_spec__(const octave::dynamic_library&, bool)':
/home/osboxes/mxe-octave/usr/x86_64-w64-mingw32/include/octave-9.0.0/octave/../octave/defun-int.h:199:19: error: call of overloaded 'check_version(const char [9], const char [14])' is ambiguous
  199 |     check_version (OCTAVE_API_VERSION, name);                           \
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/osboxes/mxe-octave/usr/x86_64-w64-mingw32/include/octave-9.0.0/octave/../octave/defun-int.h:190:3: note: in expansion of macro 'DEFINE_FUNX_INSTALLER_FUN'
  190 |   DEFINE_FUNX_INSTALLER_FUN(#name, F ## name, G ## name, doc)
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~
/home/osboxes/mxe-octave/usr/x86_64-w64-mingw32/include/octave-9.0.0/octave/../octave/defun-dld.h:63:3: note: in expansion of macro 'DEFINE_FUN_INSTALLER_FUN'
   63 |   DEFINE_FUN_INSTALLER_FUN (name, doc)                  \
      |   ^~~~~~~~~~~~~~~~~~~~~~~~ note: in expansion of macro 'DEFUN_DLD'
  295 | DEFUN_DLD (__lyap_spec__, args, nargout, HELPTEXT)
      | ^~~~~~~~~
/home/osboxes/mxe-octave/usr/x86_64-w64-mingw32/include/octave-9.0.0/octave/../octave/defun-int.h:83:1: note: candidate: 'void check_version(const std::string&, const std::string&)'
   83 | check_version (const std::string& version, const std::string& fcn)
      | ^~~~~~~~~~~~~
/home/osboxes/mxe-octave/usr/x86_64-w64-mingw32/include/octave-9.0.0/octave/../octave/defun-int.h:47:27: note: candidate: 'void octave::check_version(const std::string&, const std::string&)'
   47 | extern OCTINTERP_API void check_version (const std::string& version,
      |                           ^~~~~~~~~~~~~ In function 'octave_value_list F__lyap_spec__(const octave_value_list&, int)': error: call of overloaded 'print_usage()' is ambiguous
  303 |     print_usage ();
      |     ~~~~~~~~~~~~^~
/home/osboxes/mxe-octave/usr/x86_64-w64-mingw32/include/octave-9.0.0/octave/../octave/defun-int.h:72:13: note: candidate: 'void print_usage()'
   72 | inline void print_usage (void)
      |             ^~~~~~~~~~~
/home/osboxes/mxe-octave/usr/x86_64-w64-mingw32/include/octave-9.0.0/octave/../octave/defun-int.h:43:27: note: candidate: 'void octave::print_usage()'
   43 | extern OCTINTERP_API void print_usage (void);
      |                           ^~~~~~~~~~~
make[2]: *** [Makefile:88: __lyap_spec__.oct] Error 1

OK, then I’m not sure what to recommend.

Is there anything we can do to make things easier when moving functions inside the octave namespace? I see that the check_version and print_usage functions aren’t deprecated, but appear in the global namespace as inline functions and again in the octave namespace and that there is no good way to omit the global declaration so that the using namespace octave directive will work.

Declarations for deprecated functions in the global namespace should only be visible if OCTAVE_PROVIDE_DEPRECATED_SYMBOLS is defined. But that is unconditionally defined in our installed octave-config.h file. If I understand correctly, the using namespace octave directive would work correctly for these functions if we had a way to avoid defining OCTAVE_PROVIDE_DEPRECATED_SYMBOLS.