[FFmpeg-devel] [PATCH] silence "may be used uninitialized" warnings

Aurelien Jacobs aurel
Fri Sep 21 01:25:59 CEST 2007

Michael Niedermayer wrote:

> Hi
> On Thu, Sep 20, 2007 at 11:00:02PM +0200, Aurelien Jacobs wrote:
> > Hi,
> > 
> > This patch does $subj for 2 warnings.
> > If this is acceptable, this could then be applied to all other such
> > warnings (after carefully verifying that those warnings are really
> > false positives).
> > So is it acceptable ?
> iam weakly against it, it makes the code harder to read, if you want to
> know about uninitalized vars use valgrind it will tell you which really are
> while gcc will miss most and most of what it reports will not be
> uninitalized

I agree we can't trust gcc to report uninitialized vars. But I think we
shouldn't disable entirely this warning, as it can sometimes help to
spot obvious errors during development.
Now, silencing wrong warnings helps to make real useful warnings more
visible, so I think it's worth doing it.
I also agree that it makes the code slightly harder to read but it also
add the information that someone checked that this variable is really
not used uninitialized. So this can save some time for people doing
further code review.
Maybe using a shorter macro name would keep the code a bit more readable
and thus this patch more acceptable ?
Something like uninit(var) ? or uv(var) ?


More information about the ffmpeg-devel mailing list