2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

Merge branch 'ondrej/add-maybe_unused-attribute-macro' into 'main'

Replace __attribute__((unused)) with ISC_ATTR_UNUSED attribute macro

See merge request isc-projects/bind9!7345
This commit is contained in:
Ondřej Surý
2023-03-30 22:16:49 +00:00
39 changed files with 183 additions and 185 deletions

View File

@@ -888,7 +888,7 @@ static void
start_next_command(void); start_next_command(void);
static void static void
process_next_command(void *arg __attribute__((__unused__))) { process_next_command(void *arg ISC_ATTR_UNUSED) {
isc_loop_t *loop = isc_loop_main(loopmgr); isc_loop_t *loop = isc_loop_main(loopmgr);
if (cmdline == NULL) { if (cmdline == NULL) {
in_use = false; in_use = false;

View File

@@ -39,7 +39,7 @@ static isc_nm_t *netmgr = NULL;
static protocol_t protocol; static protocol_t protocol;
static in_port_t port; static in_port_t port;
static isc_netaddr_t netaddr; static isc_netaddr_t netaddr;
static isc_sockaddr_t sockaddr __attribute__((unused)); static isc_sockaddr_t sockaddr ISC_ATTR_UNUSED;
static int workers; static int workers;
static isc_tlsctx_t *tls_ctx = NULL; static isc_tlsctx_t *tls_ctx = NULL;

View File

@@ -85,11 +85,13 @@ typedef uint32_t dns_ttl_t;
var = _u.v; \ var = _u.v; \
} while (0) } while (0)
#if !defined(__has_attribute) #if !defined(__has_c_attribute)
#define __has_attribute(x) 0 #define __has_c_attribute(x) 0
#endif /* if !defined(__has_attribute) */ #endif /* if !defined(__has_c_attribute) */
#if __GNUC__ >= 7 || __has_attribute(fallthrough) #if __has_c_attribute(fallthrough)
#define FALLTHROUGH [[fallthrough]]
#elif __GNUC__ >= 7 && !defined(__clang__)
#define FALLTHROUGH __attribute__((fallthrough)) #define FALLTHROUGH __attribute__((fallthrough))
#else #else
/* clang-format off */ /* clang-format off */

View File

@@ -177,8 +177,7 @@ cleanup(void) {
} }
int int
LLVMFuzzerInitialize(int *argc __attribute__((unused)), LLVMFuzzerInitialize(int *argc ISC_ATTR_UNUSED, char ***argv ISC_ATTR_UNUSED) {
char ***argv __attribute__((unused))) {
isc_result_t result; isc_result_t result;
dns_fixedname_t fixed; dns_fixedname_t fixed;
dns_name_t *name = dns_fixedname_initname(&fixed); dns_name_t *name = dns_fixedname_initname(&fixed);

View File

@@ -35,8 +35,7 @@ static size_t output_len = 1024;
static uint8_t render_buf[64 * 1024 - 1]; static uint8_t render_buf[64 * 1024 - 1];
int int
LLVMFuzzerInitialize(int *argc __attribute__((unused)), LLVMFuzzerInitialize(int *argc ISC_ATTR_UNUSED, char ***argv ISC_ATTR_UNUSED) {
char ***argv __attribute__((unused))) {
isc_mem_create(&mctx); isc_mem_create(&mctx);
output = isc_mem_get(mctx, output_len); output = isc_mem_get(mctx, output_len);

View File

@@ -25,8 +25,7 @@
bool debug = false; bool debug = false;
int int
LLVMFuzzerInitialize(int *argc __attribute__((unused)), LLVMFuzzerInitialize(int *argc ISC_ATTR_UNUSED, char ***argv ISC_ATTR_UNUSED) {
char ***argv __attribute__((unused))) {
return (0); return (0);
} }

View File

@@ -29,8 +29,7 @@
bool debug = false; bool debug = false;
int int
LLVMFuzzerInitialize(int *argc __attribute__((unused)), LLVMFuzzerInitialize(int *argc ISC_ATTR_UNUSED, char ***argv ISC_ATTR_UNUSED) {
char ***argv __attribute__((unused))) {
return (0); return (0);
} }

View File

@@ -42,8 +42,7 @@ static isc_mem_t *mctx = NULL;
static isc_lex_t *lex = NULL; static isc_lex_t *lex = NULL;
int int
LLVMFuzzerInitialize(int *argc __attribute__((unused)), LLVMFuzzerInitialize(int *argc ISC_ATTR_UNUSED, char ***argv ISC_ATTR_UNUSED) {
char ***argv __attribute__((unused))) {
isc_lexspecials_t specials; isc_lexspecials_t specials;
isc_mem_create(&mctx); isc_mem_create(&mctx);

View File

@@ -31,8 +31,7 @@ ISC_LANG_BEGINDECLS
extern bool debug; extern bool debug;
int int
LLVMFuzzerInitialize(int *argc __attribute__((unused)), LLVMFuzzerInitialize(int *argc ISC_ATTR_UNUSED, char ***argv ISC_ATTR_UNUSED);
char ***argv __attribute__((unused)));
int int
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);

View File

@@ -25,8 +25,7 @@
bool debug = false; bool debug = false;
int int
LLVMFuzzerInitialize(int *argc __attribute__((unused)), LLVMFuzzerInitialize(int *argc ISC_ATTR_UNUSED, char ***argv ISC_ATTR_UNUSED);
char ***argv __attribute__((unused)));
int int
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
@@ -35,8 +34,7 @@ static isc_mem_t *mctx = NULL;
static isc_lex_t *lex = NULL; static isc_lex_t *lex = NULL;
int int
LLVMFuzzerInitialize(int *argc __attribute__((unused)), LLVMFuzzerInitialize(int *argc ISC_ATTR_UNUSED, char ***argv ISC_ATTR_UNUSED) {
char ***argv __attribute__((unused))) {
isc_mem_create(&mctx); isc_mem_create(&mctx);
isc_lex_create(mctx, 1024, &lex); isc_lex_create(mctx, 1024, &lex);

View File

@@ -27,8 +27,7 @@ static isc_mem_t *mctx = NULL;
static isc_lex_t *lex = NULL; static isc_lex_t *lex = NULL;
int int
LLVMFuzzerInitialize(int *argc __attribute__((unused)), LLVMFuzzerInitialize(int *argc ISC_ATTR_UNUSED, char ***argv ISC_ATTR_UNUSED) {
char ***argv __attribute__((unused))) {
isc_mem_create(&mctx); isc_mem_create(&mctx);
isc_lex_create(mctx, 1024, &lex); isc_lex_create(mctx, 1024, &lex);

View File

@@ -215,7 +215,7 @@ typedef struct {
} librpz_emsg_t; } librpz_emsg_t;
#ifdef LIBRPZ_HAVE_ATTR #ifdef LIBRPZ_HAVE_ATTR
#define LIBRPZ_UNUSED __attribute__((unused)) #define LIBRPZ_UNUSED ISC_ATTR_UNUSED
#define LIBRPZ_PF(f, l) __attribute__((format(printf, f, l))) #define LIBRPZ_PF(f, l) __attribute__((format(printf, f, l)))
#define LIBRPZ_NORET __attribute__((__noreturn__)) #define LIBRPZ_NORET __attribute__((__noreturn__))
#else /* ifdef LIBRPZ_HAVE_ATTR */ #else /* ifdef LIBRPZ_HAVE_ATTR */

View File

@@ -19,10 +19,9 @@
#define DNS__DB_FILELINE , __func__, __FILE__, __LINE__ #define DNS__DB_FILELINE , __func__, __FILE__, __LINE__
#define DNS__DB_FLARG_PASS , func, file, line #define DNS__DB_FLARG_PASS , func, file, line
#define DNS__DB_FLARG \ #define DNS__DB_FLARG \
, const char *func __attribute__((__unused__)), \ , const char *func ISC_ATTR_UNUSED, const char *file ISC_ATTR_UNUSED, \
const char *file __attribute__((__unused__)), \ unsigned int line ISC_ATTR_UNUSED
unsigned int line __attribute__((__unused__))
#else /* DNS_DB_NODETRACE */ #else /* DNS_DB_NODETRACE */

View File

@@ -145,7 +145,7 @@ hashmap_node_init(hashmap_node_t *node, const uint32_t hashval,
}; };
} }
static void __attribute__((__unused__)) ISC_ATTR_UNUSED static void
hashmap_dump_table(const isc_hashmap_t *hashmap, const uint8_t idx) { hashmap_dump_table(const isc_hashmap_t *hashmap, const uint8_t idx) {
fprintf(stderr, fprintf(stderr,
"====== %" PRIu8 " (bits = %" PRIu8 ", size = %zu =====\n", idx, "====== %" PRIu8 " (bits = %" PRIu8 ", size = %zu =====\n", idx,

View File

@@ -13,6 +13,14 @@
#pragma once #pragma once
/***
*** Clang Compatibility Macros
***/
#if !defined(__has_c_attribute)
#define __has_c_attribute(x) 0
#endif /* if !defined(__has_c_attribute) */
#ifdef HAVE_STDNORETURN_H #ifdef HAVE_STDNORETURN_H
#include <stdnoreturn.h> #include <stdnoreturn.h>
#elif HAVE_FUNC_ATTRIBUTE_NORETURN #elif HAVE_FUNC_ATTRIBUTE_NORETURN
@@ -80,3 +88,19 @@
#define ISC_ATTR_MALLOC_DEALLOCATOR(deallocator) #define ISC_ATTR_MALLOC_DEALLOCATOR(deallocator)
#define ISC_ATTR_MALLOC_DEALLOCATOR_IDX(deallocator, idx) #define ISC_ATTR_MALLOC_DEALLOCATOR_IDX(deallocator, idx)
#endif /* HAVE_FUNC_ATTRIBUTE_MALLOC */ #endif /* HAVE_FUNC_ATTRIBUTE_MALLOC */
#if __has_c_attribute(fallthrough)
#define FALLTHROUGH [[fallthrough]]
#elif __GNUC__ >= 7 && !defined(__clang__)
#define FALLTHROUGH __attribute__((fallthrough))
#else
/* clang-format off */
#define FALLTHROUGH do {} while (0) /* FALLTHROUGH */
/* clang-format on */
#endif
#if __has_c_attribute(maybe_unused)
#define ISC_ATTR_UNUSED [[maybe_unused]]
#else
#define ISC_ATTR_UNUSED __attribute__((__unused__))
#endif

View File

@@ -153,10 +153,9 @@ isc_nmsocket_set_max_streams(isc_nmsocket_t *listener,
#define isc_nmhandle_detach(handlep) \ #define isc_nmhandle_detach(handlep) \
isc__nmhandle_detach(handlep, __FILE__, __LINE__, __func__) isc__nmhandle_detach(handlep, __FILE__, __LINE__, __func__)
#define FLARG_PASS , file, line, func #define FLARG_PASS , file, line, func
#define FLARG \ #define FLARG \
, const char *file __attribute__((unused)), \ , const char *file ISC_ATTR_UNUSED, unsigned int line ISC_ATTR_UNUSED, \
unsigned int line __attribute__((unused)), \ const char *func ISC_ATTR_UNUSED
const char *func __attribute__((unused))
#else #else
#define isc_nmhandle_attach(handle, dest) isc__nmhandle_attach(handle, dest) #define isc_nmhandle_attach(handle, dest) isc__nmhandle_attach(handle, dest)
#define isc_nmhandle_detach(handlep) isc__nmhandle_detach(handlep) #define isc_nmhandle_detach(handlep) isc__nmhandle_detach(handlep)

View File

@@ -27,18 +27,12 @@
* ISC_ or isc_ to the name. * ISC_ or isc_ to the name.
*/ */
#include <isc/attributes.h>
/*** /***
*** Clang Compatibility Macros *** Clang Compatibility Macros
***/ ***/
#if !defined(__has_attribute)
#define __has_attribute(x) 0
#endif /* if !defined(__has_attribute) */
#if !defined(__has_c_attribute)
#define __has_c_attribute(x) 0
#endif /* if !defined(__has_c_attribute) */
#if !defined(__has_feature) #if !defined(__has_feature)
#define __has_feature(x) 0 #define __has_feature(x) 0
#endif /* if !defined(__has_feature) */ #endif /* if !defined(__has_feature) */
@@ -48,12 +42,14 @@
***/ ***/
/*% /*%
* Use this to hide unused function arguments. * Legacy way how to hide unused function arguments, don't use in
* the new code, rather use the ISC_ATTR_UNUSED macro that expands
* to either C23's [[maybe_unused]] or __attribute__((__unused__)).
*
* \code * \code
* int * int
* foo(char *bar) * foo(ISC_ATTR_UNUSED char *bar) {
* { * ...;
* UNUSED(bar);
* } * }
* \endcode * \endcode
*/ */
@@ -65,16 +61,6 @@
#define ISC_NONSTRING #define ISC_NONSTRING
#endif /* __GNUC__ */ #endif /* __GNUC__ */
#if __has_c_attribute(fallthrough)
#define FALLTHROUGH [[fallthrough]]
#elif __GNUC__ >= 7 && !defined(__clang__)
#define FALLTHROUGH __attribute__((fallthrough))
#else
/* clang-format off */
#define FALLTHROUGH do {} while (0) /* FALLTHROUGH */
/* clang-format on */
#endif
#if HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR && HAVE_FUNC_ATTRIBUTE_DESTRUCTOR #if HAVE_FUNC_ATTRIBUTE_CONSTRUCTOR && HAVE_FUNC_ATTRIBUTE_DESTRUCTOR
#define ISC_CONSTRUCTOR __attribute__((constructor)) #define ISC_CONSTRUCTOR __attribute__((constructor))
#define ISC_DESTRUCTOR __attribute__((destructor)) #define ISC_DESTRUCTOR __attribute__((destructor))

View File

@@ -129,10 +129,9 @@ STATIC_ASSERT(ISC_NETMGR_TCP_RECVBUF_SIZE <= ISC_NETMGR_RECVBUF_SIZE,
fprintf(stderr, "%" PRIu32 ":%d:%s:%u:%s:" format, gettid(), \ fprintf(stderr, "%" PRIu32 ":%d:%s:%u:%s:" format, gettid(), \
isc_tid(), file, line, func, __VA_ARGS__) isc_tid(), file, line, func, __VA_ARGS__)
#define FLARG \ #define FLARG \
, const char *file __attribute__((unused)), \ , const char *file ISC_ATTR_UNUSED, unsigned int line ISC_ATTR_UNUSED, \
unsigned int line __attribute__((unused)), \ const char *func ISC_ATTR_UNUSED
const char *func __attribute__((unused))
#define FLARG_PASS , file, line, func #define FLARG_PASS , file, line, func
#define FLARG_IEVENT(ievent) \ #define FLARG_IEVENT(ievent) \
const char *file = ievent->file; \ const char *file = ievent->file; \

View File

@@ -374,13 +374,11 @@ isc_nm_getloadbalancesockets(isc_nm_t *mgr) {
} }
void void
isc_nm_setloadbalancesockets(isc_nm_t *mgr, bool enabled) { isc_nm_setloadbalancesockets(isc_nm_t *mgr, ISC_ATTR_UNUSED bool enabled) {
REQUIRE(VALID_NM(mgr)); REQUIRE(VALID_NM(mgr));
#if HAVE_SO_REUSEPORT_LB #if HAVE_SO_REUSEPORT_LB
mgr->load_balance_sockets = enabled; mgr->load_balance_sockets = enabled;
#else
UNUSED(enabled);
#endif #endif
} }

View File

@@ -44,7 +44,7 @@
#define TAPTEXT TESTS_DIR "/testdata/dnstap/dnstap.text" #define TAPTEXT TESTS_DIR "/testdata/dnstap/dnstap.text"
static int static int
cleanup(void **state __attribute__((__unused__))) { cleanup(void **state ISC_ATTR_UNUSED) {
(void)isc_file_remove(TAPFILE); (void)isc_file_remove(TAPFILE);
(void)isc_file_remove(TAPSOCK); (void)isc_file_remove(TAPSOCK);

View File

@@ -191,7 +191,7 @@ ISC_LOOP_TEST_IMPL(asyncload_zone) {
dns_zone_t *zone1 = NULL, *zone2 = NULL, *zone3 = NULL; dns_zone_t *zone1 = NULL, *zone2 = NULL, *zone3 = NULL;
static isc_result_t static isc_result_t
all_done(void *arg __attribute__((__unused__))) { all_done(void *arg ISC_ATTR_UNUSED) {
isc_result_t result; isc_result_t result;
/* Both zones should now be loaded; test them */ /* Both zones should now be loaded; test them */

View File

@@ -76,17 +76,17 @@ teardown_managers(void **state);
/* clang-format on */ /* clang-format on */
#define ISC_SETUP_TEST_DECLARE(name) \ #define ISC_SETUP_TEST_DECLARE(name) \
int setup_test_##name(void **state __attribute__((unused))); int setup_test_##name(void **state ISC_ATTR_UNUSED);
#define ISC_RUN_TEST_DECLARE(name) \ #define ISC_RUN_TEST_DECLARE(name) \
void run_test_##name(void **state __attribute__((unused))); void run_test_##name(void **state ISC_ATTR_UNUSED);
#define ISC_TEARDOWN_TEST_DECLARE(name) \ #define ISC_TEARDOWN_TEST_DECLARE(name) \
int teardown_test_##name(void **state __attribute__((unused))) int teardown_test_##name(void **state ISC_ATTR_UNUSED)
#define ISC_LOOP_TEST_CUSTOM_DECLARE(name, setup, teardown) \ #define ISC_LOOP_TEST_CUSTOM_DECLARE(name, setup, teardown) \
void run_test_##name(void **state __attribute__((__unused__))); \ void run_test_##name(void **state ISC_ATTR_UNUSED); \
void loop_test_##name(void *arg __attribute__((__unused__))); void loop_test_##name(void *arg ISC_ATTR_UNUSED);
#define ISC_LOOP_TEST_DECLARE(name) \ #define ISC_LOOP_TEST_DECLARE(name) \
ISC_LOOP_TEST_CUSTOM_DECLARE(name, NULL, NULL) ISC_LOOP_TEST_CUSTOM_DECLARE(name, NULL, NULL)
@@ -102,41 +102,41 @@ teardown_managers(void **state);
ISC_LOOP_TEST_CUSTOM_DECLARE(name, NULL, teardown_loop_##name) ISC_LOOP_TEST_CUSTOM_DECLARE(name, NULL, teardown_loop_##name)
#define ISC_LOOP_SETUP_DECLARE(name) \ #define ISC_LOOP_SETUP_DECLARE(name) \
void setup_loop_##name(void *arg __attribute__((__unused__))); void setup_loop_##name(void *arg ISC_ATTR_UNUSED);
#define ISC_SETUP_TEST_IMPL(name) \ #define ISC_SETUP_TEST_IMPL(name) \
int setup_test_##name(void **state __attribute__((unused))); \ int setup_test_##name(void **state ISC_ATTR_UNUSED); \
int setup_test_##name(void **state __attribute__((unused))) int setup_test_##name(void **state ISC_ATTR_UNUSED)
#define ISC_RUN_TEST_IMPL(name) \ #define ISC_RUN_TEST_IMPL(name) \
void run_test_##name(void **state __attribute__((unused))); \ void run_test_##name(void **state ISC_ATTR_UNUSED); \
void run_test_##name(void **state __attribute__((unused))) void run_test_##name(void **state ISC_ATTR_UNUSED)
#define ISC_TEARDOWN_TEST_IMPL(name) \ #define ISC_TEARDOWN_TEST_IMPL(name) \
int teardown_test_##name(void **state __attribute__((unused))); \ int teardown_test_##name(void **state ISC_ATTR_UNUSED); \
int teardown_test_##name(void **state __attribute__((unused))) int teardown_test_##name(void **state ISC_ATTR_UNUSED)
#define ISC_TEST_LIST_START const struct CMUnitTest tests[] = { #define ISC_TEST_LIST_START const struct CMUnitTest tests[] = {
#define ISC_TEST_LIST_END \ #define ISC_TEST_LIST_END \
} \ } \
; ;
#define ISC_LOOP_TEST_CUSTOM_IMPL(name, setup, teardown) \ #define ISC_LOOP_TEST_CUSTOM_IMPL(name, setup, teardown) \
void run_test_##name(void **state __attribute__((__unused__))); \ void run_test_##name(void **state ISC_ATTR_UNUSED); \
void loop_test_##name(void *arg __attribute__((__unused__))); \ void loop_test_##name(void *arg ISC_ATTR_UNUSED); \
void run_test_##name(void **state __attribute__((__unused__))) { \ void run_test_##name(void **state ISC_ATTR_UNUSED) { \
isc_job_cb setup_loop = setup; \ isc_job_cb setup_loop = setup; \
isc_job_cb teardown_loop = teardown; \ isc_job_cb teardown_loop = teardown; \
if (setup_loop != NULL) { \ if (setup_loop != NULL) { \
setup_loop(state); \ setup_loop(state); \
} \ } \
isc_loop_setup(mainloop, loop_test_##name, state); \ isc_loop_setup(mainloop, loop_test_##name, state); \
isc_loopmgr_run(loopmgr); \ isc_loopmgr_run(loopmgr); \
if (teardown_loop != NULL) { \ if (teardown_loop != NULL) { \
teardown_loop(state); \ teardown_loop(state); \
} \ } \
} \ } \
void loop_test_##name(void *arg __attribute__((__unused__))) void loop_test_##name(void *arg ISC_ATTR_UNUSED)
#define ISC_LOOP_TEST_IMPL(name) ISC_LOOP_TEST_CUSTOM_IMPL(name, NULL, NULL) #define ISC_LOOP_TEST_IMPL(name) ISC_LOOP_TEST_CUSTOM_IMPL(name, NULL, NULL)
@@ -149,13 +149,13 @@ teardown_managers(void **state);
#define ISC_LOOP_TEST_TEARDOWN_IMPL(name) \ #define ISC_LOOP_TEST_TEARDOWN_IMPL(name) \
ISC_LOOP_TEST_CUSTOM_IMPL(name, NULL, teardown_loop_##name) ISC_LOOP_TEST_CUSTOM_IMPL(name, NULL, teardown_loop_##name)
#define ISC_LOOP_SETUP_IMPL(name) \ #define ISC_LOOP_SETUP_IMPL(name) \
void setup_loop_##name(void *arg __attribute__((__unused__))); \ void setup_loop_##name(void *arg ISC_ATTR_UNUSED); \
void setup_loop_##name(void *arg __attribute__((__unused__))) void setup_loop_##name(void *arg ISC_ATTR_UNUSED)
#define ISC_LOOP_TEARDOWN_IMPL(name) \ #define ISC_LOOP_TEARDOWN_IMPL(name) \
void teardown_loop_##name(void *arg __attribute__((__unused__))); \ void teardown_loop_##name(void *arg ISC_ATTR_UNUSED); \
void teardown_loop_##name(void *arg __attribute__((__unused__))) void teardown_loop_##name(void *arg ISC_ATTR_UNUSED)
#define ISC_TEST_DECLARE(name) void run_test_##name(void **state); #define ISC_TEST_DECLARE(name) void run_test_##name(void **state);

View File

@@ -54,10 +54,9 @@ extern atomic_uint_fast32_t client_refs[32];
extern atomic_uintptr_t client_addrs[32]; extern atomic_uintptr_t client_addrs[32];
#if ISC_NETMGR_TRACE #if ISC_NETMGR_TRACE
#define FLARG \ #define FLARG \
, const char *file __attribute__((unused)), \ , const char *file ISC_ATTR_UNUSED, unsigned int line ISC_ATTR_UNUSED, \
unsigned int line __attribute__((unused)), \ const char *func ISC_ATTR_UNUSED
const char *func __attribute__((unused))
#else #else
#define FLARG #define FLARG
#endif #endif
@@ -67,7 +66,7 @@ setup_server(void **state);
int int
teardown_server(void **state); teardown_server(void **state);
void void
shutdown_interfacemgr(void *arg __attribute__((unused))); shutdown_interfacemgr(void *arg ISC_ATTR_UNUSED);
/*% /*%
* Load data for zone "zonename" from file "filename" and start serving it to * Load data for zone "zonename" from file "filename" and start serving it to

View File

@@ -35,6 +35,7 @@
#include <isc/refcount.h> #include <isc/refcount.h>
#include <isc/sockaddr.h> #include <isc/sockaddr.h>
#include <isc/thread.h> #include <isc/thread.h>
#include <isc/util.h>
#include <isc/uv.h> #include <isc/uv.h>
#include "uv_wrap.h" #include "uv_wrap.h"
@@ -335,7 +336,7 @@ setup_test(void **state) {
} }
static int static int
teardown_test(void **state __attribute__((__unused__))) { teardown_test(void **state ISC_ATTR_UNUSED) {
for (size_t i = 0; i < MAX_NM; i++) { for (size_t i = 0; i < MAX_NM; i++) {
isc_netmgr_destroy(&nm[i]); isc_netmgr_destroy(&nm[i]);
assert_null(nm[i]); assert_null(nm[i]);
@@ -483,7 +484,7 @@ listen_sock_close(void *arg) {
} }
static void static void
doh_noop(void *arg __attribute__((__unused__))) { doh_noop(void *arg ISC_ATTR_UNUSED) {
isc_nm_t *listen_nm = nm[0]; isc_nm_t *listen_nm = nm[0];
isc_nm_t *connect_nm = nm[1]; isc_nm_t *connect_nm = nm[1];
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
@@ -526,7 +527,7 @@ ISC_LOOP_TEST_IMPL(doh_noop_GET) {
} }
static void static void
doh_noresponse(void *arg __attribute__((__unused__))) { doh_noresponse(void *arg ISC_ATTR_UNUSED) {
isc_nm_t *listen_nm = nm[0]; isc_nm_t *listen_nm = nm[0];
isc_nm_t *connect_nm = nm[1]; isc_nm_t *connect_nm = nm[1];
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
@@ -580,8 +581,8 @@ timeout_query_sent_cb(isc_nmhandle_t *handle, isc_result_t eresult,
static void static void
timeout_retry_cb(isc_nmhandle_t *handle, isc_result_t eresult, timeout_retry_cb(isc_nmhandle_t *handle, isc_result_t eresult,
isc_region_t *region __attribute__((__unused__)), isc_region_t *region ISC_ATTR_UNUSED,
void *arg __attribute__((__unused__))) { void *arg ISC_ATTR_UNUSED) {
assert_non_null(handle); assert_non_null(handle);
atomic_fetch_add(&ctimeouts, 1); atomic_fetch_add(&ctimeouts, 1);
@@ -617,7 +618,7 @@ timeout_request_cb(isc_nmhandle_t *handle, isc_result_t result, void *arg) {
} }
static void static void
doh_timeout_recovery(void *arg __attribute__((__unused__))) { doh_timeout_recovery(void *arg ISC_ATTR_UNUSED) {
isc_nm_t *listen_nm = nm[0]; isc_nm_t *listen_nm = nm[0];
isc_nmsocket_t *listen_sock = NULL; isc_nmsocket_t *listen_sock = NULL;
isc_nm_t *connect_nm = nm[1]; isc_nm_t *connect_nm = nm[1];
@@ -740,7 +741,7 @@ next : {}
} }
static void static void
doh_recv_one(void *arg __attribute__((__unused__))) { doh_recv_one(void *arg ISC_ATTR_UNUSED) {
isc_nm_t *listen_nm = nm[0]; isc_nm_t *listen_nm = nm[0];
isc_nm_t *connect_nm = nm[1]; isc_nm_t *connect_nm = nm[1];
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
@@ -866,7 +867,7 @@ doh_connect_send_two_requests_cb(isc_nmhandle_t *handle, isc_result_t result,
} }
static void static void
doh_recv_two(void *arg __attribute__((__unused__))) { doh_recv_two(void *arg ISC_ATTR_UNUSED) {
isc_nm_t *listen_nm = nm[0]; isc_nm_t *listen_nm = nm[0];
isc_nm_t *connect_nm = nm[1]; isc_nm_t *connect_nm = nm[1];
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
@@ -969,7 +970,7 @@ ISC_LOOP_TEST_IMPL(doh_recv_two_GET_TLS_quota) {
} }
static void static void
doh_recv_send(void *arg __attribute__((__unused__))) { doh_recv_send(void *arg ISC_ATTR_UNUSED) {
isc_nm_t *listen_nm = nm[0]; isc_nm_t *listen_nm = nm[0];
isc_nm_t *connect_nm = nm[1]; isc_nm_t *connect_nm = nm[1];
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;

View File

@@ -166,8 +166,8 @@ ISC_RUN_TEST_IMPL(isc_hmac_update) {
ISC_RUN_TEST_IMPL(isc_hmac_reset) { ISC_RUN_TEST_IMPL(isc_hmac_reset) {
isc_hmac_t *hmac = *state; isc_hmac_t *hmac = *state;
#if 0 #if 0
unsigned char digest[ISC_MAX_MD_SIZE] __attribute((unused)); unsigned char digest[ISC_MAX_MD_SIZE] ISC_ATTR_UNUSED;
unsigned int digestlen __attribute((unused)); unsigned int digestlen ISC_ATTR_UNUSED;
#endif /* if 0 */ #endif /* if 0 */
assert_non_null(hmac); assert_non_null(hmac);

View File

@@ -65,9 +65,8 @@ ISC_RUN_TEST_IMPL(isc_loopmgr) {
} }
static void static void
runjob(void *arg __attribute__((__unused__))) { runjob(void *arg ISC_ATTR_UNUSED) {
isc_async_current(loopmgr, count, loopmgr); isc_async_current(loopmgr, count, loopmgr);
if (isc_tid() == 0) { if (isc_tid() == 0) {
isc_async_current(loopmgr, shutdown_loopmgr, loopmgr); isc_async_current(loopmgr, shutdown_loopmgr, loopmgr);
} }

View File

@@ -151,8 +151,8 @@ ISC_RUN_TEST_IMPL(isc_md_update) {
ISC_RUN_TEST_IMPL(isc_md_reset) { ISC_RUN_TEST_IMPL(isc_md_reset) {
isc_md_t *md = *state; isc_md_t *md = *state;
#if 0 #if 0
unsigned char digest[ISC_MAX_MD_SIZE] __attribute((unused)); unsigned char digest[ISC_MAX_MD_SIZE] ISC_ATTR_UNUSED;
unsigned int digestlen __attribute((unused)); unsigned int digestlen ISC_ATTR_UNUSED;
#endif /* if 0 */ #endif /* if 0 */
assert_non_null(md); assert_non_null(md);

View File

@@ -195,7 +195,7 @@ setup_netmgr_test(void **state) {
} }
int int
teardown_netmgr_test(void **state __attribute__((__unused__))) { teardown_netmgr_test(void **state ISC_ATTR_UNUSED) {
UNUSED(state); UNUSED(state);
isc_tlsctx_client_session_cache_detach(&tcp_tlsctx_client_sess_cache); isc_tlsctx_client_session_cache_detach(&tcp_tlsctx_client_sess_cache);
@@ -221,7 +221,7 @@ teardown_netmgr_test(void **state __attribute__((__unused__))) {
} }
static void static void
stop_listening(void *arg __attribute__((__unused__))) { stop_listening(void *arg ISC_ATTR_UNUSED) {
isc_nm_stoplistening(listen_sock); isc_nm_stoplistening(listen_sock);
isc_nmsocket_close(&listen_sock); isc_nmsocket_close(&listen_sock);
assert_null(listen_sock); assert_null(listen_sock);
@@ -628,14 +628,14 @@ connect_success_cb(isc_nmhandle_t *handle, isc_result_t eresult, void *cbarg) {
} }
int int
stream_noop_setup(void **state __attribute__((__unused__))) { stream_noop_setup(void **state ISC_ATTR_UNUSED) {
int r = setup_netmgr_test(state); int r = setup_netmgr_test(state);
expected_cconnects = 1; expected_cconnects = 1;
return (r); return (r);
} }
void void
stream_noop(void **state __attribute__((__unused__))) { stream_noop(void **state ISC_ATTR_UNUSED) {
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
result = stream_listen(noop_accept_cb, NULL, 128, NULL, &listen_sock); result = stream_listen(noop_accept_cb, NULL, 128, NULL, &listen_sock);
@@ -647,7 +647,7 @@ stream_noop(void **state __attribute__((__unused__))) {
} }
int int
stream_noop_teardown(void **state __attribute__((__unused__))) { stream_noop_teardown(void **state ISC_ATTR_UNUSED) {
atomic_assert_int_eq(cconnects, 1); atomic_assert_int_eq(cconnects, 1);
atomic_assert_int_eq(csends, 0); atomic_assert_int_eq(csends, 0);
atomic_assert_int_eq(creads, 0); atomic_assert_int_eq(creads, 0);
@@ -713,7 +713,7 @@ noresponse_connectcb(isc_nmhandle_t *handle, isc_result_t eresult,
} }
int int
stream_noresponse_setup(void **state __attribute__((__unused__))) { stream_noresponse_setup(void **state ISC_ATTR_UNUSED) {
int r = setup_netmgr_test(state); int r = setup_netmgr_test(state);
expected_cconnects = 1; expected_cconnects = 1;
expected_saccepts = 1; expected_saccepts = 1;
@@ -721,7 +721,7 @@ stream_noresponse_setup(void **state __attribute__((__unused__))) {
} }
void void
stream_noresponse(void **state __attribute__((__unused__))) { stream_noresponse(void **state ISC_ATTR_UNUSED) {
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
result = stream_listen(noop_accept_cb, NULL, 128, NULL, &listen_sock); result = stream_listen(noop_accept_cb, NULL, 128, NULL, &listen_sock);
@@ -732,7 +732,7 @@ stream_noresponse(void **state __attribute__((__unused__))) {
} }
int int
stream_noresponse_teardown(void **state __attribute__((__unused__))) { stream_noresponse_teardown(void **state ISC_ATTR_UNUSED) {
X(cconnects); X(cconnects);
X(csends); X(csends);
X(creads); X(creads);
@@ -748,7 +748,7 @@ stream_noresponse_teardown(void **state __attribute__((__unused__))) {
} }
int int
stream_timeout_recovery_setup(void **state __attribute__((__unused__))) { stream_timeout_recovery_setup(void **state ISC_ATTR_UNUSED) {
int r = setup_netmgr_test(state); int r = setup_netmgr_test(state);
expected_ctimeouts = 4; expected_ctimeouts = 4;
@@ -761,7 +761,7 @@ stream_timeout_recovery_setup(void **state __attribute__((__unused__))) {
} }
void void
stream_timeout_recovery(void **state __attribute__((__unused__))) { stream_timeout_recovery(void **state ISC_ATTR_UNUSED) {
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
/* /*
@@ -782,13 +782,13 @@ stream_timeout_recovery(void **state __attribute__((__unused__))) {
} }
int int
stream_timeout_recovery_teardown(void **state __attribute__((__unused__))) { stream_timeout_recovery_teardown(void **state ISC_ATTR_UNUSED) {
atomic_assert_int_eq(ctimeouts, expected_ctimeouts); atomic_assert_int_eq(ctimeouts, expected_ctimeouts);
return (teardown_netmgr_test(state)); return (teardown_netmgr_test(state));
} }
int int
stream_recv_one_setup(void **state __attribute__((__unused__))) { stream_recv_one_setup(void **state ISC_ATTR_UNUSED) {
int r = setup_netmgr_test(state); int r = setup_netmgr_test(state);
expected_cconnects = 1; expected_cconnects = 1;
@@ -813,7 +813,7 @@ stream_recv_one_setup(void **state __attribute__((__unused__))) {
} }
void void
stream_recv_one(void **state __attribute__((__unused__))) { stream_recv_one(void **state ISC_ATTR_UNUSED) {
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
isc_quota_t *quotap = tcp_listener_init_quota(1); isc_quota_t *quotap = tcp_listener_init_quota(1);
@@ -828,7 +828,7 @@ stream_recv_one(void **state __attribute__((__unused__))) {
} }
int int
stream_recv_one_teardown(void **state __attribute__((__unused__))) { stream_recv_one_teardown(void **state ISC_ATTR_UNUSED) {
atomic_assert_int_eq(cconnects, expected_cconnects); atomic_assert_int_eq(cconnects, expected_cconnects);
atomic_assert_int_eq(csends, expected_csends); atomic_assert_int_eq(csends, expected_csends);
atomic_assert_int_eq(saccepts, expected_saccepts); atomic_assert_int_eq(saccepts, expected_saccepts);
@@ -840,7 +840,7 @@ stream_recv_one_teardown(void **state __attribute__((__unused__))) {
} }
int int
stream_recv_two_setup(void **state __attribute__((__unused__))) { stream_recv_two_setup(void **state ISC_ATTR_UNUSED) {
int r = setup_netmgr_test(state); int r = setup_netmgr_test(state);
expected_cconnects = 2; expected_cconnects = 2;
@@ -865,7 +865,7 @@ stream_recv_two_setup(void **state __attribute__((__unused__))) {
} }
void void
stream_recv_two(void **state __attribute__((__unused__))) { stream_recv_two(void **state ISC_ATTR_UNUSED) {
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
isc_quota_t *quotap = tcp_listener_init_quota(1); isc_quota_t *quotap = tcp_listener_init_quota(1);
@@ -882,7 +882,7 @@ stream_recv_two(void **state __attribute__((__unused__))) {
} }
int int
stream_recv_two_teardown(void **state __attribute__((__unused__))) { stream_recv_two_teardown(void **state ISC_ATTR_UNUSED) {
atomic_assert_int_eq(cconnects, expected_cconnects); atomic_assert_int_eq(cconnects, expected_cconnects);
atomic_assert_int_eq(csends, expected_csends); atomic_assert_int_eq(csends, expected_csends);
atomic_assert_int_eq(sreads, expected_saccepts); atomic_assert_int_eq(sreads, expected_saccepts);
@@ -894,7 +894,7 @@ stream_recv_two_teardown(void **state __attribute__((__unused__))) {
} }
int int
stream_recv_send_setup(void **state __attribute__((__unused__))) { stream_recv_send_setup(void **state ISC_ATTR_UNUSED) {
int r = setup_netmgr_test(state); int r = setup_netmgr_test(state);
expected_cconnects = workers; expected_cconnects = workers;
cconnects_shutdown = false; cconnects_shutdown = false;
@@ -905,7 +905,7 @@ stream_recv_send_setup(void **state __attribute__((__unused__))) {
} }
void void
stream_recv_send(void **state __attribute__((__unused__))) { stream_recv_send(void **state ISC_ATTR_UNUSED) {
isc_result_t result = ISC_R_SUCCESS; isc_result_t result = ISC_R_SUCCESS;
isc_quota_t *quotap = tcp_listener_init_quota(workers); isc_quota_t *quotap = tcp_listener_init_quota(workers);
@@ -922,7 +922,7 @@ stream_recv_send(void **state __attribute__((__unused__))) {
} }
int int
stream_recv_send_teardown(void **state __attribute__((__unused__))) { stream_recv_send_teardown(void **state ISC_ATTR_UNUSED) {
X(cconnects); X(cconnects);
X(csends); X(csends);
X(creads); X(creads);

View File

@@ -15,6 +15,7 @@
#include <isc/netmgr.h> #include <isc/netmgr.h>
#include <isc/refcount.h> #include <isc/refcount.h>
#include <isc/thread.h> #include <isc/thread.h>
#include <isc/util.h>
#include "netmgr/netmgr-int.h" #include "netmgr/netmgr-int.h"
@@ -227,7 +228,7 @@ extern isc_nm_recv_cb_t connect_readcb;
int int
setup_netmgr_test(void **state); setup_netmgr_test(void **state);
int int
teardown_netmgr_test(void **state __attribute__((unused))); teardown_netmgr_test(void **state ISC_ATTR_UNUSED);
void void
noop_recv_cb(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region, noop_recv_cb(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
@@ -282,45 +283,45 @@ void
stream_connect(isc_nm_cb_t cb, void *cbarg, unsigned int timeout); stream_connect(isc_nm_cb_t cb, void *cbarg, unsigned int timeout);
int int
stream_noop_setup(void **state __attribute__((unused))); stream_noop_setup(void **state ISC_ATTR_UNUSED);
void void
stream_noop(void **state __attribute__((unused))); stream_noop(void **state ISC_ATTR_UNUSED);
int int
stream_noop_teardown(void **state __attribute__((unused))); stream_noop_teardown(void **state ISC_ATTR_UNUSED);
int int
stream_noresponse_setup(void **state __attribute__((unused))); stream_noresponse_setup(void **state ISC_ATTR_UNUSED);
void void
stream_noresponse(void **state __attribute__((unused))); stream_noresponse(void **state ISC_ATTR_UNUSED);
int int
stream_noresponse_teardown(void **state __attribute__((unused))); stream_noresponse_teardown(void **state ISC_ATTR_UNUSED);
int int
stream_timeout_recovery_setup(void **state __attribute__((unused))); stream_timeout_recovery_setup(void **state ISC_ATTR_UNUSED);
void void
stream_timeout_recovery(void **state __attribute__((unused))); stream_timeout_recovery(void **state ISC_ATTR_UNUSED);
int int
stream_timeout_recovery_teardown(void **state __attribute__((unused))); stream_timeout_recovery_teardown(void **state ISC_ATTR_UNUSED);
int int
stream_recv_one_setup(void **state __attribute__((unused))); stream_recv_one_setup(void **state ISC_ATTR_UNUSED);
void void
stream_recv_one(void **state __attribute__((unused))); stream_recv_one(void **state ISC_ATTR_UNUSED);
int int
stream_recv_one_teardown(void **state __attribute__((unused))); stream_recv_one_teardown(void **state ISC_ATTR_UNUSED);
int int
stream_recv_two_setup(void **state __attribute__((unused))); stream_recv_two_setup(void **state ISC_ATTR_UNUSED);
void void
stream_recv_two(void **state __attribute__((unused))); stream_recv_two(void **state ISC_ATTR_UNUSED);
int int
stream_recv_two_teardown(void **state __attribute__((unused))); stream_recv_two_teardown(void **state ISC_ATTR_UNUSED);
int int
stream_recv_send_setup(void **state __attribute__((unused))); stream_recv_send_setup(void **state ISC_ATTR_UNUSED);
void void
stream_recv_send(void **state __attribute__((unused))); stream_recv_send(void **state ISC_ATTR_UNUSED);
int int
stream_recv_send_teardown(void **state __attribute__((unused))); stream_recv_send_teardown(void **state ISC_ATTR_UNUSED);
void void
stream_recv_send_connect(void *arg); stream_recv_send_connect(void *arg);

View File

@@ -131,7 +131,7 @@ ISC_TEST_ENTRY_CUSTOM(tcp_recv_send_quota_sendback, stream_recv_send_setup,
ISC_TEST_LIST_END ISC_TEST_LIST_END
static int static int
tcp_setup(void **state __attribute__((__unused__))) { tcp_setup(void **state ISC_ATTR_UNUSED) {
stream_port = TCP_TEST_PORT; stream_port = TCP_TEST_PORT;
stream_use_TLS = false; stream_use_TLS = false;
stream = true; stream = true;

View File

@@ -41,7 +41,7 @@
/* TCPDNS */ /* TCPDNS */
static void static void
stop_listening(void *arg __attribute__((__unused__))) { stop_listening(void *arg ISC_ATTR_UNUSED) {
isc_nm_stoplistening(listen_sock); isc_nm_stoplistening(listen_sock);
isc_nmsocket_close(&listen_sock); isc_nmsocket_close(&listen_sock);
assert_null(listen_sock); assert_null(listen_sock);
@@ -143,7 +143,7 @@ ISC_TEST_ENTRY_CUSTOM(tcpdns_recv_send, stream_recv_send_setup,
ISC_TEST_LIST_END ISC_TEST_LIST_END
static int static int
tcpdns_setup(void **state __attribute__((__unused__))) { tcpdns_setup(void **state ISC_ATTR_UNUSED) {
stream_port = TCPDNS_TEST_PORT; stream_port = TCPDNS_TEST_PORT;
return (0); return (0);

View File

@@ -427,7 +427,7 @@ ISC_LOOP_TEARDOWN_IMPL(timer_expect) {
} }
static void static void
timer_event(void *arg __attribute__((__unused__))) { timer_event(void *arg ISC_ATTR_UNUSED) {
if (--timer_ticks == 0) { if (--timer_ticks == 0) {
isc_timer_destroy(&timer); isc_timer_destroy(&timer);
isc_loopmgr_shutdown(loopmgr); isc_loopmgr_shutdown(loopmgr);

View File

@@ -126,7 +126,7 @@ ISC_TEST_ENTRY_CUSTOM(tls_recv_send_quota_sendback, stream_recv_send_setup,
ISC_TEST_LIST_END ISC_TEST_LIST_END
static int static int
tls_setup(void **state __attribute__((__unused__))) { tls_setup(void **state ISC_ATTR_UNUSED) {
stream_port = TLS_TEST_PORT; stream_port = TLS_TEST_PORT;
stream_use_TLS = true; stream_use_TLS = true;
stream = true; stream = true;

View File

@@ -40,7 +40,7 @@
#include <tests/isc.h> #include <tests/isc.h>
static void static void
stop_listening(void *arg __attribute__((__unused__))) { stop_listening(void *arg ISC_ATTR_UNUSED) {
isc_nm_stoplistening(listen_sock); isc_nm_stoplistening(listen_sock);
isc_nmsocket_close(&listen_sock); isc_nmsocket_close(&listen_sock);
assert_null(listen_sock); assert_null(listen_sock);
@@ -153,7 +153,7 @@ ISC_TEST_ENTRY_CUSTOM(tlsdns_recv_send, stream_recv_send_setup,
ISC_TEST_LIST_END ISC_TEST_LIST_END
static int static int
tlsdns_setup(void **state __attribute__((__unused__))) { tlsdns_setup(void **state ISC_ATTR_UNUSED) {
stream_port = TLSDNS_TEST_PORT; stream_port = TLSDNS_TEST_PORT;
return (0); return (0);

View File

@@ -139,7 +139,7 @@ connect_nomemory_cb(isc_nmhandle_t *handle, isc_result_t eresult, void *cbarg) {
} }
static void static void
stop_listening(void *arg __attribute__((__unused__))) { stop_listening(void *arg ISC_ATTR_UNUSED) {
isc_nm_stoplistening(listen_sock); isc_nm_stoplistening(listen_sock);
isc_nmsocket_close(&listen_sock); isc_nmsocket_close(&listen_sock);
assert_null(listen_sock); assert_null(listen_sock);
@@ -520,7 +520,7 @@ udp_shutdown_connect_connect_cb(isc_nmhandle_t *handle, isc_result_t eresult,
} }
static void static void
udp_connect_udpconnect(void *arg __attribute__((__unused__))) { udp_connect_udpconnect(void *arg ISC_ATTR_UNUSED) {
isc_nm_udpconnect(netmgr, &udp_connect_addr, &udp_listen_addr, isc_nm_udpconnect(netmgr, &udp_connect_addr, &udp_listen_addr,
udp_shutdown_connect_connect_cb, NULL, T_SOFT); udp_shutdown_connect_connect_cb, NULL, T_SOFT);
} }
@@ -790,7 +790,7 @@ udp__send_cb(isc_nmhandle_t *handle, isc_result_t eresult, void *cbarg) {
static void static void
udp__connect_cb(isc_nmhandle_t *handle, isc_result_t eresult, void *cbarg); udp__connect_cb(isc_nmhandle_t *handle, isc_result_t eresult, void *cbarg);
static void static void
udp__connect(void *arg __attribute__((__unused__))) { udp__connect(void *arg ISC_ATTR_UNUSED) {
isc_sockaddr_t connect_addr; isc_sockaddr_t connect_addr;
connect_addr = (isc_sockaddr_t){ .length = 0 }; connect_addr = (isc_sockaddr_t){ .length = 0 };

View File

@@ -25,6 +25,7 @@
#include <unistd.h> #include <unistd.h>
#include <isc/atomic.h> #include <isc/atomic.h>
#include <isc/util.h>
#define UNIT_TESTING #define UNIT_TESTING
#include <cmocka.h> #include <cmocka.h>
@@ -114,7 +115,7 @@ __wrap_uv_udp_bind(uv_udp_t *handle, const struct sockaddr *addr,
return (atomic_load(&__state_uv_udp_bind)); return (atomic_load(&__state_uv_udp_bind));
} }
static atomic_int __state_uv_udp_connect __attribute__((unused)) = 0; static atomic_int __state_uv_udp_connect ISC_ATTR_UNUSED = 0;
int int
__wrap_uv_udp_connect(uv_udp_t *handle, const struct sockaddr *addr) { __wrap_uv_udp_connect(uv_udp_t *handle, const struct sockaddr *addr) {
@@ -124,7 +125,7 @@ __wrap_uv_udp_connect(uv_udp_t *handle, const struct sockaddr *addr) {
return (atomic_load(&__state_uv_udp_connect)); return (atomic_load(&__state_uv_udp_connect));
} }
static atomic_int __state_uv_udp_getpeername __attribute__((unused)) = 0; static atomic_int __state_uv_udp_getpeername ISC_ATTR_UNUSED = 0;
int int
__wrap_uv_udp_getpeername(const uv_udp_t *handle, struct sockaddr *name, __wrap_uv_udp_getpeername(const uv_udp_t *handle, struct sockaddr *name,

View File

@@ -52,7 +52,7 @@ adjustnofile(void) {
} }
int int
setup_mctx(void **state __attribute__((__unused__))) { setup_mctx(void **state ISC_ATTR_UNUSED) {
isc_mem_debugging |= ISC_MEM_DEBUGRECORD; isc_mem_debugging |= ISC_MEM_DEBUGRECORD;
isc_mem_create(&mctx); isc_mem_create(&mctx);
@@ -60,14 +60,14 @@ setup_mctx(void **state __attribute__((__unused__))) {
} }
int int
teardown_mctx(void **state __attribute__((__unused__))) { teardown_mctx(void **state ISC_ATTR_UNUSED) {
isc_mem_destroy(&mctx); isc_mem_destroy(&mctx);
return (0); return (0);
} }
int int
setup_loopmgr(void **state __attribute__((__unused__))) { setup_loopmgr(void **state ISC_ATTR_UNUSED) {
char *env_workers = NULL; char *env_workers = NULL;
REQUIRE(mctx != NULL); REQUIRE(mctx != NULL);
@@ -88,7 +88,7 @@ setup_loopmgr(void **state __attribute__((__unused__))) {
} }
int int
teardown_loopmgr(void **state __attribute__((__unused__))) { teardown_loopmgr(void **state ISC_ATTR_UNUSED) {
REQUIRE(netmgr == NULL); REQUIRE(netmgr == NULL);
mainloop = NULL; mainloop = NULL;
@@ -98,7 +98,7 @@ teardown_loopmgr(void **state __attribute__((__unused__))) {
} }
int int
setup_netmgr(void **state __attribute__((__unused__))) { setup_netmgr(void **state ISC_ATTR_UNUSED) {
REQUIRE(loopmgr != NULL); REQUIRE(loopmgr != NULL);
adjustnofile(); adjustnofile();
@@ -109,7 +109,7 @@ setup_netmgr(void **state __attribute__((__unused__))) {
} }
int int
teardown_netmgr(void **state __attribute__((__unused__))) { teardown_netmgr(void **state ISC_ATTR_UNUSED) {
REQUIRE(loopmgr != NULL); REQUIRE(loopmgr != NULL);
isc_netmgr_destroy(&netmgr); isc_netmgr_destroy(&netmgr);

View File

@@ -115,7 +115,7 @@ cleanup:
} }
void void
shutdown_interfacemgr(void *arg __attribute__((__unused__))) { shutdown_interfacemgr(void *arg ISC_ATTR_UNUSED) {
if (interfacemgr != NULL) { if (interfacemgr != NULL) {
ns_interfacemgr_shutdown(interfacemgr); ns_interfacemgr_shutdown(interfacemgr);
ns_interfacemgr_detach(&interfacemgr); ns_interfacemgr_detach(&interfacemgr);

View File

@@ -22,10 +22,9 @@
#include <ns/client.h> #include <ns/client.h>
#if ISC_NETMGR_TRACE #if ISC_NETMGR_TRACE
#define FLARG \ #define FLARG \
, const char *file __attribute__((unused)), \ , const char *file ISC_ATTR_UNUSED, unsigned int line ISC_ATTR_UNUSED, \
unsigned int line __attribute__((unused)), \ const char *func ISC_ATTR_UNUSED
const char *func __attribute__((unused))
#else #else
#define FLARG #define FLARG
#endif #endif