[Cython] couple gcc warnings problems
Ondrej Certik
ondrej at certik.cz
Sat Aug 2 19:40:23 CEST 2008
Hi,
$ cython -v
Cython version 0.9.8
$ cython --convert-range step.pyx
$ gcc -O3 -W -Wall -I/usr/include/python2.5/ -I/usr/include/numpy/ -c
-o step.o step.c
step.c: In function '__pyx_pf_4step_temperature':
step.c:608: warning: unused parameter '__pyx_self'
step.c: In function '__pyx_pf_4step_advance':
step.c:739: warning: unused parameter '__pyx_self'
step.c: In function '__pyx_pf_4step_assign_speeds':
step.c:1068: warning: unused parameter '__pyx_self'
step.c: In function '__pyx_pf_4step_fit_in_the_box':
step.c:1336: warning: unused parameter '__pyx_self'
step.c: In function '__pyx_pf_4step_get_f':
step.c:1675: warning: unused parameter '__pyx_self'
step.c: In function '__pyx_pf_4step_get_f2':
step.c:1794: warning: unused parameter '__pyx_self'
step.c: In function '__pyx_pf_4step_calculate_potential':
step.c:1941: warning: unused parameter '__pyx_self'
step.c: At top level:
step.c:2052: warning: missing initializer
step.c:2052: warning: (near initialization for
'__pyx_string_tab[11].is_identifier')
/usr/include/numpy/__multiarray_api.h:959: warning: '_import_array'
defined but not used
Now you can discover couple problems above. The last warning:
step.c:2052: warning: missing initializer
step.c:2052: warning: (near initialization for
'__pyx_string_tab[11].is_identifier')
could be fixed by this patch to the step.c file:
$ quilt diff
Index: MD-spheres/step.c
===================================================================
--- MD-spheres.orig/step.c 2008-08-02 19:36:34.680765668 +0200
+++ MD-spheres/step.c 2008-08-02 19:36:50.085854557 +0200
@@ -2049,7 +2049,7 @@
{&__pyx_kp_append, __pyx_k_append, sizeof(__pyx_k_append), 1, 1, 1},
{&__pyx_kp_gauss, __pyx_k_gauss, sizeof(__pyx_k_gauss), 1, 1, 1},
{&__pyx_kp_get_f, __pyx_k_get_f, sizeof(__pyx_k_get_f), 0, 1, 1},
- {0, 0, 0, 0, 0}
+ {0, 0, 0, 0, 0, 0}
};
static struct PyMethodDef __pyx_methods[] = {
So this seems like a bug in Cython. As to the other warnings:
step.c:608: warning: unused parameter '__pyx_self'
If you look into the generated file:
static PyObject *__pyx_pf_4step_temperature(PyObject *__pyx_self,
PyObject *__pyx_args, PyObject *__pyx_kwds) {
Why does Cython generate the "self" argument? This is just a regular
function, not a method. And why isn't the first argument used? Is this
a bug?
Ondrej
-------------- next part --------------
A non-text attachment was scrubbed...
Name: step.pyx
Type: application/octet-stream
Size: 4221 bytes
Desc: not available
Url : http://codespeak.net/pipermail/cython-dev/attachments/20080802/c1dc4e03/attachment.obj
More information about the Cython-dev
mailing list