Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-6819

st_mysql_show_var::value should be void* not char*

Details

    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

      Attachments

        Activity

          hholzgra Hartmut Holzgraefe created issue -
          hholzgra Hartmut Holzgraefe made changes -
          Field Original Value New Value
          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
          (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:

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

          with C I'm getting

          {noformat}
          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}
                                ^
          {noformat}

          and with C++

          {noformat}
          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}
                                         ^
          {noformat}

          Suggested fix:
          Change st_mysql_show_var::value type to void* to allow writing of warning-free plugin code
          elenst Elena Stepanova made changes -
          elenst Elena Stepanova made changes -
          Labels upstream
          serg Sergei Golubchik made changes -
          Fix Version/s 10.1.2 [ 15801 ]
          serg Sergei Golubchik made changes -
          Assignee Sergei Golubchik [ serg ]
          serg Sergei Golubchik made changes -
          Priority Minor [ 4 ] Major [ 3 ]
          elenst Elena Stepanova made changes -
          Fix Version/s 10.1.3 [ 18000 ]
          Fix Version/s 10.1.2 [ 15801 ]
          serg Sergei Golubchik made changes -
          Fix Version/s 10.1.4 [ 18400 ]
          Fix Version/s 10.1.3 [ 18000 ]
          serg Sergei Golubchik made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          serg Sergei Golubchik made changes -
          Component/s Plugins [ 10118 ]
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Closed [ 6 ]
          ratzpo Rasmus Johansson (Inactive) made changes -
          Workflow MariaDB v2 [ 55062 ] MariaDB v3 [ 65202 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 65202 ] MariaDB v4 [ 148278 ]

          People

            serg Sergei Golubchik
            hholzgra Hartmut Holzgraefe
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.