[FFmpeg-cvslog] r23093 - trunk/libavfilter/vf_pad.c

Michael Niedermayer michaelni
Wed May 12 13:20:13 CEST 2010


On Wed, May 12, 2010 at 11:51:41AM +0200, Benjamin Larsson wrote:
> Michael Niedermayer skrev 2010-05-12 11:30:
>> On Wed, May 12, 2010 at 11:08:05AM +0200, Benoit Fouet wrote:
>>    
>>> Hi,
>>>
>>> On Tue, 11 May 2010 19:39:52 +0200 (CEST) bcoudurier wrote:
>>>      
>>>> Author: bcoudurier
>>>> Date: Tue May 11 19:39:52 2010
>>>> New Revision: 23093
>>>>
>>>> Log:
>>>> silence gcc warning about potential uninitialized usage
>>>>
>>>> Modified:
>>>>     trunk/libavfilter/vf_pad.c
>>>>
>>>> Modified: trunk/libavfilter/vf_pad.c
>>>> ==============================================================================
>>>> --- trunk/libavfilter/vf_pad.c	Tue May 11 19:25:18 2010	(r23092)
>>>> +++ trunk/libavfilter/vf_pad.c	Tue May 11 19:39:52 2010	(r23093)
>>>> @@ -100,7 +100,7 @@ static int config_input(AVFilterLink *in
>>>>       PadContext *pad = ctx->priv;
>>>>       const AVPixFmtDescriptor *pix_desc 
>>>> =&av_pix_fmt_descriptors[inlink->format];
>>>>       uint8_t rgba_color[4];
>>>> -    uint8_t rgba_map[4];
>>>> +    uint8_t rgba_map[4] = {0};
>>>>       int i, is_packed_rgb = 1;
>>>>
>>>>       switch (inlink->format) {
>>>>        
>>> Unless I'm mistaken, this warning was wrong.
>>> Is there a policy on what we do in such cases ?
>>>      
>> policy is that speed critical code should not be slowed down by fixing
>> a warning. This doesnt apply here so theres no policy for this specific
>> case
>> anyway, IMHO ideally false warnings should be fixed by adding attribute() 
>> or
>> disabling the warning.
>>
>> [...]
>>    
>
> I prefer setting the variable to 0 instead of adding av_unused() or y=y or 
> something else incomprehensible.

The thing that annoys me mildly here is that
=0 means, "i need that initialized to 0" like a NULL check means "i
need that checked here"

while really what we need here is a, "we dont need to initialize this its
always written before read"
just assume that a change to the code would introduce a bug that really
read it before writing, with a =0 this cannot be found, with a attribute
that spefcifies that the warning was wrong it can be found if gcc or another
compiler gets better and we globally disable these attributes.

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20100512/e249cd18/attachment.pgp>



More information about the ffmpeg-cvslog mailing list