Re: [Nagios-devel] [PATCH] Unused variables x and found_macro_x on

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

Re: [Nagios-devel] [PATCH] Unused variables x and found_macro_x on

Post by Guest »

On 06/25/2012 05:58 PM, Ricardo Maraschini wrote:
>
>
> ----- Original Message -----
>>
>>
>> ----- Original Message -----
>>> On 06/22/2012 08:57 PM, Ricardo Maraschini wrote:
>>>> hello,
>>>>
>>>> i've removed two unused variables on found_macro_x() function.
>>>> Compiler errors:
>>>>
>>>> ../common/macros.c: In function ‘process_macros_r’:
>>>> ../common/macros.c:133:6: warning: variable ‘found_macro_x’ set
>>>> but
>>>> not used [-Wunused-but-set-variable]
>>>> ../common/macros.c:128:6: warning: variable ‘x’ set but not used
>>>> [-Wunused-but-set-variable]
>>>>
>>>>
>>>> OK? Comments?
>>>>
>>>
>>> Test this with macro resolution debugging turned on. I just
>>> reverted a patch that did this change (and a bunch of other
>>> -Wunused-but-set-variable), and removing the unused ones
>>> actually broke macro resolution for the core.
>>
>> Just for curiosity, the patch you've reverted had the same logic as
>> mine regarding strcmp()?
>>
>
> Oh, now I see. I've made a diff between revisions 1853 and 1951 for common/macros.c and it clearly pointed me to a bug. That patch(applied to create revision 1951) is different of mine, regarding strcmp() use. Really, that patch is supposed to explode everything, you gonna see it if you look closely :-)
>
> BTW, I've tested the patch i've sent to you and i had no problems regarding macro resolutions so far.
>
> [1340638282.241842] [2048.1] [pid=20560] **** BEGIN MACRO PROCESSING ***********
> [1340638282.241848] [2048.1] [pid=20560] Processing: '$USER1$/check_ssh -t 60 -p 54978 $HOSTADDRESS$'
> [1340638282.241910] [2048.1] [pid=20560] Done. Final output: '/usr/local/opmon/libexec/check_ssh -t 60 -p 54978 192.168.8.1'
> [1340638282.251285] [2048.1] [pid=20560] **** BEGIN MACRO PROCESSING ***********
>
> [1340638282.269438] [2048.1] [pid=20560] Processing: '$USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -t 60 -u -c $ARG1$ -a $ARG2$'
> [1340638282.269463] [2048.1] [pid=20560] Done. Final output: '/usr/local/opmon/libexec/check_nrpe -H 127.0.0.1 -p 5666 -t 60 -u -c otrs_tickets_entrada_user -a 0 0 3'
> [1340638282.277821] [2048.1] [pid=20560] **** BEGIN MACRO PROCESSING ***********
>

Excellent. I didn't have time to track that down earlier, so thanks
for doing it properly :)

I'll apply this (and the other ones squelching -Wset-but-unused warnings)
right away.

--
Andreas Ericsson [email protected]
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked