Sisyphus repositório
Última atualização: 18 setembro 2019 | SRPMs: 17447 | Visitas: 15124496
en ru br
ALT Linux repositórios
S:3.0.12-alt8
5.0: 1.3.36-alt2
4.1: 1.3.31-alt2
4.0: 1.3.31-alt1
3.0: 1.3.24-alt2

Group :: Desenvolvimento/C
RPM: swig

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs e FR  Repocop 

Patch: upstream-issue-1259.patch
Download


diff --git a/swig/CHANGES.current b/swig/CHANGES.current
index 197ec773..3ebabfc9 100644
--- a/swig/CHANGES.current
+++ b/swig/CHANGES.current
@@ -7,6 +7,13 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
 Version 3.0.12 (27 Jan 2017)
 ============================
 
+2018-06-11: olly
+            [Python] Fix new GCC8 warnings in generated code by avoiding casts
+            between incompatible function types where possible (when keyword
+            args are in use, it is not possible to avoid such warnings as they
+            are inherent in the design of Python's C API in that particular
+            case).  Fixes #1259.
+
 2017-01-27: wsfulton
             [C#] #882 Fix missing filename in error messages when there is a problem
             writing out C# files.
diff --git a/swig/Lib/python/pyinit.swg b/swig/Lib/python/pyinit.swg
index 3b4c411b..c272f59e 100644
--- a/swig/Lib/python/pyinit.swg
+++ b/swig/Lib/python/pyinit.swg
@@ -356,8 +356,8 @@ SWIG_init(void) {
     (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL
   };
   static SwigPyGetSet thisown_getset_closure = {
-    (PyCFunction) SwigPyObject_own,
-    (PyCFunction) SwigPyObject_own
+    SwigPyObject_own,
+    SwigPyObject_own
   };
   static PyGetSetDef thisown_getset_def = {
     (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure
diff --git a/swig/Lib/python/pyrun.swg b/swig/Lib/python/pyrun.swg
index d4a5beff..357e57d9 100644
--- a/swig/Lib/python/pyrun.swg
+++ b/swig/Lib/python/pyrun.swg
@@ -441,6 +441,14 @@ SwigPyObject_repr(SwigPyObject *v)
   return repr;  
 }
 
+/* We need a version taking two PyObject* parameters so it's a valid
+ * PyCFunction to use in swigobject_methods[]. */
+static PyObject *
+SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
+{
+  return SwigPyObject_repr((SwigPyObject*)v);
+}
+
 SWIGRUNTIME int
 SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
 {
@@ -617,12 +625,12 @@ SwigPyObject_own(PyObject *v, PyObject *args)
 
 static PyMethodDef
 swigobject_methods[] = {
-  {"disown",  (PyCFunction)SwigPyObject_disown,  METH_NOARGS,  "releases ownership of the pointer"},
-  {"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS,  "acquires ownership of the pointer"},
-  {"own",     (PyCFunction)SwigPyObject_own,     METH_VARARGS, "returns/sets ownership of the pointer"},
-  {"append",  (PyCFunction)SwigPyObject_append,  METH_O,       "appends another 'this' object"},
-  {"next",    (PyCFunction)SwigPyObject_next,    METH_NOARGS,  "returns the next 'this' object"},
-  {"__repr__",(PyCFunction)SwigPyObject_repr,    METH_NOARGS,  "returns object representation"},
+  {"disown",  SwigPyObject_disown,  METH_NOARGS,  "releases ownership of the pointer"},
+  {"acquire", SwigPyObject_acquire, METH_NOARGS,  "acquires ownership of the pointer"},
+  {"own",     SwigPyObject_own,     METH_VARARGS, "returns/sets ownership of the pointer"},
+  {"append",  SwigPyObject_append,  METH_O,       "appends another 'this' object"},
+  {"next",    SwigPyObject_next,    METH_NOARGS,  "returns the next 'this' object"},
+  {"__repr__",SwigPyObject_repr2,   METH_NOARGS,  "returns object representation"},
   {0, 0, 0, 0}  
 };
 
diff --git a/swig/Source/Modules/python.cxx b/swig/Source/Modules/python.cxx
index 24c35079..d05f56fe 100644
--- a/swig/Source/Modules/python.cxx
+++ b/swig/Source/Modules/python.cxx
@@ -1077,7 +1077,7 @@ public:
    * ------------------------------------------------------------ */
   int add_pyinstancemethod_new() {
     String *name = NewString("SWIG_PyInstanceMethod_New");
-    Printf(methods, "\t { (char *)\"%s\", (PyCFunction)%s, METH_O, NULL},\n", name, name);
+    Printf(methods, "\t { \"%s\", %s, METH_O, NULL},\n", name, name);
     Delete(name);
     return 0;
   }
@@ -2447,17 +2447,17 @@ public:
     if (!kw) {
       if (n && funpack) {
 	if (num_required == 0 && num_arguments == 0) {
-	  Printf(methods, "\t { (char *)\"%s\", (PyCFunction)%s, METH_NOARGS, ", name, function);
+	  Printf(methods, "\t { \"%s\", %s, METH_NOARGS, ", name, function);
 	} else if (num_required == 1 && num_arguments == 1) {
-	  Printf(methods, "\t { (char *)\"%s\", (PyCFunction)%s, METH_O, ", name, function);
+	  Printf(methods, "\t { \"%s\", %s, METH_O, ", name, function);
 	} else {
-	  Printf(methods, "\t { (char *)\"%s\", %s, METH_VARARGS, ", name, function);
+	  Printf(methods, "\t { \"%s\", %s, METH_VARARGS, ", name, function);
 	}
       } else {
-	Printf(methods, "\t { (char *)\"%s\", %s, METH_VARARGS, ", name, function);
+	Printf(methods, "\t { \"%s\", %s, METH_VARARGS, ", name, function);
       }
     } else {
-      Printf(methods, "\t { (char *)\"%s\", (PyCFunction) %s, METH_VARARGS | METH_KEYWORDS, ", name, function);
+      Printf(methods, "\t { \"%s\", (PyCFunction)%s, METH_VARARGS|METH_KEYWORDS, ", name, function);
     }
 
     if (!n) {
@@ -3825,7 +3825,7 @@ public:
     if (shadow) {
       if (builtin) {
 	String *rname = SwigType_namestr(real_classname);
-	Printf(builtin_methods, "  { \"__disown__\", (PyCFunction) Swig::Director::swig_pyobj_disown< %s >, METH_NOARGS, \"\" },\n", rname);
+	Printf(builtin_methods, "  { \"__disown__\", Swig::Director::swig_pyobj_disown< %s >, METH_NOARGS, \"\" },\n", rname);
 	Delete(rname);
       } else {
 	String *symname = Getattr(n, "sym:name");
@@ -4654,13 +4654,13 @@ public:
 	int argcount = Getattr(n, "python:argcount") ? atoi(Char(Getattr(n, "python:argcount"))) : 2;
 	String *ds = have_docstring(n) ? cdocstring(n, AUTODOC_FUNC) : NewString("");
 	if (check_kwargs(n)) {
-	  Printf(builtin_methods, "  { \"%s\", (PyCFunction) %s, METH_VARARGS|METH_KEYWORDS, (char *) \"%s\" },\n", symname, wname, ds);
+	  Printf(builtin_methods, "  { \"%s\", (PyCFunction)%s, METH_VARARGS|METH_KEYWORDS, \"%s\" },\n", symname, wname, ds);
 	} else if (argcount == 0) {
-	  Printf(builtin_methods, "  { \"%s\", (PyCFunction) %s, METH_NOARGS, (char *) \"%s\" },\n", symname, wname, ds);
+	  Printf(builtin_methods, "  { \"%s\", %s, METH_NOARGS, \"%s\" },\n", symname, wname, ds);
 	} else if (argcount == 1) {
-	  Printf(builtin_methods, "  { \"%s\", (PyCFunction) %s, METH_O, (char *) \"%s\" },\n", symname, wname, ds);
+	  Printf(builtin_methods, "  { \"%s\", %s, METH_O, \"%s\" },\n", symname, wname, ds);
 	} else {
-	  Printf(builtin_methods, "  { \"%s\", (PyCFunction) %s, METH_VARARGS, (char *) \"%s\" },\n", symname, wname, ds);
+	  Printf(builtin_methods, "  { \"%s\", %s, METH_VARARGS, \"%s\" },\n", symname, wname, ds);
 	}
 	Delete(fullname);
 	Delete(wname);
@@ -4761,10 +4761,10 @@ public:
 	  Append(pyflags, "METH_VARARGS");
 	if (have_docstring(n)) {
 	  String *ds = cdocstring(n, AUTODOC_STATICFUNC);
-	  Printf(builtin_methods, "  { \"%s\", (PyCFunction) %s, %s, (char *) \"%s\" },\n", symname, wname, pyflags, ds);
+	  Printf(builtin_methods, "  { \"%s\", (PyCFunction)%s, %s, \"%s\" },\n", symname, wname, pyflags, ds);
 	  Delete(ds);
 	} else {
-	  Printf(builtin_methods, "  { \"%s\", (PyCFunction) %s, %s, \"\" },\n", symname, wname, pyflags);
+	  Printf(builtin_methods, "  { \"%s\", (PyCFunction)%s, %s, \"\" },\n", symname, wname, pyflags);
 	}
 	Delete(fullname);
 	Delete(wname);
 
projeto & código: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
mantenedor atual: Michael Shigorin
mantenedor da tradução: Fernando Martini aka fmartini © 2009