0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

patch 7.4.2358

Problem:    Compiler warnings with Solaris Studio when using GTK3.
Solution:   Define FUNC2GENERIC depending on the system. (Kazunobu Kuriyama)
This commit is contained in:
Bram Moolenaar
2016-09-09 22:13:24 +02:00
parent 46643713dc
commit d47d83745f
4 changed files with 40 additions and 12 deletions

View File

@@ -541,3 +541,29 @@ typedef enum
# define CONVERT_FROM_UTF8(String) (String) # define CONVERT_FROM_UTF8(String) (String)
# define CONVERT_FROM_UTF8_FREE(String) ((String) = (char_u *)NULL) # define CONVERT_FROM_UTF8_FREE(String) ((String) = (char_u *)NULL)
#endif /* FEAT_GUI_GTK */ #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 */

View File

@@ -508,7 +508,7 @@ removeEventHandler(BalloonEval *beval)
/* LINTED: avoid warning: dubious operation on enum */ /* LINTED: avoid warning: dubious operation on enum */
# if GTK_CHECK_VERSION(3,0,0) # if GTK_CHECK_VERSION(3,0,0)
g_signal_handlers_disconnect_by_func(G_OBJECT(beval->target), g_signal_handlers_disconnect_by_func(G_OBJECT(beval->target),
G_CALLBACK(target_event_cb), FUNC2GENERIC(target_event_cb),
beval); beval);
# else # else
gtk_signal_disconnect_by_func((GtkObject*)(beval->target), gtk_signal_disconnect_by_func((GtkObject*)(beval->target),
@@ -522,7 +522,7 @@ removeEventHandler(BalloonEval *beval)
/* LINTED: avoid warning: dubious operation on enum */ /* LINTED: avoid warning: dubious operation on enum */
# if GTK_CHECK_VERSION(3,0,0) # if GTK_CHECK_VERSION(3,0,0)
g_signal_handlers_disconnect_by_func(G_OBJECT(gui.mainwin), g_signal_handlers_disconnect_by_func(G_OBJECT(gui.mainwin),
G_CALLBACK(mainwin_event_cb), FUNC2GENERIC(mainwin_event_cb),
beval); beval);
# else # else
gtk_signal_disconnect_by_func((GtkObject*)(gui.mainwin), gtk_signal_disconnect_by_func((GtkObject*)(gui.mainwin),

View File

@@ -505,10 +505,10 @@ gtk_form_unrealize(GtkWidget *widget)
{ {
#if GTK_CHECK_VERSION(3,0,0) #if GTK_CHECK_VERSION(3,0,0)
g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget),
G_CALLBACK(gtk_form_child_map), FUNC2GENERIC(gtk_form_child_map),
child); child);
g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget),
G_CALLBACK(gtk_form_child_unmap), FUNC2GENERIC(gtk_form_child_unmap),
child); child);
#else #else
gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget),
@@ -793,9 +793,9 @@ gtk_form_remove(GtkContainer *container, GtkWidget *widget)
{ {
#if GTK_CHECK_VERSION(3,0,0) #if GTK_CHECK_VERSION(3,0,0)
g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget),
G_CALLBACK(&gtk_form_child_map), child); FUNC2GENERIC(&gtk_form_child_map), child);
g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget),
G_CALLBACK(&gtk_form_child_unmap), child); FUNC2GENERIC(&gtk_form_child_unmap), child);
#else #else
gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget), gtk_signal_disconnect_by_func(GTK_OBJECT(child->widget),
GTK_SIGNAL_FUNC(&gtk_form_child_map), child); GTK_SIGNAL_FUNC(&gtk_form_child_map), child);

View File

@@ -763,6 +763,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2358,
/**/ /**/
2357, 2357,
/**/ /**/