[MDEV-6819] st_mysql_show_var::value should be void* not char* Created: 2014-10-01  Updated: 2015-04-05  Resolved: 2015-03-05

Status: Closed
Project: MariaDB Server
Component/s: Plugins
Affects Version/s: 10.0.14
Fix Version/s: 10.1.4

Type: Bug Priority: Major
Reporter: Hartmut Holzgraefe Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: upstream


 Description   

(also filed as http://bugs.mysql.com/74170 )

Description:
... as conversion from function pointer to char* is not allowed in C / C++

How to repeat:
In my plugin I have:

static struct st_mysql_show_var my_plugin_statvars[]=
{
    {"my_show_entry", (char *)&show_my_entry, SHOW_FUNC}
}

with C I'm getting

my_plugin.c:131:32: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
    {"my_show_entry", (char *)&show_my_entry, SHOW_FUNC}
                      ^

and with C++

my_plugin.cc:131:41: warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object [enabled by default]
    {"my_show_entry", (char *)&show_my_entry, SHOW_FUNC}
                               ^

Suggested fix:
Change st_mysql_show_var::value type to void* to allow writing of warning-free plugin code


Generated at Thu Feb 08 07:14:49 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.