To: vim_dev@googlegroups.com Subject: Patch 7.4.2358 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.4.2358 Problem: Compiler warnings with Solaris Studio when using GTK3. Solution: Define FUNC2GENERIC depending on the system. (Kazunobu Kuriyama) Files: src/gui.h, src/gui_beval.c, src/gui_gtk_f.c *** ../vim-7.4.2357/src/gui.h 2016-08-29 22:48:12.133106320 +0200 --- src/gui.h 2016-09-09 22:00:25.423601792 +0200 *************** *** 541,543 **** --- 541,569 ---- # define CONVERT_FROM_UTF8(String) (String) # define CONVERT_FROM_UTF8_FREE(String) ((String) = (char_u *)NULL) #endif /* FEAT_GUI_GTK */ + + #ifdef FEAT_GUI_GTK + /* + * The second parameter of g_signal_handlers_disconnect_by_func() is supposed + * to be a function pointer which was passed to g_signal_connect_*() somewhere + * previously, and hence it must be of type GCallback, i.e., void (*)(void). + * + * Meanwhile, g_signal_handlers_disconnect_by_func() is a macro calling + * g_signal_handlers_disconnect_matched(), and the second parameter of the + * former is to be passed to the sixth parameter of the latter the type of + * which, however, is declared as void * in the function signature. + * + * While the ISO C Standard does not require that function pointers be + * interconvertible to void *, widely-used compilers such as gcc and clang + * do such conversion implicitly and automatically on some platforms without + * issuing any warning. + * + * For Solaris Studio, that is not the case. An explicit type cast is needed + * to suppress warnings on that particular conversion. + */ + # if defined(__SUNPRO_C) && defined(USE_GTK3) + # define FUNC2GENERIC(func) (void *)(func) + # else + # define FUNC2GENERIC(func) G_CALLBACK(func) + # endif + #endif /* FEAT_GUI_GTK */ *** ../vim-7.4.2357/src/gui_beval.c 2016-08-29 22:48:12.137106286 +0200 --- src/gui_beval.c 2016-09-09 22:00:25.427601739 +0200 *************** *** 508,514 **** /* LINTED: avoid warning: dubious operation on enum */ # if GTK_CHECK_VERSION(3,0,0) g_signal_handlers_disconnect_by_func(G_OBJECT(beval->target), ! G_CALLBACK(target_event_cb), beval); # else gtk_signal_disconnect_by_func((GtkObject*)(beval->target), --- 508,514 ---- /* LINTED: avoid warning: dubious operation on enum */ # if GTK_CHECK_VERSION(3,0,0) g_signal_handlers_disconnect_by_func(G_OBJECT(beval->target), ! FUNC2GENERIC(target_event_cb), beval); # else gtk_signal_disconnect_by_func((GtkObject*)(beval->target), *************** *** 522,528 **** /* LINTED: avoid warning: dubious operation on enum */ # if GTK_CHECK_VERSION(3,0,0) g_signal_handlers_disconnect_by_func(G_OBJECT(gui.mainwin), ! G_CALLBACK(mainwin_event_cb), beval); # else gtk_signal_disconnect_by_func((GtkObject*)(gui.mainwin), --- 522,528 ---- /* LINTED: avoid warning: dubious operation on enum */ # if GTK_CHECK_VERSION(3,0,0) g_signal_handlers_disconnect_by_func(G_OBJECT(gui.mainwin), ! FUNC2GENERIC(mainwin_event_cb), beval); # else gtk_signal_disconnect_by_func((GtkObject*)(gui.mainwin), *** ../vim-7.4.2357/src/gui_gtk_f.c 2016-08-29 22:48:12.137106286 +0200 --- src/gui_gtk_f.c 2016-09-09 22:00:25.427601739 +0200 *************** *** 505,522 **** { #if GTK_CHECK_VERSION(3,0,0) g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), ! G_CALLBACK(gtk_form_child_map), child); g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), ! G_CALLBACK(gtk_form_child_unmap), child); #else gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), ! GTK_SIGNAL_FUNC(gtk_form_child_map), ! child); gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), ! GTK_SIGNAL_FUNC(gtk_form_child_unmap), ! child); #endif gdk_window_set_user_data(child->window, NULL); --- 505,522 ---- { #if GTK_CHECK_VERSION(3,0,0) g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), ! FUNC2GENERIC(gtk_form_child_map), child); g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), ! FUNC2GENERIC(gtk_form_child_unmap), child); #else gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), ! GTK_SIGNAL_FUNC(gtk_form_child_map), ! child); gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), ! GTK_SIGNAL_FUNC(gtk_form_child_unmap), ! child); #endif gdk_window_set_user_data(child->window, NULL); *************** *** 793,806 **** { #if GTK_CHECK_VERSION(3,0,0) g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), ! G_CALLBACK(>k_form_child_map), child); g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), ! G_CALLBACK(>k_form_child_unmap), child); #else gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), ! GTK_SIGNAL_FUNC(>k_form_child_map), child); gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), ! GTK_SIGNAL_FUNC(>k_form_child_unmap), child); #endif /* FIXME: This will cause problems for reparenting NO_WINDOW --- 793,806 ---- { #if GTK_CHECK_VERSION(3,0,0) g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), ! FUNC2GENERIC(>k_form_child_map), child); g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), ! FUNC2GENERIC(>k_form_child_unmap), child); #else gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), ! GTK_SIGNAL_FUNC(>k_form_child_map), child); gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), ! GTK_SIGNAL_FUNC(>k_form_child_unmap), child); #endif /* FIXME: This will cause problems for reparenting NO_WINDOW *** ../vim-7.4.2357/src/version.c 2016-09-09 21:42:32.214073404 +0200 --- src/version.c 2016-09-09 22:01:45.438522663 +0200 *************** *** 765,766 **** --- 765,768 ---- { /* Add new patch number below this line */ + /**/ + 2358, /**/ -- How do I set the laser printer to stun? /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///