Skip to content

New compiler warnings with the cython code #225

@jorisvandenbossche

Description

@jorisvandenbossche

When you build the cython code, we again have more warnings compared to the C code (at some point we fixed / silenced the majority of warnings with the C code, I think).

Locally, I get the following:

Details
building 'pygeos._geometry' extension
creating build/temp.linux-x86_64-3.8/pygeos
gcc -pthread -B /home/joris/miniconda3/envs/geo-dev/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./src -I/home/joris/miniconda3/envs/geo-dev/include -I/home/joris/miniconda3/envs/geo-dev/include/python3.8 -I/home/joris/miniconda3/envs/geo-dev/lib/python3.8/site-packages/numpy/core/include -c pygeos/_geometry.c -o build/temp.linux-x86_64-3.8/pygeos/_geometry.o
In file included from /home/joris/miniconda3/envs/geo-dev/lib/python3.8/site-packages/numpy/core/include/numpy/ndarraytypes.h:1832:0,
                 from /home/joris/miniconda3/envs/geo-dev/lib/python3.8/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                 from /home/joris/miniconda3/envs/geo-dev/lib/python3.8/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from pygeos/_geometry.c:637:
/home/joris/miniconda3/envs/geo-dev/lib/python3.8/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it with " \
  ^~~~~~~
In file included from pygeos/_geometry.c:639:0:
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:160:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 typedef void (GEOSInterruptCallback)();
 ^~~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:163:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern void GEOS_DLL GEOS_interruptRequest();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:165:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern void GEOS_DLL GEOS_interruptCancel();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:180:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern GEOSContextHandle_t GEOS_DLL GEOS_init_r();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:215:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern const char GEOS_DLL *GEOSversion();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:1362:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern int GEOS_DLL GEOS_getWKBOutputDims();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:1369:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern int GEOS_DLL GEOS_getWKBByteOrder();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:1491:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern GEOSBufferParams GEOS_DLL *GEOSBufferParams_create();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:1557:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyPoint();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:1560:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyLineString();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:1567:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyPolygon();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:2133:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern GEOSWKTReader GEOS_DLL *GEOSWKTReader_create();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:2138:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern GEOSWKTWriter GEOS_DLL *GEOSWKTWriter_create();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:2148:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern GEOSWKBReader GEOS_DLL *GEOSWKBReader_create();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:2154:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern GEOSWKBWriter GEOS_DLL *GEOSWKBWriter_create();
 ^~~~~~
pygeos/_geometry.c: In function ‘__pyx_pf_6pygeos_9_geometry_get_parts’:
pygeos/_geometry.c:3175:50: warning: passing argument 1 of ‘(char (*)(GeometryObject *, GEOSGeometry **))*(PyGEOS_API + 8)’ from incompatible pointer type [-Wincompatible-pointer-types]
             __pyx_t_6 = ((PyGEOS_GetGEOSGeometry(((PyObject *)__pyx_t_4), (&__pyx_v_geom)) == 0) != 0);
                                                  ^
pygeos/_geometry.c:3175:50: note: expected ‘GeometryObject * {aka struct <anonymous> *}’ but argument is of type ‘PyObject * {aka struct _object *}’
pygeos/_geometry.c:3260:28: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
               __pyx_v_part = __pyx_t_23;
                            ^
gcc -pthread -shared -B /home/joris/miniconda3/envs/geo-dev/compiler_compat -L/home/joris/miniconda3/envs/geo-dev/lib -Wl,-rpath=/home/joris/miniconda3/envs/geo-dev/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.8/pygeos/_geometry.o -L/home/joris/miniconda3/envs/geo-dev/lib -lgeos_c -o build/lib.linux-x86_64-3.8/pygeos/_geometry.cpython-38-x86_64-linux-gnu.so
building 'pygeos._geos' extension
gcc -pthread -B /home/joris/miniconda3/envs/geo-dev/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./src -I/home/joris/miniconda3/envs/geo-dev/include -I/home/joris/miniconda3/envs/geo-dev/include/python3.8 -I/home/joris/miniconda3/envs/geo-dev/lib/python3.8/site-packages/numpy/core/include -c pygeos/_geos.c -o build/temp.linux-x86_64-3.8/pygeos/_geos.o
In file included from pygeos/_geos.c:633:0:
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:160:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 typedef void (GEOSInterruptCallback)();
 ^~~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:163:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern void GEOS_DLL GEOS_interruptRequest();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:165:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern void GEOS_DLL GEOS_interruptCancel();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:180:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern GEOSContextHandle_t GEOS_DLL GEOS_init_r();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:215:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern const char GEOS_DLL *GEOSversion();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:1362:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern int GEOS_DLL GEOS_getWKBOutputDims();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:1369:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern int GEOS_DLL GEOS_getWKBByteOrder();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:1491:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern GEOSBufferParams GEOS_DLL *GEOSBufferParams_create();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:1557:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyPoint();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:1560:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyLineString();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:1567:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern GEOSGeometry GEOS_DLL *GEOSGeom_createEmptyPolygon();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:2133:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern GEOSWKTReader GEOS_DLL *GEOSWKTReader_create();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:2138:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern GEOSWKTWriter GEOS_DLL *GEOSWKTWriter_create();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:2148:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern GEOSWKBReader GEOS_DLL *GEOSWKBReader_create();
 ^~~~~~
/home/joris/miniconda3/envs/geo-dev/include/geos_c.h:2154:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
 extern GEOSWKBWriter GEOS_DLL *GEOSWKBWriter_create();
 ^~~~~~

So most of them are "function declaration isn’t a prototype" ones, that we silenced in the C code with #63 (need to see how we can do something similar for cython)

But there are also a few of them that seems actual warnings to fix:

pygeos/_geometry.c: In function ‘__pyx_pf_6pygeos_9_geometry_get_parts’:
pygeos/_geometry.c:3175:50: warning: passing argument 1 of ‘(char (*)(GeometryObject *, GEOSGeometry **))*(PyGEOS_API + 8)’ from incompatible pointer type [-Wincompatible-pointer-types]
             __pyx_t_6 = ((PyGEOS_GetGEOSGeometry(((PyObject *)__pyx_t_4), (&__pyx_v_geom)) == 0) != 0);
                                                  ^
pygeos/_geometry.c:3175:50: note: expected ‘GeometryObject * {aka struct <anonymous> *}’ but argument is of type ‘PyObject * {aka struct _object *}’
pygeos/_geometry.c:3260:28: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
               __pyx_v_part = __pyx_t_23;
                            ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions