From 0bf846f56f714a7bc906767b440c86c9c22a72c0 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Mon, 12 Apr 2021 15:54:36 +1200 Subject: [PATCH] Eliminate unused Printf args --- Source/Modules/mzscheme.cxx | 2 +- Source/Modules/octave.cxx | 2 +- Source/Modules/perl5.cxx | 2 +- Source/Modules/php.cxx | 5 ++--- Source/Modules/python.cxx | 8 +++++--- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Source/Modules/mzscheme.cxx b/Source/Modules/mzscheme.cxx index 788681330..5ee5c6789 100644 --- a/Source/Modules/mzscheme.cxx +++ b/Source/Modules/mzscheme.cxx @@ -453,7 +453,7 @@ public: Printv(df->def, "static Scheme_Object *\n", dname, "(int argc, Scheme_Object **argv) {", NIL); Printv(df->code, dispatch, "\n", NIL); Printf(df->code, "scheme_signal_error(\"No matching function for overloaded '%s'\");\n", iname); - Printf(df->code, "return NULL;\n", iname); + Printf(df->code, "return NULL;\n"); Printv(df->code, "}\n", NIL); Wrapper_print(df, f_wrappers); Printf(init_func_def, "scheme_add_global(\"%s\", scheme_make_prim_w_arity(%s,\"%s\",%d,%d),menv);\n", proc_name, dname, proc_name, 0, maxargs); diff --git a/Source/Modules/octave.cxx b/Source/Modules/octave.cxx index b1769e42a..fc45a8d5c 100644 --- a/Source/Modules/octave.cxx +++ b/Source/Modules/octave.cxx @@ -815,7 +815,7 @@ public: Printf(tmp, "}"); Wrapper_add_local(f, "argv", tmp); Printv(f->code, dispatch, "\n", NIL); - Printf(f->code, "error(\"No matching function for overload\");\n", iname); + Printf(f->code, "error(\"No matching function for overload\");\n"); Printf(f->code, "return octave_value_list();\n"); Printv(f->code, "}\n", NIL); diff --git a/Source/Modules/perl5.cxx b/Source/Modules/perl5.cxx index dfa85f3c8..e63e2b0c1 100644 --- a/Source/Modules/perl5.cxx +++ b/Source/Modules/perl5.cxx @@ -2341,7 +2341,7 @@ public: Replaceall(tm, "$error", "ERRSV"); Printv(w->code, Str(tm), "\n", NIL); } else { - Printf(w->code, " Swig::DirectorMethodException::raise(ERRSV);\n", classname, pyname); + Printf(w->code, " Swig::DirectorMethodException::raise(ERRSV);\n"); } Append(w->code, "}\n"); Delete(tm); diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index 6d7fe55dd..9f16efc11 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -2341,7 +2341,6 @@ done: virtual int constructorHandler(Node *n) { if (Swig_directorclass(n)) { - String *name = GetChar(Swig_methodclass(n), "name"); String *ctype = GetChar(Swig_methodclass(n), "classtype"); String *sname = GetChar(Swig_methodclass(n), "sym:name"); String *args = NewStringEmpty(); @@ -2369,7 +2368,7 @@ done: Printf(director_ctor_code, "if (Z_TYPE_P(arg0) == IS_NULL) { /* not subclassed */\n"); Printf(director_prot_ctor_code, "if (Z_TYPE_P(arg0) == IS_NULL) { /* not subclassed */\n"); Printf(director_ctor_code, " %s = (%s *)new %s(%s);\n", Swig_cresult_name(), ctype, ctype, args); - Printf(director_prot_ctor_code, " SWIG_PHP_Error(E_ERROR, \"accessing abstract class or protected constructor\");\n", name, name, args); + Printf(director_prot_ctor_code, " SWIG_PHP_Error(E_ERROR, \"accessing abstract class or protected constructor\");\n"); if (i) { Insert(args, 0, ", "); } @@ -2717,7 +2716,7 @@ done: // typemap_directorout testcase requires that 0 can be assigned to the // variable named after the result of Swig_cresult_name(), so that can't // be a zval - make it a pointer to one instead. - Printf(w->code, "zval swig_zval_result, swig_funcname;\n", Swig_cresult_name()); + Printf(w->code, "zval swig_zval_result, swig_funcname;\n"); Printf(w->code, "zval * SWIGUNUSED %s = &swig_zval_result;\n", Swig_cresult_name()); const char * funcname = GetChar(n, "sym:name"); Printf(w->code, "ZVAL_STRINGL(&swig_funcname, \"%s\", %d);\n", funcname, strlen(funcname)); diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index fb4a9d6ad..d10e0b921 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -3613,7 +3613,7 @@ public: // class type (the SWIG_init() is called before shadow classes are // defined and registered). Printf(f_wrappers, "SWIGINTERN PyObject *%s_swigconstant(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {\n", iname); - Printf(f_wrappers, tab2 "PyObject *module;\n", tm); + Printf(f_wrappers, tab2 "PyObject *module;\n"); Printf(f_wrappers, tab2 "PyObject *d;\n"); Printf(f_wrappers, tab2 "if (!SWIG_Python_UnpackTuple(args, \"swigconstant\", 1, 1, &module)) return NULL;\n"); Printf(f_wrappers, tab2 "d = PyModule_GetDict(module);\n"); @@ -4023,7 +4023,7 @@ public: if (GetFlag(mgetset, "static")) { Printf(f, "static PyGetSetDef %s_def = %s;\n", gspair, entry); Printf(f_init, "static_getset = SwigPyStaticVar_new_getset(metatype, &%s_def);\n", gspair); - Printf(f_init, "PyDict_SetItemString(d, static_getset->d_getset->name, (PyObject *) static_getset);\n", memname); + Printf(f_init, "PyDict_SetItemString(d, static_getset->d_getset->name, (PyObject *) static_getset);\n"); Printf(f_init, "Py_DECREF(static_getset);\n"); } else { Printf(getset_def, " %s,\n", entry); @@ -4472,7 +4472,9 @@ public: Printf(f_shadow, "(Exception)"); } else { Printf(f_shadow, "(object"); - Printf(f_shadow, py3 && GetFlag(n, "feature:python:nondynamic") ? ", metaclass=_SwigNonDynamicMeta" : "", ")"); + if (py3 && GetFlag(n, "feature:python:nondynamic")) { + Printf(f_shadow, ", metaclass=_SwigNonDynamicMeta"); + } Printf(f_shadow, ")"); } }