On Sun, Nov 3, 2013 at 11:16 PM, Hendrik Leppkes <[email protected]> wrote:
> On Sun, Nov 3, 2013 at 11:09 PM, Vittorio Giovara
> <[email protected]> wrote:
>> This will convert the gcc warning -Wno-maybe-unintialized into
>> -Wno-sometimes-uninitialized for clang
>> ---
>
> This was originally disabled because GCC is rather bad at this and
> emits a lot of false positives. clang has a better history tracking
> uninitialized variables, is the sometimes-uninitialized also full of
> false-positives which would warrant turning it off, or does it make
> more sense to actually keep it on?
> Just blindly applying the same settings for different compilers is not
> always the best course. :)
>

I generally agree, but I was under the impression that other
developers didn't like introducing too many changes to silence a
compiler quirk and that the -Wsometimes-uninitialized message was
quite harmless. I'll post a few examples (actually all of them) of
what clang has found

CC libavcodec/aacsbr.o
libavcodec/aacsbr.c:389:16: warning: variable 'max_qmf_subbands' is
used uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
    } else if (sbr->sample_rate >= 48000)
               ^~~~~~~~~~~~~~~~~~~~~~~~~
libavcodec/aacsbr.c:392:33: note: uninitialized use occurs here
    if (sbr->k[2] - sbr->k[0] > max_qmf_subbands) {
                                ^~~~~~~~~~~~~~~~
libavcodec/aacsbr.c:389:12: note: remove the 'if' if its condition is
always true
    } else if (sbr->sample_rate >= 48000)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavcodec/aacsbr.c:324:40: note: initialize the variable
'max_qmf_subbands' to silence this warning
    unsigned int temp, max_qmf_subbands;
                                       ^
                                        = 0
1 warning generated.

CC libavcodec/h264_refs.o
libavcodec/h264_refs.c:541:17: warning: variable 'i' is used
uninitialized whenever '||' condition is true
[-Wsometimes-uninitialized]
               (mmco_index != h->mmco_index ||
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~
libavcodec/h264_refs.c:545:43: note: uninitialized use occurs here
               mmco_index, h->mmco_index, i);
                                          ^
libavcodec/h264_refs.c:541:17: note: remove the '||' if its condition
is always false
               (mmco_index != h->mmco_index ||
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libavcodec/h264_refs.c:520:26: note: initialize the variable 'i' to
silence this warning
    int mmco_index = 0, i;
                         ^
                          = 0
1 warning generated.

CC libavcodec/vc1dec.o
libavcodec/vc1dec.c:1857:28: warning: variable 'px' is used
uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
                } else if (c_valid) {
                           ^~~~~~~
libavcodec/vc1dec.c:1870:70: note: uninitialized use occurs here
    s->mv[dir][n][0] = s->current_picture.motion_val[dir][xy][0] =
((px + dmv_x + r_x) & ((r_x << 1) - 1)) - r_x;
                                                                     ^~
libavcodec/vc1dec.c:1857:24: note: remove the 'if' if its condition is
always true
                } else if (c_valid) {
                       ^~~~~~~~~~~~~
libavcodec/vc1dec.c:1669:11: note: initialize the variable 'px' to
silence this warning
    int px, py;
          ^
           = 0
libavcodec/vc1dec.c:1857:28: warning: variable 'py' is used
uninitialized whenever 'if' condition is false
[-Wsometimes-uninitialized]
                } else if (c_valid) {
                           ^~~~~~~
libavcodec/vc1dec.c:1871:70: note: uninitialized use occurs here
    s->mv[dir][n][1] = s->current_picture.motion_val[dir][xy][1] =
((py + dmv_y + r_y) & ((r_y << 1) - 1)) - r_y;
                                                                     ^~
libavcodec/vc1dec.c:1857:24: note: remove the 'if' if its condition is
always true
                } else if (c_valid) {
                       ^~~~~~~~~~~~~
libavcodec/vc1dec.c:1669:15: note: initialize the variable 'py' to
silence this warning
    int px, py;
              ^
               = 0
2 warnings generated.

CC avconv_opt.o
avconv_opt.c:1258:5: warning: variable 'ost' is used uninitialized
whenever switch default is taken [-Wsometimes-uninitialized]
    default:
    ^~~~~~~
avconv_opt.c:1264:5: note: uninitialized use occurs here
    ost->source_index = -1;
    ^~~
avconv_opt.c:1252:22: note: initialize the variable 'ost' to silence
this warning
    OutputStream *ost;
                     ^
                      = NULL
avconv_opt.c:1654:13: warning: variable 'm' is used uninitialized
whenever switch default is taken [-Wsometimes-uninitialized]
            default:
            ^~~~~~~
avconv_opt.c:1658:25: note: uninitialized use occurs here
            av_dict_set(m, o->metadata[i].u.str, *val ? val : NULL, 0);
                        ^
avconv_opt.c:1620:25: note: initialize the variable 'm' to silence this warning
        AVDictionary **m;
                        ^
                         = NULL
2 warnings generated.


So what would you prefer?
I'm fine either fixing the files or introuducing the -Wno variant,
let's just decide before that configure line is moved yet again.
Cheers,
Vittorio
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to