ueno / ruby-gpgme

a ruby interface to GnuPG Made Easy (GPGME).
GNU Lesser General Public License v2.1
232 stars 99 forks source link

Build failure with Clang 16 (`-Wincompatible-function-pointer-types`) #171

Closed thesamesam closed 1 year ago

thesamesam commented 1 year ago

Clang 16 makes -Wincompatible-function-pointer-types an error by default.

ruby-gpgme hits the following failure when building with Clang 16:

[...]
gpgme_n.c:2422:3: error: incompatible function pointer types passing 'VALUE
      (VALUE, VALUE, VALUE, VALUE)' (aka 'unsigned long (unsigned long, unsigned
      long, unsigned long, unsigned long)') to parameter of type 'VALUE
      (*)(VALUE, VALUE, VALUE, VALUE, VALUE)' (aka 'unsigned long (*)(unsigned
      long, unsigned long, unsigned long, unsigned long, unsigned long)')
      [-Werror,-Wincompatible-function-pointer-types]
  rb_define_module_function (mGPGME, "gpgme_op_keylist_ext_start",
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/ruby-2.7.0/ruby/ruby.h:2827:135: note: expanded from macro
      'rb_define_module_function'
  ...(func),(arity));
     ^~~~~~
/usr/include/ruby-2.7.0/ruby/ruby.h:2804:1: note: passing argument to parameter
      'func' here
RB_METHOD_DEFINITION_DECL(rb_define_module_function, (2,3), (VALUE klass...
^
/usr/include/ruby-2.7.0/ruby/intern.h:1077:89: note: expanded from macro
      'RB_METHOD_DEFINITION_DECL'
  ...,3 ,decl,vars,(VALUE,VALUE,VALUE,VALUE)) \
                                              ^
/usr/include/ruby-2.7.0/ruby/intern.h:1069:5: note: expanded from macro '\
RB_METHOD_DEFINITION_DECL_1'
    RB_METHOD_DEFINITION_DECL_C(def,nonnull,defname,decl,vars,funcargs) \
    ^
/usr/include/ruby-2.7.0/ruby/intern.h:1042:118: note: expanded from macro
      'RB_METHOD_DEFINITION_DECL_C'
  ...nonnull))static void defname(RB_UNWRAP_MACRO decl,VALUE(*func)funcargs,i...
                                                              ^
4 warnings and 1 error generated.
make: *** [Makefile:245: gpgme_n.o] Error 1

To reproduce this bug:

Reported downstream in Gentoo at https://bugs.gentoo.org/881203.

silasb commented 1 year ago

I just ran into this issue on M1, is there any workarounds for this?

ueno commented 1 year ago

Should be fixed with #176 (thanks @thukim). Feel free to reopen if the problem still persists.