Skip to content
  • Frediano Ziglio's avatar
    tests: Avoid some possible not initialized warning from Clang · 4a0149bb
    Frediano Ziglio authored
    
    
    Not really possible but clang raise these warnings:
    
    test-sasl.c:555:13: error: variable 'is_ok' is uninitialized when used here [-Werror,-Wuninitialized]
            if (is_ok) {
                ^~~~~
    test-sasl.c:553:22: note: initialize the variable 'is_ok' to silence this warning
            uint8_t is_ok;
                         ^
                          = '\0'
    
    test-gst.c:792:18: error: variable 'height' is used uninitialized whenever '&&' condition is false [-Werror,-Wsometimes-uninitialized]
        spice_assert(gst_structure_get_int(s, "width", &width) &&
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../spice-common/common/log.h:91:17: note: expanded from macro 'spice_assert'
        if G_LIKELY(x) { } else {                           \
                    ^
    /usr/include/glib-2.0/glib/gmacros.h:376:60: note: expanded from macro 'G_LIKELY'
                                                               ^~~~
    /usr/include/glib-2.0/glib/gmacros.h:370:8: note: expanded from macro '_G_BOOLEAN_EXPR'
       if (expr)                                    \
           ^~~~
    test-gst.c:799:17: note: uninitialized use occurs here
        bitmap->y = height;
                    ^~~~~~
    test-gst.c:792:18: note: remove the '&&' if its condition is always true
        spice_assert(gst_structure_get_int(s, "width", &width) &&
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../../spice-common/common/log.h:91:17: note: expanded from macro 'spice_assert'
        if G_LIKELY(x) { } else {                           \
                    ^
    /usr/include/glib-2.0/glib/gmacros.h:376:60: note: expanded from macro 'G_LIKELY'
                                                               ^
    /usr/include/glib-2.0/glib/gmacros.h:370:8: note: expanded from macro '_G_BOOLEAN_EXPR'
       if (expr)                                    \
           ^
    test-gst.c:791:23: note: initialize the variable 'height' to silence this warning
        gint width, height;
                          ^
                           = 0
    
    Signed-off-by: default avatarFrediano Ziglio <fziglio@redhat.com>
    Acked-by: default avatarVictor Toso <victortoso@redhat.com>
    4a0149bb