Skip to content

Commit

Permalink
Suppress compiler warnings
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Sep 9, 2024
1 parent bf7f4fc commit bdd59b1
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions chardev/char-fd.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ fd_source_dispatch(GSource *source, GSourceFunc callback,
gpointer user_data)
{
FDSource *src = (FDSource *)source;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
FEWatchFunc func = (FEWatchFunc)callback;
#pragma GCC diagnostic pop
gboolean ret = G_SOURCE_CONTINUE;

if (src->cond) {
Expand Down Expand Up @@ -153,12 +156,18 @@ static GSource *fd_chr_add_watch(Chardev *chr, GIOCondition cond)

if (s->ioc_out) {
g_autoptr(GSource) child = qio_channel_create_watch(s->ioc_out, cond & ~G_IO_IN);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
g_source_set_callback(child, (GSourceFunc)child_func, source, NULL);
#pragma GCC diagnostic pop
g_source_add_child_source(source, child);
}
if (s->ioc_in) {
g_autoptr(GSource) child = qio_channel_create_watch(s->ioc_in, cond & ~G_IO_OUT);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
g_source_set_callback(child, (GSourceFunc)child_func, source, NULL);
#pragma GCC diagnostic pop
g_source_add_child_source(source, child);
}

Expand Down
3 changes: 3 additions & 0 deletions migration/rdma.c
Original file line number Diff line number Diff line change
Expand Up @@ -3017,7 +3017,10 @@ qio_channel_rdma_source_dispatch(GSource *source,
GSourceFunc callback,
gpointer user_data)
{
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
QIOChannelFunc func = (QIOChannelFunc)callback;
#pragma GCC diagnostic pop
QIOChannelRDMASource *rsource = (QIOChannelRDMASource *)source;
RDMAContext *rdma;
GIOCondition cond = 0;
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/test-util-filemonitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,11 @@ test_file_monitor_events(void)
g_timer_destroy(timer);

qemu_file_monitor_free(mon);
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
g_list_foreach(data.records,
(GFunc)qemu_file_monitor_test_record_free, NULL);
#pragma GCC diagnostic pop
g_list_free(data.records);
qemu_mutex_destroy(&data.lock);
if (dir) {
Expand Down
6 changes: 6 additions & 0 deletions ui/dbus-listener.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,13 +636,16 @@ static void dbus_gfx_update_sub(DBusDisplayListener *ddl,
}
}
#endif
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
v_data = g_variant_new_from_data(
G_VARIANT_TYPE("ay"),
pixman_image_get_data(img),
pixman_image_get_stride(img) * h,
TRUE,
(GDestroyNotify)pixman_image_unref,
img);
#pragma GCC diagnostic pop
qemu_dbus_display1_listener_call_update(ddl->proxy,
x, y, w, h, pixman_image_get_stride(img), pixman_image_get_format(img),
v_data,
Expand All @@ -654,10 +657,13 @@ static void ddl_scanout(DBusDisplayListener *ddl)
{
GVariant *v_data;

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
v_data = g_variant_new_from_data(
G_VARIANT_TYPE("ay"), surface_data(ddl->ds),
surface_stride(ddl->ds) * surface_height(ddl->ds), TRUE,
(GDestroyNotify)pixman_image_unref, pixman_image_ref(ddl->ds->image));
#pragma GCC diagnostic pop

ddl_discard_pending_messages(ddl);

Expand Down
3 changes: 3 additions & 0 deletions util/qtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,11 @@ q_tree_new(GCompareFunc key_compare_func)
{
g_return_val_if_fail(key_compare_func != NULL, NULL);

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type"
return q_tree_new_full((GCompareDataFunc) key_compare_func, NULL,
NULL, NULL);
#pragma GCC diagnostic pop
}

/**
Expand Down

0 comments on commit bdd59b1

Please sign in to comment.