From: Michał Kępień Date: Thu, 18 May 2023 13:12:23 +0000 (+0200) Subject: Fix cmocka-related compiler warnings in ht_test X-Git-Tag: v9.19.14~41^2~1 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=8d36e68c7ae69ceab1d62ce70e95ecc930d746c4;p=thirdparty%2Fbind9.git Fix cmocka-related compiler warnings in ht_test tests/isc/ht_test.c triggers the following compiler warnings when built against development versions of cmocka: In file included from ht_test.c:24: ht_test.c: In function ‘test_ht_full’: ht_test.c:68:45: warning: passing argument 2 of ‘_assert_ptr_equal’ makes pointer from integer without a cast [-Wint-conversion] 68 | assert_ptr_equal((void *)i, (uintptr_t)f); /usr/include/cmocka.h:1513:56: note: in definition of macro ‘assert_ptr_equal’ 1513 | #define assert_ptr_equal(a, b) _assert_ptr_equal((a), (b), __FILE__, __LINE__) | ^ /usr/include/cmocka.h:2907:36: note: expected ‘const void *’ but argument is of type ‘long unsigned int’ 2907 | const void *b, | ~~~~~~~~~~~~^ ht_test.c:163:45: warning: passing argument 2 of ‘_assert_ptr_equal’ makes pointer from integer without a cast [-Wint-conversion] 163 | assert_ptr_equal((void *)i, (uintptr_t)f); /usr/include/cmocka.h:1513:56: note: in definition of macro ‘assert_ptr_equal’ 1513 | #define assert_ptr_equal(a, b) _assert_ptr_equal((a), (b), __FILE__, __LINE__) | ^ /usr/include/cmocka.h:2907:36: note: expected ‘const void *’ but argument is of type ‘long unsigned int’ 2907 | const void *b, | ~~~~~~~~~~~~^ These are caused by a change to the definitions of pointer assert functions in cmocka's development branch [1]. Fix by casting the affected variables to (void *) instead of (uintptr_t). [1] https://git.cryptomilk.org/projects/cmocka.git/commit/?id=09621179af67535788a67957a910d9f17c975b45 --- diff --git a/tests/isc/ht_test.c b/tests/isc/ht_test.c index 699c1085ae7..0b90cbaa198 100644 --- a/tests/isc/ht_test.c +++ b/tests/isc/ht_test.c @@ -65,7 +65,7 @@ test_ht_full(uint8_t init_bits, uintptr_t count) { strlcat((char *)key, " key of a raw hashtable!!", sizeof(key)); result = isc_ht_find(ht, key, 16, &f); assert_int_equal(result, ISC_R_SUCCESS); - assert_ptr_equal((void *)i, (uintptr_t)f); + assert_ptr_equal((void *)i, (void *)f); } for (i = 1; i < count; i++) { @@ -160,7 +160,7 @@ test_ht_full(uint8_t init_bits, uintptr_t count) { strlcat((char *)key, " KEY of a raw hashtable!!", sizeof(key)); result = isc_ht_find(ht, key, 16, &f); assert_int_equal(result, ISC_R_SUCCESS); - assert_ptr_equal((void *)i, (uintptr_t)f); + assert_ptr_equal((void *)i, (void *)f); } for (i = 1; i < count; i++) {