summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-09-21 22:30:38 +0200
committerwm4 <wm4@nowhere>2019-09-21 22:30:38 +0200
commit0b127312bead2b577b9e713130b667d34423ec94 (patch)
treee6fd6d3b3715a20db1f483efefdf3a6f3fc748e8
parent293dfc782552f35078215cd39a103c9646051fb2 (diff)
downloadmpv-0b127312bead2b577b9e713130b667d34423ec94.tar.bz2
mpv-0b127312bead2b577b9e713130b667d34423ec94.tar.xz
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.)
-rw-r--r--test/linked_list.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/test/linked_list.c b/test/linked_list.c
index 6ad61f36ec..a7b5b6b171 100644
--- a/test/linked_list.c
+++ b/test/linked_list.c
@@ -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);
}