mjschultz / py-radix

Python radix tree implementation for IPv4 and IPv6 prefix matching.
Other
121 stars 37 forks source link

Fails to build with GCC 14 as the default compiler due to -Wincompatible-pointer-types #57

Open glaubitz opened 4 months ago

glaubitz commented 4 months ago

Trying to build py-radix with GCC 14 fails due to -Wincompatible-pointer-types:

[   13s] gcc -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -DOPENSSL_LOAD_CONF -fwrapv -fno-semantic-interposition -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -IVendor/ -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -g -IVendor/ -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -Werror=return-type -flto=auto -g -fPIC -I/home/abuild/rpmbuild/BUILD/py-radix-0.10.0/radix -I/usr/include/python3.10 -c radix/_radix.c -o build/temp.linux-x86_64-cpython-310/radix/_radix.o
[   13s] radix/_radix.c: In function ‘add_node_to_list’:
[   13s] radix/_radix.c:527:37: error: passing argument 2 of ‘PyList_Append’ from incompatible pointer type [-Wincompatible-pointer-types]
[   13s]   527 |                 PyList_Append(ret, ((RadixNodeObject *)node->data));
[   13s]       |                                    ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[   13s]       |                                     |
[   13s]       |                                     RadixNodeObject *
[   13s] In file included from /usr/include/python3.10/Python.h:92,
[   13s]                  from radix/_radix.c:17:
[   13s] /usr/include/python3.10/listobject.h:34:43: note: expected ‘PyObject *’ {aka ‘struct _object *’} but argument is of type ‘RadixNodeObject *’
[   13s]    34 | PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *);
[   13s]       |                                           ^~~~~~~~~~
[   13s] error: command '/usr/bin/gcc' failed with exit code 1

To reproduce, use GCC 14 as the default C/C++ compiler.