AEI-ACR / pygsl_lite

A minimal wrapper for GSL based on the pygsl library
GNU General Public License v2.0
0 stars 1 forks source link

Incompatible with GCC 14 #3

Open ahnitz opened 2 months ago

ahnitz commented 2 months ago

GCC 14 (and a few other compilers) are increasingly strict on behavior. Several things which were warnings are now errors.

See e.g. https://gcc.gnu.org/gcc-14/porting_to.html

Here is an example compliation error on GCC 14.1.1 (Fedora 40)

      gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -fPIC -DSWIG_COBJECT_TYPES=1 -DDEBUG=1 -DPyGSL_SET_GSL_ERROR_HANDLER=1 -DNUMERIC=0 -UNDEBUG -I/usr/include -IInclude -I. -I/tmp/pip-build-env-a052z85h/overlay/lib64/python3.11/site-packages/numpy/_core/include -I/home/ahnitz/projects/env/include -I/usr/include/python3.11 -c src/init/errorno.c -o build/temp.linux-x86_64-cpython-311/src/init/errorno.o
      gcc -shared build/temp.linux-x86_64-cpython-311/src/init/errorno.o -L/usr/lib -L/usr/lib64 -lgsl -lm -o build/lib.linux-x86_64-cpython-311/pygsl_lite/errno.cpython-311-x86_64-linux-gnu.so
      building 'init' extension
      gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -fPIC -DSWIG_COBJECT_TYPES=1 -DDEBUG=1 -DPyGSL_SET_GSL_ERROR_HANDLER=1 -DNUMERIC=0 -UNDEBUG -I/usr/include -IInclude -I. -I/tmp/pip-build-env-a052z85h/overlay/lib64/python3.11/site-packages/numpy/_core/include -I/home/ahnitz/projects/env/include -I/usr/include/python3.11 -c src/init/initmodule.c -o build/temp.linux-x86_64-cpython-311/src/init/initmodule.o
      In file included from src/init/initmodule.c:78:
      src/init/function_helpers.c: In function ‘PyGSL_function_wrap_helper’:
      src/init/function_helpers.c:31:6: warning: ‘PyEval_CallObjectWithKeywords’ is deprecated [-Wdeprecated-declarations]
         31 |      object  = PyEval_CallObject(callback, arglist);
            |      ^~~~~~
      In file included from /usr/include/python3.11/Python.h:95,
                       from Include/pygsl_lite/intern.h:9,
                       from src/init/initmodule.c:19:
      /usr/include/python3.11/ceval.h:27:43: note: declared here
         27 | Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
            |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      gcc -shared build/temp.linux-x86_64-cpython-311/src/init/initmodule.o -L/usr/lib -L/usr/lib64 -lgsl -lm -o build/lib.linux-x86_64-cpython-311/pygsl_lite/init.cpython-311-x86_64-linux-gnu.so
      building 'inittest' extension
      gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -fPIC -DSWIG_COBJECT_TYPES=1 -DDEBUG=1 -DPyGSL_SET_GSL_ERROR_HANDLER=1 -DNUMERIC=0 -UNDEBUG -I/usr/include -IInclude -I. -I/tmp/pip-build-env-a052z85h/overlay/lib64/python3.11/site-packages/numpy/_core/include -I/home/ahnitz/projects/env/include -I/usr/include/python3.11 -c src/init/inittestmodule.c -o build/temp.linux-x86_64-cpython-311/src/init/inittestmodule.o
      gcc -shared build/temp.linux-x86_64-cpython-311/src/init/inittestmodule.o -L/usr/lib -L/usr/lib64 -lgsl -lm -o build/lib.linux-x86_64-cpython-311/pygsl_lite/inittest.cpython-311-x86_64-linux-gnu.so
      building '_gslwrap' extension
      creating build/temp.linux-x86_64-cpython-311/swig_src
      gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -fPIC -DSWIG_COBJECT_TYPES=1 -DDEBUG=1 -DPyGSL_SET_GSL_ERROR_HANDLER=1 -DNUMERIC=0 -UNDEBUG -I/usr/include -IInclude -I. -I/tmp/pip-build-env-a052z85h/overlay/lib64/python3.11/site-packages/numpy/_core/include -I/home/ahnitz/projects/env/include -I/usr/include/python3.11 -c swig_src/gslwrap_wrap.c -o build/temp.linux-x86_64-cpython-311/swig_src/gslwrap_wrap.o
      swig_src/gslwrap_wrap.c: In function ‘_wrap_gsl_interp_bsearch’:
      swig_src/gslwrap_wrap.c:5931:13: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
       5931 |     if(arg3 >= _PyVectorLength){
            |             ^~
      swig_src/gslwrap_wrap.c:5941:13: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
       5941 |     if(arg4 >= _PyVectorLength){
            |             ^~
      gcc -shared build/temp.linux-x86_64-cpython-311/swig_src/gslwrap_wrap.o -L/usr/lib -L/usr/lib64 -lgsl -lm -o build/lib.linux-x86_64-cpython-311/pygsl_lite/_gslwrap.cpython-311-x86_64-linux-gnu.so
      building '_odeiv2' extension
      gcc -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -fcf-protection -fexceptions -fcf-protection -fexceptions -fcf-protection -fexceptions -fPIC -DSWIG_COBJECT_TYPES=1 -DDEBUG=1 -DPyGSL_SET_GSL_ERROR_HANDLER=1 -DNUMERIC=0 -UNDEBUG -I/usr/include -Isrc/callback -IInclude -I. -I/tmp/pip-build-env-a052z85h/overlay/lib64/python3.11/site-packages/numpy/_core/include -I/home/ahnitz/projects/env/include -I/usr/include/python3.11 -c swig_src/odeiv2_wrap.c -o build/temp.linux-x86_64-cpython-311/swig_src/odeiv2_wrap.o
      In file included from swig_src/odeiv2_wrap.c:3472:
      src/callback/odeiv_func2.ic: In function ‘PyGSL_odeiv_func’:
      src/callback/odeiv_func2.ic:45:5: warning: ‘PyEval_CallObjectWithKeywords’ is deprecated [-Wdeprecated-declarations]
         45 |     result  = PyEval_CallObject(p->py_func, arglist);
            |     ^~~~~~
      In file included from /usr/include/python3.11/Python.h:95,
                       from swig_src/odeiv2_wrap.c:155:
      /usr/include/python3.11/ceval.h:27:43: note: declared here
         27 | Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
            |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      src/callback/odeiv_func2.ic: In function ‘PyGSL_odeiv_jac’:
      src/callback/odeiv_func2.ic:106:5: warning: ‘PyEval_CallObjectWithKeywords’ is deprecated [-Wdeprecated-declarations]
        106 |     result  = PyEval_CallObject(p->py_jac, arglist);
            |     ^~~~~~
      /usr/include/python3.11/ceval.h:27:43: note: declared here
         27 | Py_DEPRECATED(3.9) PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords(
            |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      swig_src/odeiv2_wrap.c: In function ‘pygsl_lite_odeiv2_control_hadjust’:
      swig_src/odeiv2_wrap.c:4154:24: warning: comparison of integer expressions of different signedness: ‘PyGSL_array_index_t’ {aka ‘long int’} and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
       4154 |                 if(dim != self->dimension){
            |                        ^~
      swig_src/odeiv2_wrap.c: In function ‘pygsl_lite_odeiv2_evolve_apply’:
      swig_src/odeiv2_wrap.c:4250:40: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘PyGSL_array_index_t’ {aka ‘long int’} [-Wsign-compare]
       4250 |                 if(sys->dydt.dimension != dim){
            |                                        ^~
      swig_src/odeiv2_wrap.c: In function ‘pygsl_lite_odeiv2_evolve_apply_fixed_step’:
      swig_src/odeiv2_wrap.c:4331:40: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘PyGSL_array_index_t’ {aka ‘long int’} [-Wsign-compare]
       4331 |                 if(sys->dydt.dimension != dim){
            |                                        ^~
      swig_src/odeiv2_wrap.c:4336:71: error: passing argument 2 of ‘_pygsl_lite_odeiv2_check_step_jacobian’ from incompatible pointer type [-Wincompatible-pointer-types]
       4336 |                 status = _pygsl_lite_odeiv2_check_step_jacobian(step, &sys->dydt);
            |                                                                       ^~~~~~~~~~
            |                                                                       |
            |                                                                       const gsl_odeiv2_system *
      swig_src/odeiv2_wrap.c:3548:119: note: expected ‘const pygsl_lite_odeiv2_system *’ but argument is of type ‘const gsl_odeiv2_system *’
       3548 | static int _pygsl_lite_odeiv2_check_step_jacobian(const pygsl_lite_odeiv2_step *step, const pygsl_lite_odeiv2_system *sys)
            |                                                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
      swig_src/odeiv2_wrap.c: In function ‘pygsl_lite_odeiv2_driver_apply_fixed_step’:
      swig_src/odeiv2_wrap.c:4513:94: error: passing argument 2 of ‘_pygsl_lite_odeiv2_check_step_jacobian’ from incompatible pointer type [-Wincompatible-pointer-types]
       4513 |                 status = _pygsl_lite_odeiv2_check_step_jacobian(self->driver->s, self->driver->sys);
            |                                                                                  ~~~~~~~~~~~~^~~~~
            |                                                                                              |
            |                                                                                              const gsl_odeiv2_system *
      swig_src/odeiv2_wrap.c:3548:119: note: expected ‘const pygsl_lite_odeiv2_system *’ but argument is of type ‘const gsl_odeiv2_system *’
       3548 | static int _pygsl_lite_odeiv2_check_step_jacobian(const pygsl_lite_odeiv2_step *step, const pygsl_lite_odeiv2_system *sys)
            |                                                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
      swig_src/odeiv2_wrap.c: In function ‘pygsl_lite_odeiv2_driver_apply’:
      swig_src/odeiv2_wrap.c:4554:94: error: passing argument 2 of ‘_pygsl_lite_odeiv2_check_step_jacobian’ from incompatible pointer type [-Wincompatible-pointer-types]
       4554 |                 status = _pygsl_lite_odeiv2_check_step_jacobian(self->driver->s, self->driver->sys);
            |                                                                                  ~~~~~~~~~~~~^~~~~
            |                                                                                              |
            |                                                                                              const gsl_odeiv2_system *
      swig_src/odeiv2_wrap.c:3548:119: note: expected ‘const pygsl_lite_odeiv2_system *’ but argument is of type ‘const gsl_odeiv2_system *’
       3548 | static int _pygsl_lite_odeiv2_check_step_jacobian(const pygsl_lite_odeiv2_step *step, const pygsl_lite_odeiv2_system *sys)
            |                                                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
      error: command '/usr/bin/gcc' failed with exit code 1
ahnitz commented 2 months ago

@raffienficiaud Any opinion here?

raffienficiaud commented 1 month ago

I believe #6 is fixing it. Would it be possible to give a try on master?