Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-16239

module.h does not provide prototypes of module API functions

XMLWordPrintable

    • Sprint 53 (Jun 2019), Sprint 54 (Jul 2019)
    • 0.125

      Steps to reproduce:
      Try to compile the following module code:

      #include "sysinc.h"
      #include "module.h"
      
      int	zbx_module_api_version(void)
      {
      	return ZBX_MODULE_API_VERSION;
      }
      
      int	zbx_module_init(void)
      {
      	return ZBX_MODULE_OK;
      }
      

      ...with -Wmissing-prototypes option.

      Result:

      $ make
      gcc -Wmissing-prototypes -fPIC -shared -o dummiest.so dummiest.c -I../../../include
      dummiest.c:4:5: warning: no previous prototype for ‘zbx_module_api_version’ [-Wmissing-prototypes]
       int zbx_module_api_version(void)
           ^~~~~~~~~~~~~~~~~~~~~~
      dummiest.c:9:5: warning: no previous prototype for ‘zbx_module_init’ [-Wmissing-prototypes]
       int zbx_module_init(void)
           ^~~~~~~~~~~~~~~
      

      Expected:
      No warnings when module source file defines functions with correct signatures. Warnings when module defines functions with wrong signatures. For this to happen module API functions should be declared in module.h header.

            viktors.tjarve Viktors Tjarve
            cyclone Glebs Ivanovskis
            Team A
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: