cabo / cbor-ruby

CBOR (RFC 7049) extension for Ruby
45 stars 12 forks source link

Compilation warnings against RUBY 2.7.1 #16

Closed MauriceS-gti closed 7 months ago

MauriceS-gti commented 3 years ago

I am trying to cross compile cbor-ruby as a custom package inside buildroot - but that is another painful story - it keeps selecting the native compiler instead of the cross compiler - but it shows the following warnings: I am NOT a ruby programmer by any means, so I have entered new territory here:

root/build/buildroot-top/buildroot/output/host/bin/ruby -I. ../../../../ext/cbor/extconf.rb
checking for ruby/st.h... yes
checking for st.h... yes
checking for rb_str_replace() in ruby.h... yes
checking for rb_big_new() in ruby.h... yes
checking for rb_intern_str() in ruby.h... yes
checking for rb_sym2str() in ruby.h... yes
checking for rb_str_intern() in ruby.h... yes
checking for rb_integer_unpack() in ruby.h... yes
creating Makefile
cd -
cd tmp/x86_64-linux/cbor/2.7.1
/usr/bin/make
compiling ../../../../ext/cbor/buffer.c
compiling ../../../../ext/cbor/buffer_class.c
../../../../ext/cbor/buffer_class.c: In function 'read_until_eof':
../../../../ext/cbor/buffer_class.c:270:17: warning: passing argument 3 of 'rb_rescue2' from incompatible pointer type [-Wincompatible-pointer-types]
                 read_until_eof_error, (VALUE)(void*) args,
                 ^~~~~~~~~~~~~~~~~~~~
In file included from /root/build/buildroot-top/buildroot/output/host/include/ruby-2.7.0/ruby.h:33:0,
                 from ../../../../ext/cbor/compat.h:30,
                 from ../../../../ext/cbor/buffer_class.c:28:
/root/build/buildroot-top/buildroot/output/host/include/ruby-2.7.0/ruby/ruby.h:1988:7: note: expected 'VALUE (*)(VALUE,  VALUE) {aka long unsigned int (*)(long unsigned int,  long unsigned int)}' but argument is of type 'VALUE (*)(VALUE) {aka long unsigned int (*)(long unsigned int)}'
 VALUE rb_rescue2(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE,...);
       ^~~~~~~~~~
compiling ../../../../ext/cbor/core_ext.c
compiling ../../../../ext/cbor/packer.c
compiling ../../../../ext/cbor/packer_class.c
compiling ../../../../ext/cbor/rbinit.c
compiling ../../../../ext/cbor/rmem.c
compiling ../../../../ext/cbor/unpacker.c
compiling ../../../../ext/cbor/unpacker_class.c
../../../../ext/cbor/unpacker_class.c: In function 'Unpacker_each':
../../../../ext/cbor/unpacker_class.c:281:17: warning: passing argument 3 of 'rb_rescue2' from incompatible pointer type [-Wincompatible-pointer-types]
                 Unpacker_rescue_EOFError, self,
                 ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/build/buildroot-top/buildroot/output/host/include/ruby-2.7.0/ruby.h:33:0,
                 from ../../../../ext/cbor/compat.h:30,
                 from ../../../../ext/cbor/buffer.h:32,
                 from ../../../../ext/cbor/unpacker.h:30,
                 from ../../../../ext/cbor/unpacker_class.c:28:
/root/build/buildroot-top/buildroot/output/host/include/ruby-2.7.0/ruby/ruby.h:1988:7: note: expected 'VALUE (*)(VALUE,  VALUE) {aka long unsigned int (*)(long unsigned int,  long unsigned int)}' but argument is of type 'VALUE (*)(VALUE) {aka long unsigned int (*)(long unsigned int)}'
 VALUE rb_rescue2(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE,...);
       ^~~~~~~~~~
linking shared-object cbor/cbor.so

This warning looks concerning...

scottgeary commented 10 months ago

This will likely cause actual errors when building with newer LLVM clang (v16+). Info here: https://discourse.llvm.org/t/clang-16-notice-of-potentially-breaking-changes/65562

cabo commented 10 months ago

Thanks for the alert! I'm on the brink of a vacation; will look at this when I'm back.

nanaya commented 8 months ago

FWIW, I got it to build and pass test on clang 16 by updating the functions to accept additional argument (which apparently the exception object).

cabo commented 8 months ago

FWIW, I got it to build and pass test on clang 16 by updating the functions to accept additional argument (which apparently the exception object).

Can you make a PR?