[FFmpeg-devel] [PATCH] [RFC] fix 'may be used uninitialized' warnings

Aurelien Jacobs aurel
Mon Feb 2 22:16:45 CET 2009


Diego Biurrun wrote:

> Here is a patch to fix all but one 'may be used initialized' warning
> in FFmpeg.  Regression tests pass, so this cannot have broken things
> too badly, but some of it may nonetheless be suspicious.
> 
> Please review, I will commit individual hunks as they get approved,
> not before.
> 
> [...]
> 
> Index: libavcodec/vp56.c
> ===================================================================
> --- libavcodec/vp56.c	(revision 16938)
> +++ libavcodec/vp56.c	(working copy)
> @@ -500,7 +500,7 @@
>      VP56Context *s = avctx->priv_data;
>      AVFrame *const p = s->framep[VP56_FRAME_CURRENT];
>      int remaining_buf_size = buf_size;
> -    int is_alpha, alpha_offset;
> +    int is_alpha, alpha_offset = 0;
>  
>      if (s->has_alpha) {
>          alpha_offset = bytestream_get_be24(&buf);

Well know false positive.

I did propose a patch some times ago to avoid such warnings without
adding useless code, but it didn't exactly get a warm welcome.
It was about adding a macro looking like this (only for compilers
supporting it):

#define DECLARE_UNINITIALIZED(x)  x = x

int is_alpha, DECLARE_UNINITIALIZED(alpha_offset);

Aurel




More information about the ffmpeg-devel mailing list