octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #61784] builtins deprecated warning problem


From: anonymous
Subject: [Octave-bug-tracker] [bug #61784] builtins deprecated warning problem
Date: Mon, 10 Jan 2022 04:29:18 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:94.0) Gecko/20100101 Firefox/94.0

URL:
  <https://savannah.gnu.org/bugs/?61784>

                 Summary: builtins deprecated warning problem
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Mon 10 Jan 2022 09:29:15 AM UTC
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Build Failure
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 7.0.90
         Discussion Lock: Any
        Operating System: Microsoft Windows

    _______________________________________________________

Details:

There is a compilation failure for .oct files that are calling builtin
functions via including "builtin-defun-decls.h".

Minimal example:


#include <octave/oct.h>
#include <octave/interpreter.h>
#include <octave/builtin-defun-decls.h>

DEFUN_DLD (hello, args, nargout,
           "Hello World Help String")
{
  octave::interpreter& interp = *octave::interpreter::the_interpreter ();
  
  Fdisp(interp, octave_value("hello"));
  
  return octave_value_list ();
}


It appears that it only has affected the builtins that have the following
signature:


octave_value_list
octave::builtin_name (octave::interpreter&, const octave_value_list& =
octave_value_list (), int = 0);


For each builtin an inline function is defined in that header that calls the
correct function and is marked as deprecated like this :


inline octave_value_list
builtin_name (octave::interpreter& interp, const octave_value_list& args =
octave_value_list (), int nargout = 0)
{
  return octave::builtin_name (interp, args, nargout);
}


I think because of the rules of the argument dependent lookup (ADL)[1] the
compiler finds both overloads and cannot continue to decide to select the
proper one.

Solution:

Two solutions to my understanding may be used:

1. Remove all deprecated warnings and newly defined inline functions and force
the users to use the correct signature "octave::builtin_name". It also reduces
the header size and speeds up the compilation time.

2. Using template:


template <typename T>
octave_value_list
builtin_name (T& interp, const octave_value_list& args = octave_value_list (),
int nargout = 0)
{
  return octave::builtin_name (interp, args, nargout);
}


[1] https://en.cppreference.com/w/cpp/language/adl




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?61784>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]