[sr-dev] compiler warnings

Daniel-Constantin Mierla miconda at gmail.com
Wed Apr 4 12:49:23 CEST 2012


Hello,

On 4/4/12 12:03 PM, Marius Zbihlei wrote:
> On 04/04/2012 12:16 PM, Daniel-Constantin Mierla wrote:
>> Hello,
>>
>> I fixed the ones not in msg_translator.c, they were valid.
>>
>> For msg_translator.c, I am not yet sure why they are thrown, recv_* vars
>> are set for condition 'if (msg->rcv.bind_address)' and used only within
>> that condition. What is your gcc version? I have 4.2 here and no warning
>> there.
>
> Hello Daniel,
>
> I get the same warnings on actions.c and msg_translator.c.
>
> mzbihlei at lxbu-czc111663q:~$ gcc --version
> gcc (Ubuntu/Linaro 4.5.2-8ubuntu4) 4.5.2
> Copyright (C) 2010 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.
>
>
> msg_translator.c: In function ‘lumps_len’:
> msg_translator.c:582:7: warning: ‘recv_address_str’ may be used 
> uninitialized in this function
> msg_translator.c:583:7: warning: ‘recv_port_str’ may be used 
> uninitialized in this function
> msg_translator.c:584:7: warning: ‘recv_port_no’ may be used 
> uninitialized in this function
> msg_translator.c: In function ‘process_lumps’:
> msg_translator.c:921:7: warning: ‘recv_address_str’ may be used 
> uninitialized in this function
> msg_translator.c:922:7: warning: ‘recv_port_str’ may be used 
> uninitialized in this function
> msg_translator.c:923:7: warning: ‘recv_port_no’ may be used 
> uninitialized in this function
>
>
> I have pushed a fix for the actions.c (the problem is that on line 
> 1617 ) . I will have a look at msg_translator as well .
thanks, I completely missed the warning message for action.c.

Perhaps the gcc version is able to decided that the condition for 
setting ms can be changed, which indeed can be done via RPC, but for 
msg_translator.c cannot happen -- or maybe gcc thinks of eventual 
multi-threading approach to access the msg structure and change it 
(which is not the case ) ... that's why I wanted to be able to get more 
clarifications.

Anyhow, if you look over it and initialize vars, go ahead an commit.

Cheers,
Daniel


>
>
> Marius
>>
>> I can init them always, but it is better to understand first why the
>> warning is given, not to fall in a trap with a default value.
>>
>> Cheers,
>> Daniel
>>
>> On 4/3/12 4:07 PM, Juha Heinanen wrote:
>>> recently there has been commits that cause compiler warnings shown
>>> below.
>>>
>>> please fix or revert the commits.
>>>
>>> -- juha
>>>
>>> action.c: In function ‘run_actions’:
>>> action.c:1583: warning: ‘ms’ may be used uninitialized in this function
>>> CC (cc) [sip-proxy]        msg_translator.o
>>> msg_translator.c: In function ‘lumps_len’:
>>> msg_translator.c:582: warning: ‘recv_address_str’ may be used 
>>> uninitialized in this function
>>> msg_translator.c:583: warning: ‘recv_port_str’ may be used 
>>> uninitialized in this function
>>> msg_translator.c:584: warning: ‘recv_port_no’ may be used 
>>> uninitialized in this function
>>> msg_translator.c: In function ‘process_lumps’:
>>> msg_translator.c:921: warning: ‘recv_address_str’ may be used 
>>> uninitialized in this function
>>> msg_translator.c:922: warning: ‘recv_port_str’ may be used 
>>> uninitialized in this function
>>> msg_translator.c:923: warning: ‘recv_port_no’ may be used 
>>> uninitialized in this function
>>> CC (cc) [L libsrdb1.so.1.0]        db_query.o
>>> db_query.c: In function ‘db_do_submit_query’:
>>> db_query.c:50: warning: ‘ms’ may be used uninitialized in this function
>>> CC (cc) [M textops.so]        textops.o
>>> textops.c: In function ‘subst_hf_f’:
>>> textops.c:2242: warning: ‘hfl’ may be used uninitialized in this 
>>> function
>>> textops.c: In function ‘search_hf_f’:
>>> textops.c:2161: warning: ‘hfl’ may be used uninitialized in this 
>>> function
>>>
>>> _______________________________________________
>>> sr-dev mailing list
>>> sr-dev at lists.sip-router.org
>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>
>

-- 
Daniel-Constantin Mierla
Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany
http://www.asipto.com/index.php/kamailio-advanced-training/




More information about the sr-dev mailing list