Skip to content

vlc_list: fix warnings

Previous patches1 added a warning regression by fixing the initializer of the max_align_t[] array used in vlc_list_entry_dummy, because a max_align_t array cannot be initialized with integers, typically where the max_align_t is implemented as an union of multiple types.

By providing an initializer for max_align_t, we can workaround this limitation and initialize the array without those warnings:

../../lib/media.c:264:5: warning: suggest braces around initialization of subobject [-Wmissing-braces]
    vlc_list_foreach( node, &list, node )
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../include/vlc_list.h:263:23: note: expanded from macro 'vlc_list_foreach'
          && ((pos) = vlc_list_entry_p((vlc_list_it__##pos).current, \
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../include/vlc_list.h:243:44: note: expanded from macro 'vlc_list_entry_p'
    (0 ? (p) : (void *)(((char *)(node)) - vlc_list_offset_p(p, member)))
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../include/vlc_list.h:240:12: note: expanded from macro 'vlc_list_offset_p'
    ((p) = vlc_list_entry_dummy(p), (char *)(&(p)->member) - (char *)(p))
           ^~~~~~~~~~~~~~~~~~~~~~~
../../include/vlc_list.h:237:73: note: expanded from macro 'vlc_list_entry_dummy'
    (0 ? (p) : ((void *)(&(max_align_t[vlc_list_entry_aligned_size(p)]){0})))
                                                                        ^
Edited by Romain Vimont

Merge request reports