phhusson / quassel-irssi

An irssi plugin to connect to quassel core
62 stars 16 forks source link

quassel-irssi fails to build with gcc 8 due to -Werror=cast-function-type #29

Open TC01 opened 6 years ago

TC01 commented 6 years ago

quassel-irssi's build failed in the Fedora 28 mass rebuild, which was done using gcc 8 and irssi 1.0.6. This seems to be due to setting the build flag-Werror=cast-function-type, e.g.:

quassel-net.c:110:8: error: cast between incompatible function types from 'void (*)(Quassel_SERVER_REC *)' {aka 'void (*)(struct Quassel_SERVER_REC_s *)'} to 'void (*)(void *, GIOChannel *, int)' {aka 'void (*)(void *, struct _GIOChannel *, int)'} [-Werror=cast-function-type]
        (GInputFunction) quassel_parse_incoming, r);
        ^
In file included from /usr/include/irssi//src/core/commands.h:4,
                 from quassel-net.c:25:
quassel-net.c: In function 'quassel_net_init':
quassel-net.c:165:39: error: cast between incompatible function types from 'void (*)(Quassel_SERVER_REC *)' {aka 'void (*)(struct Quassel_SERVER_REC_s *)'} to 'void (*)(const void *, const void *, const void *, const void *, const void *, const void *)' [-Werror=cast-function-type]
  signal_add_first("server connected", (SIGNAL_FUNC) sig_connected);
                                       ^
/usr/include/irssi//src/core/signals.h:23:78: note: in definition of macro 'signal_add_first'
  signal_add_full(MODULE_NAME, SIGNAL_PRIORITY_HIGH, (signal), (SIGNAL_FUNC) (func), NULL)
                                                                              ^~~~

There are a bunch more of these sorts of errors in the build log.

TC01 commented 6 years ago

Just an update: the build can indeed be fixed by passing -Wno-cast-function-type, but I don't know if this is a particularly sane thing to do. Unlike #25 this seems like something that might be an actual issue.

TC01 commented 6 years ago

After some investigation I think the cast function type warning is firing because SIGNAL_FUNC accepts up to six arguments but the calls here are only passing a handful, which makes me think that turning off the warning is the right thing to do. Just to be safe, I fired up a Fedora 28 chroot and tested this in there; it seems that quassel-irssi still functions.

I am a bit surprised that this warning hasn't (as far as I can tell) affected the build of irssi itself.