Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc compilation warnings #169

Open
jjakob opened this issue Jun 6, 2023 · 1 comment
Open

gcc compilation warnings #169

jjakob opened this issue Jun 6, 2023 · 1 comment
Labels

Comments

@jjakob
Copy link

jjakob commented Jun 6, 2023

x86_64-pc-linux-gnu-gcc -Wsign-compare -DNDEBUG -O2 -pipe -march=core2 -DNDEBUG -fPIC -I/usr/include/python3.11 -c source/decoder.c -o build/temp.linux-x86_64-cpython-311/source/decoder.o -std=c99 -D_GNU_SOURCE
source/decoder.c: In function ‘decode_bytestring’:
source/decoder.c:605:33: warning: format ‘%llX’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
  605 |         sprintf(length_hex, "%llX", length);
      |                              ~~~^   ~~~~~~
      |                                 |   |
      |                                 |   uint64_t {aka long unsigned int}
      |                                 long long unsigned int
      |                              %lX
source/decoder.c: In function ‘decode_string’:
source/decoder.c:706:33: warning: format ‘%llX’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
  706 |         sprintf(length_hex, "%llX", length);
      |                              ~~~^   ~~~~~~
      |                                 |   |
      |                                 |   uint64_t {aka long unsigned int}
      |                                 long long unsigned int
      |                              %lX
source/decoder.c: In function ‘decode_array’:
source/decoder.c:863:33: warning: format ‘%llX’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t’ {aka ‘long unsigned int’} [-Wformat=]
  863 |         sprintf(length_hex, "%llX", length);
      |                              ~~~^   ~~~~~~
      |                                 |   |
      |                                 |   uint64_t {aka long unsigned int}
      |                                 long long unsigned int
      |                              %lX
x86_64-pc-linux-gnu-gcc -Wsign-compare -DNDEBUG -O2 -pipe -march=core2 -DNDEBUG -fPIC -I/usr/include/python3.11 -c source/encoder.c -o build/temp.linux-x86_64-cpython-311/source/encoder.o -std=c99 -D_GNU_SOURCE
source/encoder.c: In function ‘CBOREncoder_init’:
source/encoder.c:187:36: warning: initialization of ‘PyObject *’ {aka ‘struct _object *’} from incompatible pointer type ‘PyTypeObject *’ {aka
‘struct _typeobject *’} [-Wincompatible-pointer-types]
  187 |         PyObject *datetime_class = PyDateTimeAPI->DateType;
      |                                    ^~~~~~~~~~~~~

Building from Gentoo ebuild https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-python/cbor2/cbor2-5.4.6.ebuild
gcc 12.2.1

@Sekenre
Copy link
Collaborator

Sekenre commented Jun 9, 2023

I found a solution here: https://stackoverflow.com/questions/9225567/how-to-portably-print-a-int64-t-type-in-c
Will include in the next release, Thanks!

Sekenre added a commit to Sekenre/cbor2 that referenced this issue Jun 14, 2023
Fixes compiler warnings for unsigned int format string types.
@agronholm agronholm added the bug label Sep 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants