Fix -Wunused-variable warning for overloaded methods in Octave

Fixes testcases: cpp11_director_using_constructor and cpp11_using_constructor.
This commit is contained in:
William S Fulton 2025-06-22 12:51:06 +01:00
parent dd7415f4b3
commit 4bf9547982
2 changed files with 10 additions and 8 deletions

View File

@ -801,11 +801,13 @@ public:
Octave_begin_function(n, f->def, iname, wname, true);
Wrapper_add_local(f, "argc", "int argc = args.length()");
Printf(tmp, "octave_value_ref argv[%d]={", maxargs);
for (int j = 0; j < maxargs; ++j)
Printf(tmp, "%soctave_value_ref(args,%d)", j ? "," : " ", j);
Printf(tmp, "}");
Wrapper_add_local(f, "argv", tmp);
if (maxargs > 0) {
Printf(tmp, "octave_value_ref argv[%d]={", maxargs);
for (int j = 0; j < maxargs; ++j)
Printf(tmp, "%soctave_value_ref(args,%d)", j ? "," : " ", j);
Printf(tmp, "}");
Wrapper_add_local(f, "argv", tmp);
}
Printv(f->code, dispatch, "\n", NIL);
Printf(f->code, "error(\"No matching function for overload\");\n");
Printf(f->code, "return octave_value_list();\n");

View File

@ -428,7 +428,7 @@ static String *ReplaceFormat(const_String_or_char_ptr fmt, int j) {
String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *maxargs) {
int i, j;
*maxargs = 1;
*maxargs = 0;
String *f = NewString("");
String *sw = NewString("");
@ -615,7 +615,7 @@ String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *
static String *overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *maxargs, const_String_or_char_ptr fmt_fastdispatch) {
int i, j;
*maxargs = 1;
*maxargs = 0;
String *f = NewString("");
@ -783,7 +783,7 @@ String *Swig_overload_dispatch(Node *n, const_String_or_char_ptr fmt, int *maxar
int i, j;
*maxargs = 1;
*maxargs = 0;
String *f = NewString("");