diff options
| author | lhchavez <lhchavez@lhchavez.com> | 2021-02-23 19:33:34 -0800 |
|---|---|---|
| committer | lhchavez <lhchavez@lhchavez.com> | 2021-08-08 19:08:59 -0700 |
| commit | 231ca4fad36ce7b3dd5d79b599be46ab6001fc18 (patch) | |
| tree | 6616d81c71b873f122134f046073defcc4f659c2 /tests/core | |
| parent | 9eb17d460cd681bbc14d56ed8fdf440bc69b5456 (diff) | |
| download | libgit2-231ca4fad36ce7b3dd5d79b599be46ab6001fc18.tar.gz | |
Proof-of-concept for a more aggressive GIT_UNUSED()
This adds a `-Wunused-result`-proof `GIT_UNUSED()`, just to demonstrate
that it works. With this, sortedcache.h is now completely
`GIT_WARN_UNUSED_RESULT`-annotated!
Diffstat (limited to 'tests/core')
| -rw-r--r-- | tests/core/sha1.c | 2 | ||||
| -rw-r--r-- | tests/core/sortedcache.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/tests/core/sha1.c b/tests/core/sha1.c index f81d40854..196b00352 100644 --- a/tests/core/sha1.c +++ b/tests/core/sha1.c @@ -52,7 +52,7 @@ void test_core_sha1__detect_collision_attack(void) git_oid oid, expected; #ifdef GIT_SHA1_COLLISIONDETECT - GIT_UNUSED(expected); + GIT_UNUSED(&expected); cl_git_fail(sha1_file(&oid, FIXTURE_DIR "/shattered-1.pdf")); cl_assert_equal_s("SHA1 collision attack detected", git_error_last()->message); #else diff --git a/tests/core/sortedcache.c b/tests/core/sortedcache.c index 35e92ece9..d5bbcea19 100644 --- a/tests/core/sortedcache.c +++ b/tests/core/sortedcache.c @@ -54,7 +54,7 @@ void test_core_sortedcache__name_only(void) cl_assert_equal_i( GIT_ENOTFOUND, git_sortedcache_lookup_index(&pos, sc, "abc")); - git_sortedcache_clear(sc, true); + cl_git_pass(git_sortedcache_clear(sc, true)); cl_assert_equal_sz(0, git_sortedcache_entrycount(sc)); cl_assert(git_sortedcache_entry(sc, 0) == NULL); @@ -154,7 +154,7 @@ void test_core_sortedcache__in_memory(void) cl_assert_equal_i(0, free_count); - git_sortedcache_clear(sc, true); + cl_git_pass(git_sortedcache_clear(sc, true)); cl_assert_equal_i(5, free_count); @@ -247,7 +247,7 @@ static void sortedcache_test_reload(git_sortedcache *sc) cl_assert(git_sortedcache_lockandload(sc, &buf) > 0); - git_sortedcache_clear(sc, false); /* clear once we already have lock */ + cl_git_pass(git_sortedcache_clear(sc, false)); /* clear once we already have lock */ for (scan = buf.ptr; *scan; scan = after + 1) { int val = strtol(scan, &after, 0); |
