Skip to content

Compiler warnings from -Wcast-function-type in signal.h, slot.h #8

Closed
@db-src

Description

@db-src

After an update on Debian unstable, I'm getting a bunch of warnings like the below.

This might be due to a compiler update more than libsicg++ since the packages in my apt archive seem quite old:

ls /var/cache/apt/archives/*sigc*

-rw-r--r-- 1 root root  61244 Mar 14 23:10 /var/cache/apt/archives/libsigc++-2.0-0v5_2.10.0-2_amd64.deb
-rw-r--r-- 1 root root 114968 Mar 14 23:10 /var/cache/apt/archives/libsigc++-2.0-dev_2.10.0-2_amd64.deb

the warnings (not necessarily all of them, but you get the idea):

/usr/include/sigc++-2.0/sigc++/signal.h: In static member function ‘static sigc::internal::signal_emit0<void, sigc::nil>::result_type sigc::internal::signal_emit0<void, sigc::nil>::emit(sigc::internal::signal_impl*)’:
/usr/include/sigc++-2.0/sigc++/signal.h:798:56: warning: cast between incompatible function types from ‘sigc::internal::hook’ {aka ‘void* (*)(void*)’} to ‘sigc::internal::signal_emit0<void, sigc::nil>::call_type’ {aka ‘void (*)(sigc::internal::slot_rep*)’} [-Wcast-function-type]
           (reinterpret_cast<call_type>(slot.rep_->call_))(slot.rep_);
                                                        ^
/usr/include/sigc++-2.0/sigc++/signal.h: In static member function ‘static sigc::internal::signal_emit0<void, sigc::nil>::result_type sigc::internal::signal_emit0<void, sigc::nil>::emit_reverse(sigc::internal::signal_impl*)’:
/usr/include/sigc++-2.0/sigc++/signal.h:825:55: warning: cast between incompatible function types from ‘sigc::internal::hook’ {aka ‘void* (*)(void*)’} to ‘sigc::internal::signal_emit0<void, sigc::nil>::call_type’ {aka ‘void (*)(sigc::internal::slot_rep*)’} [-Wcast-function-type]
           (reinterpret_cast<call_type>(it->rep_->call_))(it->rep_);
/usr/include/sigc++-2.0/sigc++/functors/slot.h:1752:26:   required from ‘sigc::slot<T_return, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>::slot(const T_functor&) [with T_functor = djb::Control_Toggle_Two::Control_Toggle_Two(const Glib::ustring&, const Glib::ustring&, Gtk::Orientation)::<lambda()>; T_return = void]’
../../../home/daniel/src/hx1ed/modules/djb/gui/Control_Toggle_Two.cpp:34:4:   required from here
/usr/include/sigc++-2.0/sigc++/functors/slot.h:121:14: warning: cast between incompatible function types from ‘void (*)(sigc::internal::slot_rep*)’ to ‘sigc::internal::hook’ {aka ‘void* (*)(void*)’} [-Wcast-function-type]
     { return reinterpret_cast<hook>(&call_it); }

I don't know if these are solvable, but hopefully; I don't like having to just hide warnings when compiling my projects. However, I grimly suspect I might have to do so, since ultimately GLib and therefore perhaps glibmm as a consequence rely on doing naughty things with casts, which probably can't be avoided once we go deep enough. :P

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions