[ZBX-11105] Silence the warnings regarding unused parameters from Linux x86_64 builds Created: 2016 Aug 17  Updated: 2017 May 30  Resolved: 2016 Sep 02

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G), Proxy (P), Server (S)
Affects Version/s: 3.2.0alpha1
Fix Version/s: 3.2.0beta1, 3.2.0beta2

Type: Incident report Priority: Minor
Reporter: Sandis Neilands (Inactive) Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: codequality, warning
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

$ clang -v
Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4)
Target: x86_64-pc-linux-gnu


Attachments: File unused.patch    

 Description   

The attached patch fixes warnings regarding unused parameters by removing the parameters where possible or using the new ZBX_UNUSED macro where it's not possible (callbacks to libraries, proxy stub functions, etc.).

Configuration.

./configure --prefix=`pwd`/usr CC=clang CFLAGS="-Wall -Wextra -g" \
--enable-server --enable-proxy --enable-agent --enable-java --enable-ipv6 \
--with-mysql --with-jabber --with-libxml2 --with-net-snmp --with-unixodbc \
--with-ssh2 --with-openipmi --with-ldap --with-libcurl --with-iconv --with-openssl


 Comments   
Comment by Sandis Neilands (Inactive) [ 2016 Aug 17 ]

Related: ZBXNEXT-803.

Comment by Sandis Neilands (Inactive) [ 2016 Aug 18 ]

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

Comment by Sandis Neilands (Inactive) [ 2016 Aug 18 ]

Most cases are absolutely safe hover there are several instances that should be discussed with the original authors of the code.

Comment by Andris Zeila [ 2016 Aug 23 ]

(1) While oid parameter is not used by zbx_snmp_walk_discovery_cb() callback function, it is used by zbx_snmp_walk_cache_cb().

RESOLVED in r61852.

sandis.neilands Thanks! CLOSED.

Comment by Andris Zeila [ 2016 Aug 23 ]

Tested with one fix commited in (1).

Comment by Sandis Neilands (Inactive) [ 2016 Aug 24 ]

Released in:

  • pre-3.2.0beta1 r61887.
Comment by Alexander Vladishev [ 2016 Aug 25 ]

(2) Broken compilation under Windows

        cl.exe ..\..\..\src\libs\zbxsysinfo\common\system.c /Fo"..\..\..\src\libs\zbxsysinfo\common\system.o
" /I ..\..\..\src\zabbix_agent /I .\ /I ..\include /I ..\..\..\include  /D WITH_AGENT_METRICS /D WITH_COMMON
_METRICS /D WITH_SPECIFIC_METRICS  /D WITH_HOSTNAME_METRIC /D WITH_SIMPLE_METRICS /Zi /Fdzabbix_agentd.exe.p
db /nologo /O2 /Ob1 /GF /FD /EHsc /MT /Gy /W3 /c /D _WINDOWS /D _WIN32_WINNT=0x0500  /D _CONSOLE /D UNICODE
/D _UNICODE /D HAVE_WINLDAP_H /D HAVE_ASSERT_H  /D ZABBIX_SERVICE /D "_VC80_UPGRADE=0x0600" /D HAVE_IPV6 /TC

system.c
..\..\..\src\libs\zbxsysinfo\common\system.c(72) : error C2143: syntax error : missing ';' before 'type'
..\..\..\src\libs\zbxsysinfo\common\system.c(73) : error C2275: 'AGENT_REQUEST' : illegal use of this type a
s an expression
        c:\zabbix\zabbix-svn\trunk\include\module.h(57) : see declaration of 'AGENT_REQUEST'
..\..\..\src\libs\zbxsysinfo\common\system.c(73) : error C2146: syntax error : missing ';' before identifier
 'request_tmp'
