Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Thu, 16 Nov 2023 09:56:02 UTC Commit: c42004402ecefea7d809d4a51f7b427937ff4270 https://github.com/geany/geany/commit/c42004402ecefea7d809d4a51f7b427937ff42...
Log Message: ----------- Silence some -Wcast-function-type warnings
We choose to think that unused extra parameters to a function are safely ignored, so that we can safely use a `void(*)(void*)` and call it as `void(*)(void*, void*)` and it'll Do the Right Thing™. However, the compiler might easily warn about that, so hush it up.
Although kind of shady, this should work on any platform where GTK does, so we should be fine.
Modified Paths: -------------- plugins/splitwindow.c src/dialogs.c src/editor.c src/notebook.c src/symbols.c src/utils.h
Modified: plugins/splitwindow.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -249,7 +249,7 @@ static void on_doc_menu_item_clicked(gpointer item, GeanyDocument *doc) static void on_doc_show_menu(GtkMenuToolButton *button, GtkMenu *menu) { /* clear the old menu items */ - gtk_container_foreach(GTK_CONTAINER(menu), (GtkCallback) gtk_widget_destroy, NULL); + gtk_container_foreach(GTK_CONTAINER(menu), (GtkCallback) (void(*)(void)) gtk_widget_destroy, NULL);
ui_menu_add_document_items(menu, edit_window.editor->document, G_CALLBACK(on_doc_menu_item_clicked));
Modified: src/dialogs.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -982,7 +982,7 @@ dialogs_show_input_full(const gchar *title, GtkWindow *parent, g_signal_connect(data->entry, "insert-text", insert_text_cb, insert_text_cb_data); g_signal_connect(data->entry, "activate", G_CALLBACK(on_input_entry_activate), dialog); g_signal_connect(dialog, "show", G_CALLBACK(on_input_dialog_show), data->entry); - g_signal_connect_data(dialog, "response", G_CALLBACK(on_input_dialog_response), data, (GClosureNotify)g_free, 0); + g_signal_connect_data(dialog, "response", G_CALLBACK(on_input_dialog_response), data, CLOSURE_NOTIFY(g_free), 0);
if (persistent) {
Modified: src/editor.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -233,7 +233,7 @@ static void add_kb(GKeyFile *keyfile, const gchar *group, gchar **keys)
gtk_accel_group_connect(snippet_accel_group, key, mods, 0, g_cclosure_new_swap((GCallback)on_snippet_keybinding_activate, - g_strdup(keys[i]), (GClosureNotify)g_free)); + g_strdup(keys[i]), CLOSURE_NOTIFY(g_free))); } }
Modified: src/notebook.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -467,7 +467,7 @@ static void show_tab_bar_popup_menu(GdkEventButton *event, GeanyDocument *doc) menu = gtk_menu_new();
/* clear the old menu items */ - gtk_container_foreach(GTK_CONTAINER(menu), (GtkCallback) gtk_widget_destroy, NULL); + gtk_container_foreach(GTK_CONTAINER(menu), (GtkCallback) (void(*)(void)) gtk_widget_destroy, NULL);
ui_menu_add_document_items(GTK_MENU(menu), document_get_current(), G_CALLBACK(tab_bar_menu_activate_cb));
Modified: src/symbols.c 2 lines changed, 1 insertions(+), 1 deletions(-) =================================================================== @@ -1481,7 +1481,7 @@ static void show_goto_popup(GeanyDocument *doc, GPtrArray *tags, gboolean have_b item = g_object_new(GTK_TYPE_IMAGE_MENU_ITEM, "image", image, "child", box, "always-show-image", TRUE, "tooltip-markup", tooltip, NULL); g_signal_connect_data(item, "activate", G_CALLBACK(on_goto_popup_item_activate), - tm_tag_ref(tmtag), (GClosureNotify) tm_tag_unref, 0); + tm_tag_ref(tmtag), CLOSURE_NOTIFY(tm_tag_unref), 0); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
if (! first)
Modified: src/utils.h 4 lines changed, 4 insertions(+), 0 deletions(-) =================================================================== @@ -219,6 +219,10 @@ gchar **utils_strv_shorten_file_list(gchar **file_names, gssize file_names_len);
#ifdef GEANY_PRIVATE
+/* Casts a GDestroyNotify to a GClosureNotify without a warning. + * This is kinda shady, but likely works with platforms where GTK does. */ +#define CLOSURE_NOTIFY(f) ((GClosureNotify) (void(*)(void)) (GDestroyNotify) (f)) + typedef enum { RESOURCE_DIR_DATA,
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).