[ZBX-10107] compilation warnings: call to function without a real prototype, take 2 Created: 2015 Nov 20  Updated: 2017 May 30  Resolved: 2015 Dec 01

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: 3.0.0alpha4
Fix Version/s: 3.0.0alpha5

Type: Incident report Priority: Trivial
Reporter: richlv Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: compilation
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

trunk r56797, gcc 4.8.1



 Description   

similar to ZBX-9814

stats.c: In function 'init_collector_data':
stats.c:196:2: warning: call to function 'zbx_procstat_init' without a real prototype [-Wunprototyped-calls]
  zbx_procstat_init(&collector->procstat);
  ^
In file included from stats.h:38:0,
                 from stats.c:21:
procstat.h:49:6: note: 'zbx_procstat_init' was declared here
 void zbx_procstat_init();
      ^
stats.c: In function 'free_collector_data':
stats.c:232:2: warning: call to function 'zbx_procstat_destroy' without a real prototype [-Wunprototyped-calls]
  zbx_procstat_destroy(&collector->procstat);
  ^
In file included from stats.h:38:0,
                 from stats.c:21:
procstat.h:50:6: note: 'zbx_procstat_destroy' was declared here
 void zbx_procstat_destroy();
      ^
stats.c: In function 'init_collector_data':
stats.c:196:2: warning: call to function 'zbx_procstat_init' without a real prototype [-Wunprototyped-calls]
  zbx_procstat_init(&collector->procstat);
  ^
In file included from stats.h:38:0,
                 from stats.c:21:
procstat.h:49:6: note: 'zbx_procstat_init' was declared here
 void zbx_procstat_init();
      ^
stats.c: In function 'free_collector_data':
stats.c:232:2: warning: call to function 'zbx_procstat_destroy' without a real prototype [-Wunprototyped-calls]
  zbx_procstat_destroy(&collector->procstat);
  ^
In file included from stats.h:38:0,
                 from stats.c:21:
procstat.h:50:6: note: 'zbx_procstat_destroy' was declared here
 void zbx_procstat_destroy();
      ^

it also looks like stats.c is compiled twice - once for agent, once for agentd. we might want to ignore that until agent is removed for 3.2



 Comments   
Comment by Viktors Tjarve [ 2015 Nov 25 ]

This issue originated form ZBXNEXT-494.

Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-10107

Comment by richlv [ 2015 Nov 25 ]

warning are gone in the development branch, thanks

Comment by Sandis Neilands (Inactive) [ 2015 Nov 25 ]

(1) Since neither zbx_procstat_init() nor zbx_procstat_destroy() use the passed parameter I suggest to fix this issue by removing the parameter from both definition and declaration.

viktors.tjarve RESOLVED in r56890.

sandis.neilands CLOSED.

Comment by richlv [ 2015 Nov 26 ]

still no warnings after subissue (1)

Comment by Viktors Tjarve [ 2015 Nov 26 ]

Released in:

  • pre-3.0.0alpha5 r56931
Comment by Aleksandrs Saveljevs [ 2015 Nov 30 ]

(2) In order to avoid warnings like these in the future, it might be better to add "void" to parameter-less functions in procstat.c, like this:

Index: src/zabbix_agent/procstat.c
===================================================================
--- src/zabbix_agent/procstat.c (revision 56928)
+++ src/zabbix_agent/procstat.c (working copy)
@@ -987,7 +987,7 @@
  * Return value: This function calls exit() on shared memory errors.          *
  *                                                                            *
  ******************************************************************************/
-void   zbx_procstat_init()
+void   zbx_procstat_init(void)
 {
        char    *errmsg = NULL;

This prevents programmers from passing arguments to that function. Otherwise, zbx_procstat_init() can be legally given any number of arguments.

viktors.tjarve RESOLVED directly in trunk in r56931.

asaveljevs Looks good. CLOSED.

Generated at Thu Apr 18 16:31:09 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.