..\..\..\src\libs\zbxsysinfo\common\system.c(73) : error C2065: 'request_tmp' : undeclared identifier
..\..\..\src\libs\zbxsysinfo\common\system.c(74) : error C2143: syntax error : missing ';' before 'type'
..\..\..\src\libs\zbxsysinfo\common\system.c(76) : error C2065: 'counter_path' : undeclared identifier
..\..\..\src\libs\zbxsysinfo\common\system.c(76) : warning C4047: 'function' : 'char *' differs in levels of
 indirection from 'int'
..\..\..\src\libs\zbxsysinfo\common\system.c(76) : warning C4024: '__zbx_zbx_snprintf' : different types for
 formal and actual parameter 1
..\..\..\src\libs\zbxsysinfo\common\system.c(76) : error C2065: 'counter_path' : undeclared identifier
..\..\..\src\libs\zbxsysinfo\common\system.c(78) : error C2065: 'request_tmp' : undeclared identifier
..\..\..\src\libs\zbxsysinfo\common\system.c(78) : error C2224: left of '.nparam' must have struct/union typ
e
..\..\..\src\libs\zbxsysinfo\common\system.c(79) : error C2065: 'request_tmp' : undeclared identifier
..\..\..\src\libs\zbxsysinfo\common\system.c(79) : error C2224: left of '.params' must have struct/union typ
e
..\..\..\src\libs\zbxsysinfo\common\system.c(79) : error C2065: 'request_tmp' : undeclared identifier
..\..\..\src\libs\zbxsysinfo\common\system.c(79) : error C2224: left of '.nparam' must have struct/union typ
e
..\..\..\src\libs\zbxsysinfo\common\system.c(79) : error C2198: 'zbx_malloc2' : too few arguments for call
..\..\..\src\libs\zbxsysinfo\common\system.c(80) : error C2065: 'request_tmp' : undeclared identifier
..\..\..\src\libs\zbxsysinfo\common\system.c(80) : error C2224: left of '.params' must have struct/union typ
e
..\..\..\src\libs\zbxsysinfo\common\system.c(80) : error C2065: 'counter_path' : undeclared identifier
..\..\..\src\libs\zbxsysinfo\common\system.c(82) : error C2065: 'ret' : undeclared identifier
..\..\..\src\libs\zbxsysinfo\common\system.c(82) : error C2065: 'request_tmp' : undeclared identifier
..\..\..\src\libs\zbxsysinfo\common\system.c(82) : warning C4133: 'function' : incompatible types - from 'in
t *' to 'AGENT_REQUEST *'
..\..\..\src\libs\zbxsysinfo\common\system.c(84) : error C2065: 'request_tmp' : undeclared identifier
..\..\..\src\libs\zbxsysinfo\common\system.c(84) : error C2224: left of '.params' must have struct/union typ
e
..\..\..\src\libs\zbxsysinfo\common\system.c(84) : error C2065: 'request_tmp' : undeclared identifier
..\..\..\src\libs\zbxsysinfo\common\system.c(84) : error C2224: left of '.params' must have struct/union typ
e
..\..\..\src\libs\zbxsysinfo\common\system.c(84) : error C2198: 'free' : too few arguments for call
..\..\..\src\libs\zbxsysinfo\common\system.c(84) : error C2065: 'request_tmp' : undeclared identifier
..\..\..\src\libs\zbxsysinfo\common\system.c(84) : error C2224: left of '.params' must have struct/union typ
e
..\..\..\src\libs\zbxsysinfo\common\system.c(86) : error C2065: 'ret' : undeclared identifier
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\Bin\cl.exe"' : return code '0x2
'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\Bin\nmake.EXE"' : return code '
0x2'
Stop.

sandis.neilands Sorry for that! RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-11105-2 r61994.

wiper CLOSED

Comment by Sandis Neilands (Inactive) [ 2016 Aug 26 ]

Correction for Windows compilation error released in:

  • pre-3.2.0beta2 r62005.
Generated at Thu Apr 25 09:33:19 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.