aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-01-09 21:09:56 -0500
committerDavid Robillard <d@drobilla.net>2024-01-09 21:09:56 -0500
commit117ae267046ed564684793270b82767c585c724b (patch)
tree59e2a5cb98ad4a86fd7f364597c33bbcbd0e48cd /test
parentdf88c11fcaa3e478873ab31ebe0e5e9b13a57208 (diff)
downloadserd-117ae267046ed564684793270b82767c585c724b.tar.gz
serd-117ae267046ed564684793270b82767c585c724b.tar.bz2
serd-117ae267046ed564684793270b82767c585c724b.zip
Avoid regressions in clang nullability checks
Clang 15 (and still as of 16) lost the ability to understand null checks in conditionals, which is supposed to suppress these warnings. For now, work around some, and suppress others. The suppression boilerplate here is noisy and ugly, and hopefully temporary. It should be removed once the issue is fixed in clang. See https://github.com/llvm/llvm-project/issues/63018
Diffstat (limited to 'test')
-rw-r--r--test/test_node.c8
-rw-r--r--test/test_uri.c4
2 files changed, 8 insertions, 4 deletions
diff --git a/test/test_node.c b/test/test_node.c
index 67958cc5..f08363cb 100644
--- a/test/test_node.c
+++ b/test/test_node.c
@@ -121,14 +121,16 @@ test_blob_to_node(void)
data[i] = (uint8_t)((size + i) % 256);
}
- SerdNode blob = serd_node_new_blob(data, size, size % 5);
+ SerdNode blob = serd_node_new_blob(data, size, size % 5);
+ const uint8_t* const blob_str = blob.buf;
+ assert(blob_str);
assert(blob.n_bytes == blob.n_chars);
- assert(blob.n_bytes == strlen((const char*)blob.buf));
+ assert(blob.n_bytes == strlen((const char*)blob_str));
size_t out_size = 0;
uint8_t* out =
- (uint8_t*)serd_base64_decode(blob.buf, blob.n_bytes, &out_size);
+ (uint8_t*)serd_base64_decode(blob_str, blob.n_bytes, &out_size);
assert(out_size == size);
for (size_t i = 0; i < size; ++i) {
diff --git a/test/test_uri.c b/test/test_uri.c
index ac24a2be..cc81b40e 100644
--- a/test/test_uri.c
+++ b/test/test_uri.c
@@ -48,7 +48,9 @@ test_file_uri(const char* const hostname,
SerdNode node = serd_node_new_file_uri(USTR(path), USTR(hostname), 0, escape);
uint8_t* out_hostname = NULL;
- uint8_t* out_path = serd_file_uri_parse(node.buf, &out_hostname);
+ uint8_t* out_path =
+ serd_file_uri_parse((const uint8_t*)node.buf, &out_hostname);
+
assert(!strcmp((const char*)node.buf, expected_uri));
assert((hostname && out_hostname) || (!hostname && !out_hostname));
assert(!hostname || !strcmp(hostname, (const char*)out_hostname));