From 904c1b4d699aeb1ce170f0cd996a01d2d06812e3 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 10 Sep 2021 20:11:46 -0400 Subject: Add nullability annotations This allows clang to issue warnings at compile time when null is passed to a non-null parameter. For public entry points, also add assertions to catch such issues when the compiler does not support this. --- test/ring_test.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'test') diff --git a/test/ring_test.c b/test/ring_test.c index 49cf4f0..61a6d1f 100644 --- a/test/ring_test.c +++ b/test/ring_test.c @@ -18,6 +18,7 @@ #include "zix/ring.h" #include "zix/thread.h" +#include #include #include #include @@ -137,6 +138,7 @@ main(int argc, char** argv) size); ring = zix_ring_new(size); + assert(ring); if (zix_ring_read_space(ring) != 0) { return failure("New ring is not empty\n"); } @@ -163,6 +165,7 @@ main(int argc, char** argv) return failure("Read error\n"); } + assert(ring); zix_ring_reset(ring); if (zix_ring_read_space(ring) > 0) { return failure("Reset did not empty ring.\n"); -- cgit v1.2.1