[vlc-commits] [Git][videolan/vlc][master] vlc_list: fix warnings
Jean-Baptiste Kempf
gitlab at videolan.org
Thu Jun 10 16:17:05 UTC 2021
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
4f8d49e0 by Alexandre Janniaux at 2021-06-10T14:54:48+00:00
vlc_list: fix warnings
Previous patches[1] 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.
[1]: c4f0f96452453c5744b93acea4c4f939161225c3
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})))
^
- - - - -
1 changed file:
- include/vlc_list.h
Changes:
=====================================
include/vlc_list.h
=====================================
@@ -234,7 +234,9 @@ static inline void vlc_list_it_next(struct vlc_list_it *restrict it)
((sizeof (*(p)) + sizeof (max_align_t) - 1) / sizeof (max_align_t))
#define vlc_list_entry_dummy(p) \
- (0 ? (p) : ((void *)(&(max_align_t[vlc_list_entry_aligned_size(p)]){0})))
+ (0 ? (p) : ((void *)( \
+ &(max_align_t[vlc_list_entry_aligned_size(p)]){ (max_align_t){0} } \
+ )))
#define vlc_list_offset_p(p, member) \
((p) = vlc_list_entry_dummy(p), (char *)(&(p)->member) - (char *)(p))
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/4f8d49e02eb85204269d0389d122aa2ac183150b
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/4f8d49e02eb85204269d0389d122aa2ac183150b
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list