diff options
author | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2018-08-31 13:04:09 +0200 |
---|---|---|
committer | Kjell Ahlstedt <kjellahlstedt@gmail.com> | 2018-08-31 13:04:09 +0200 |
commit | af768ca0f1571532cf31d903713e42bdccacb8af (patch) | |
tree | 517de58b72ce132a9f85bbc1b8867a09e56293c6 /tests | |
parent | 51c6b8cec423cf7f3a903f31648898f285226a48 (diff) | |
download | glibmm-af768ca0f1571532cf31d903713e42bdccacb8af.tar.gz |
Avoid compiler warnings from function pointer conversions
gcc8 -Wextra prints a warning when a single reinterpret_cast is used for
conversion between different types of function pointers. The previous fix
with a union in Glib::bitwise_equivalent_cast<>() is not standard C++.
Rename the function to Glib::function_pointer_cast<>(), and use two
reinterpret_casts as recommended in gcc's documentation.
* glib/src/optiongroup.ccg: Use a reinterpret_cast to convert from
a function pointer to void*. That's possible now. It's "conditionally
supported", starting with C++11.
See https://github.com/libsigcplusplus/libsigcplusplus/issues/8
Diffstat (limited to 'tests')
-rw-r--r-- | tests/glibmm_vector/main.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/glibmm_vector/main.cc b/tests/glibmm_vector/main.cc index dd83553e..a3719532 100644 --- a/tests/glibmm_vector/main.cc +++ b/tests/glibmm_vector/main.cc @@ -198,12 +198,12 @@ public: { if (glist_) { - g_list_foreach(glist_, Glib::bitwise_equivalent_cast<GFunc>(g_object_unref), nullptr); + g_list_foreach(glist_, Glib::function_pointer_cast<GFunc>(g_object_unref), nullptr); g_list_free(glist_); } if (gslist_) { - g_slist_foreach(gslist_, Glib::bitwise_equivalent_cast<GFunc>(g_object_unref), nullptr); + g_slist_foreach(gslist_, Glib::function_pointer_cast<GFunc>(g_object_unref), nullptr); g_slist_free(gslist_); } if (garray_) |