niner / inline-python-pm

Inline::Python - Write Perl subs and classes in Python.
https://metacpan.org/release/Inline-Python
20 stars 13 forks source link

Fix compiler warnings #41

Closed ellert closed 11 months ago

ellert commented 11 months ago
py2pl.c: In function ‘croak_python_exception’:
py2pl.c:571:36: warning: format ‘%i’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat=]
  571 |             croak("%s: %s at line %i\n", ((PyTypeObject *)ex_type)->tp_name, c_ex_message, PyInt_AsLong(tb_lineno));
      |                                   ~^
      |                                    |
      |                                    int
      |                                   %li

perlmodule.c: In function ‘PerlObj_richcompare’:
perlmodule.c:549:11: warning: ‘retval’ may be used uninitialized [-Wmaybe-uninitialized]
  549 |         if(retval == 0) {Py_RETURN_TRUE;}
      |           ^
perlmodule.c:519:13: note: ‘retval’ was declared here
  519 |         int retval;
      |             ^~~~~~

perlmodule.c:967:27: warning: ‘PerlSub_methods’ defined but not used [-Wunused-variable]
  967 | static struct PyMethodDef PerlSub_methods[] = {
      |                           ^~~~~~~~~~~~~~~
niner commented 11 months ago

Thank you! These retval warnings actually pointed out real bugs.