mirror of https://github.com/mpv-player/mpv
test/linked_list: silence nonsense warnings
../misc/linked_list.h:71:34: warning: the address of ‘e6’ will always evaluate as ‘true’ [-Waddress] No shit, e6 is on the stack. But the macro argument is also allowed to be NULL. Add some dumb nonsense to shut up the useless warning. (It's probably useful in other contexts though, so don't disable it completely.)
This commit is contained in:
parent
293dfc7825
commit
0b127312be
|
@ -14,6 +14,12 @@ struct the_list {
|
|||
struct list_item *head, *tail;
|
||||
};
|
||||
|
||||
// This serves to remove some -Waddress "always true" warnings.
|
||||
static struct list_item *STUPID_SHIT(struct list_item *item)
|
||||
{
|
||||
return item;
|
||||
}
|
||||
|
||||
static bool do_check_list(struct the_list *lst, int *c, int num_c)
|
||||
{
|
||||
if (!lst->head)
|
||||
|
@ -100,13 +106,13 @@ static void test_linked_list(void **state)
|
|||
LL_INSERT_BEFORE(list_node, &lst, (struct list_item *)NULL, &e2);
|
||||
|
||||
check_list(6, 1, 2);
|
||||
LL_INSERT_BEFORE(list_node, &lst, &e6, &e3);
|
||||
LL_INSERT_BEFORE(list_node, &lst, STUPID_SHIT(&e6), &e3);
|
||||
|
||||
check_list(3, 6, 1, 2);
|
||||
LL_INSERT_BEFORE(list_node, &lst, &e6, &e5);
|
||||
LL_INSERT_BEFORE(list_node, &lst, STUPID_SHIT(&e6), &e5);
|
||||
|
||||
check_list(3, 5, 6, 1, 2);
|
||||
LL_INSERT_BEFORE(list_node, &lst, &e2, &e4);
|
||||
LL_INSERT_BEFORE(list_node, &lst, STUPID_SHIT(&e2), &e4);
|
||||
|
||||
check_list(3, 5, 6, 1, 4, 2);
|
||||
LL_REMOVE(list_node, &lst, &e6);
|
||||
|
@ -142,13 +148,13 @@ static void test_linked_list(void **state)
|
|||
LL_INSERT_AFTER(list_node, &lst, (struct list_item *)NULL, &e3);
|
||||
|
||||
check_list(3, 2, 1);
|
||||
LL_INSERT_AFTER(list_node, &lst, &e3, &e4);
|
||||
LL_INSERT_AFTER(list_node, &lst, STUPID_SHIT(&e3), &e4);
|
||||
|
||||
check_list(3, 4, 2, 1);
|
||||
LL_INSERT_AFTER(list_node, &lst, &e4, &e5);
|
||||
LL_INSERT_AFTER(list_node, &lst, STUPID_SHIT(&e4), &e5);
|
||||
|
||||
check_list(3, 4, 5, 2, 1);
|
||||
LL_INSERT_AFTER(list_node, &lst, &e1, &e6);
|
||||
LL_INSERT_AFTER(list_node, &lst, STUPID_SHIT(&e1), &e6);
|
||||
|
||||
check_list(3, 4, 5, 2, 1, 6);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue