agronholm / cbor2

Python CBOR (de)serializer with extensive tag support
MIT License
226 stars 59 forks source link

C extension fails to build with GCC 14 #236

Closed glaubitz closed 5 months ago

glaubitz commented 5 months ago

Things to check first

cbor2 version

5.6.3

Python version

3.11

What happened?

The C extension fails to build with GCC 14 as the default C/C++ compiler:

[   14s]   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/ -fPIC -I/usr/include/python3.10 -c source/decoder.c -o build/temp.linux-x86_64-cpython-310/source/decoder.o -std=c99 -D_GNU_SOURCE
[   14s]   source/decoder.c: In function ‘raise_from’:
[   14s]   source/decoder.c:375:1: error: no return statement in function returning non-void [-Werror=return-type]
[   14s]     375 | }
[   14s]         | ^
[   14s]   source/decoder.c: In function ‘decode_bytestring’:
[   14s]   source/decoder.c:697:33: warning: format ‘%llX’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
[   14s]     697 |         sprintf(length_hex, "%llX", length);
[   14s]         |                              ~~~^   ~~~~~~
[   14s]         |                                 |   |
[   14s]         |                                 |   uint64_t {aka long unsigned int}
[   14s]         |                                 long long unsigned int
[   14s]         |                              %lX
[   14s]   source/decoder.c: In function ‘decode_string’:
[   14s]   source/decoder.c:897:33: warning: format ‘%llX’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
[   14s]     897 |         sprintf(length_hex, "%llX", length);
[   14s]         |                              ~~~^   ~~~~~~
[   14s]         |                                 |   |
[   14s]         |                                 |   uint64_t {aka long unsigned int}
[   14s]         |                                 long long unsigned int
[   14s]         |                              %lX
[   14s]   source/decoder.c: In function ‘decode_array’:
[   14s]   source/decoder.c:1060:33: warning: format ‘%llX’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
[   14s]    1060 |         sprintf(length_hex, "%llX", length);
[   14s]         |                              ~~~^   ~~~~~~
[   14s]         |                                 |   |
[   14s]         |                                 |   uint64_t {aka long unsigned int}
[   14s]         |                                 long long unsigned int
[   14s]         |                              %lX
[   15s]   cc1: some warnings being treated as errors
[   15s]   error: command '/usr/bin/gcc' failed with exit code 1
[   15s]   error: subprocess-exited-with-error
[   15s]   
[   15s]   × Building wheel for cbor2 (pyproject.toml) did not run successfully.
[   15s]   │ exit code: 1
[   15s]   ╰─> See above for output.
[   15s]   
[   15s]   note: This error originates from a subprocess, and is likely not a problem with pip.

How can we reproduce the bug?

Use GCC 14 as the default C/C++ compiler.