summaryrefslogtreecommitdiffstats
path: root/contrib/tools/swig/patches/fix-unused-parameter.patch
blob: 9bff7c57c79dd0d206701cce59cc3b2105fb9789 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--- contrib/tools/swig/Source/Modules/python.cxx	(index)
+++ contrib/tools/swig/Source/Modules/python.cxx	(working tree)
@@ -2981,6 +2981,8 @@ public:
 	} else {
 	  int is_tp_call = Equal(Getattr(n, "feature:python:slot"), "tp_call");
 	  Printv(f->def, linkage, wrap_return, wname, "(PyObject *self, PyObject *args", builtin_kwargs, ") {", NIL);
+	  /* Avoid warning if the self parameter is not used. */
+	  Append(f->def, "(void)self;\n");
 	  if (builtin_ctor)
 	    Printf(parse_args, "if (!SWIG_Python_CheckNoKeywords(kwargs, \"%s\")) SWIG_fail;\n", iname);
 	  if (onearg && !builtin_ctor && !is_tp_call) {
--- contrib/tools/swig/Source/Modules/python.cxx	(index)
+++ contrib/tools/swig/Source/Modules/python.cxx	(working tree)
@@ -2977,6 +2977,8 @@ public:
 	  } else {
 	    Printv(f->def, linkage, wrap_return, wname, "(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) {", NIL);
 	  }
+	  /* Avoid warning if the self parameter is not used. */
+	  Append(f->def, "(void)self;\n");
 	  Printf(parse_args, "if ((nobjs < %d) || (nobjs > %d)) SWIG_fail;\n", num_required, num_arguments);
 	} else {
 	  int is_tp_call = Equal(Getattr(n, "feature:python:slot"), "tp_call");
--- contrib/tools/swig/Source/Modules/python.cxx	(index)
+++ contrib/tools/swig/Source/Modules/python.cxx	(working tree)
@@ -2808,6 +2808,8 @@ public:
 	varargs = 0;
       }
       Printv(f->def, linkage, wrap_return, wname, "(PyObject *self, PyObject *args, PyObject *kwargs) {", NIL);
+      /* Avoid warning if the self parameter is not used. */
+      Append(f->def, "(void)self;\n");
     }
 
     if (builtin) {