Bug #78177 Incorrect declaration in client_plugin.h
Submitted: 23 Aug 2015 18:37 Modified: 20 Nov 2015 14:23
Reporter: Alexey Kopytov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S3 (Non-critical)
Version:5.6, 5.7, 5.6.26 OS:Any
Assigned to: CPU Architecture:Any

[23 Aug 2015 18:37] Alexey Kopytov
Description:
There's the following code in client_plugin.h

---
/* generic plugin header structure */
#define MYSQL_CLIENT_PLUGIN_HEADER                      \
  int type;                                             \
  unsigned int interface_version;                       \
  const char *name;                                     \
  const char *author;                                   \
  const char *desc;                                     \
  unsigned int version[3];                              \
  const char *license;                                  \
  void *mysql_api;                                      \
  int (*init)(char *, size_t, int, va_list);            \
  int (*deinit)();                                      \
  int (*options)(const char *option, const void *);
---

Here deinit is supposed to be a pointer to a function with no arguments, but for a C compiler "int (*deinit)()" declares a pointer to a function with arbitrary number of arguments.

Since that code is a part of the client ABI, it generates the "function declaration isn’t a prototype" warning when building a C application against 5.7 client library headers with -Wstrict-prototypes.

How to repeat:
Build a C application against 5.7 client library with -Wstrict-prototypes enabled. I hit it with sysbench.

Suggested fix:
Change the declaration to "int (*deinit)(void)".
[23 Aug 2015 18:38] Alexey Kopytov
Also applies to 5.6.
[24 Aug 2015 6:20] MySQL Verification Team
Hello Alexey,

Thank you for the report.

Thanks,
Umesh
[11 Nov 2015 14:53] Alexey Kopytov
Changed the category from embedded library to C API.
[20 Nov 2015 14:23] Paul DuBois
Noted in 5.8.0 changelogs.

The client-side plugin deinitialization function signature was
changed from int (*deinit)() to int (*deinit)(void) to avoid warnings
when compiling with -Wstrict-prototypes.