diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-09-09 22:13:24 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-09-09 22:13:24 +0200 |
commit | d47d83745ff450232328ca7a4b8b00b31bad22fc (patch) | |
tree | d31c75ba0d362c58fcdfee797661b63b9c8f9fd0 /src/gui.h | |
parent | 46643713dc6bb04b4e84986b1763ef309e960161 (diff) | |
download | vim-git-d47d83745ff450232328ca7a4b8b00b31bad22fc.tar.gz |
patch 7.4.2358v7.4.2358
Problem: Compiler warnings with Solaris Studio when using GTK3.
Solution: Define FUNC2GENERIC depending on the system. (Kazunobu Kuriyama)
Diffstat (limited to 'src/gui.h')
-rw-r--r-- | src/gui.h | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -541,3 +541,29 @@ typedef enum # 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 */ |