From: Arran Cudbard-Bell Date: Sat, 20 Feb 2021 23:48:25 +0000 (+0000) Subject: Fix other warnings X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c117599d7dbee1b8f3f516a4e3de0262368b5a77;p=thirdparty%2Ffreeradius-server.git Fix other warnings --- diff --git a/src/lib/server/method.c b/src/lib/server/method.c index 577212b0f15..1626a34ff63 100644 --- a/src/lib/server/method.c +++ b/src/lib/server/method.c @@ -36,7 +36,7 @@ fr_dict_autoload_t method_dict[] = { { NULL } }; -fr_dict_attr_t const *attr_module_method; +static fr_dict_attr_t const *attr_module_method; extern fr_dict_attr_autoload_t module_method_attr[]; fr_dict_attr_autoload_t module_method_attr[] = { diff --git a/src/lib/tls/log.c b/src/lib/tls/log.c index fd83f04c04a..28b707498c3 100644 --- a/src/lib/tls/log.c +++ b/src/lib/tls/log.c @@ -254,6 +254,7 @@ static void _tls_ctx_print_cert_line(char const *file, int line, } } +DIAG_OFF(used-but-marked-unused) /* fix spurious warnings for sk macros */ /** Print out the current stack of certs * * @param[in] file File where this function is being called. @@ -272,7 +273,7 @@ void _fr_tls_log_certificate_chain(char const *file, int line, } _tls_ctx_print_cert_line(file, line, request, i, cert); } - +DIAG_ON(used-but-marked-unused) /** Print errors raised by OpenSSL I/O functions * diff --git a/src/lib/tls/ocsp.c b/src/lib/tls/ocsp.c index 51b76565cb6..439cd5df6af 100644 --- a/src/lib/tls/ocsp.c +++ b/src/lib/tls/ocsp.c @@ -57,6 +57,7 @@ typedef enum { */ #define OCSP_MAX_VALIDITY_PERIOD (5 * 60) +DIAG_OFF(used-but-marked-unused) /* fix spurious warnings for sk macros */ /** Extract components of OCSP responser URL from a certificate * * @param[in] cert to extract URL from. @@ -90,6 +91,7 @@ static int ocsp_cert_url_parse(X509 *cert, char **host_out, char **port_out, cha } return found_uri ? -1 : 0; } +DIAG_ON(used-but-marked-unused) /** Set the OCSP TLS stapling extension for a SSL session, from cached response data * @@ -169,6 +171,7 @@ static int ocsp_staple_to_pair(fr_pair_t **out, request_t *request, OCSP_RESPONS return 0; } +DIAG_OFF(used-but-marked-unused) /* fix spurious warnings for sk macros */ /** Callback used to get stapling data for the current server cert * * @param ssl Current SSL session. @@ -326,6 +329,7 @@ int fr_tls_ocsp_staple_cb(SSL *ssl, void *data) return ret; } +DIAG_ON(used-but-marked-unused) /** Sends a OCSP request to a defined OCSP responder * */ diff --git a/src/lib/tls/session.c b/src/lib/tls/session.c index b8c74193475..f38e8c7828f 100644 --- a/src/lib/tls/session.c +++ b/src/lib/tls/session.c @@ -378,8 +378,8 @@ static bool session_psk_identity_is_safe(const char *identity) * - >0 if a PSK matching identity was found (the length of bytes written to psk). */ unsigned int fr_tls_session_psk_client_cb(SSL *ssl, UNUSED char const *hint, - char *identity, unsigned int max_identity_len, - unsigned char *psk, unsigned int max_psk_len) + char *identity, unsigned int max_identity_len, + unsigned char *psk, unsigned int max_psk_len) { unsigned int psk_len; fr_tls_conf_t *conf; @@ -488,6 +488,7 @@ unsigned int fr_tls_session_psk_server_cb(SSL *ssl, const char *identity, } #endif /* PSK_MAX_IDENTITY_LEN */ +DIAG_OFF(used-but-marked-unused) /* Fix spurious warnings for sk_ macros */ /** Record session state changes * * Called by OpenSSL whenever the session state changes, an alert is received or an error occurs. @@ -601,6 +602,7 @@ void fr_tls_session_info_cb(SSL const *ssl, int where, int ret) } } } +DIAG_ON(used-but-marked-unused) /** Print a message to the request or global log detailing handshake state * @@ -860,6 +862,7 @@ static inline fr_pair_t *fr_tls_session_cert_attr_add(TALLOC_CTX *ctx, request_t return vp; } +DIAG_OFF(used-but-marked-unused) /* fix spurious warnings for sk macros */ /** Extract attributes from an X509 certificate * * @param pair_list to copy attributes to. @@ -872,7 +875,7 @@ static inline fr_pair_t *fr_tls_session_cert_attr_add(TALLOC_CTX *ctx, request_t * - < 0 on failure. */ int fr_tls_session_pairs_from_x509_cert(fr_pair_list_t *pair_list, TALLOC_CTX *ctx, - fr_tls_session_t *session, X509 *cert, int depth) + fr_tls_session_t *session, X509 *cert, int depth) { char buffer[1024]; char attribute[256]; @@ -1105,6 +1108,7 @@ int fr_tls_session_pairs_from_x509_cert(fr_pair_list_t *pair_list, TALLOC_CTX *c return 0; } +DIAG_ON(used-but-marked-unused) /** Decrypt application data * diff --git a/src/lib/tls/validate.c b/src/lib/tls/validate.c index 5acb9cf466f..628de3931a3 100644 --- a/src/lib/tls/validate.c +++ b/src/lib/tls/validate.c @@ -39,6 +39,7 @@ #include "base.h" #include "missing.h" +DIAG_OFF(used-but-marked-unused) /* fix spurious warnings for sk macros */ /** Validates a certificate using custom logic * * Before trusting a certificate, we make sure that the certificate is @@ -346,6 +347,7 @@ int fr_tls_validate_cert_cb(int ok, X509_STORE_CTX *x509_ctx) RDEBUG2("[verify client] = %s", my_ok ? "ok" : "invalid"); return my_ok; } +DIAG_ON(used-but-marked-unused) /** Revalidates the client's certificate chain * diff --git a/src/lib/util/dbuff.c b/src/lib/util/dbuff.c index 6af875b048a..10fc4601991 100644 --- a/src/lib/util/dbuff.c +++ b/src/lib/util/dbuff.c @@ -34,6 +34,7 @@ RCSID("$Id$") # define CHECK_DBUFF_INIT(_sbuff) #endif +DIAG_OFF(overlength-strings) /* Seems broken */ /** Internal macro for defining dbuff move functions * @private */ @@ -60,6 +61,7 @@ FR_DBUFF_MOVE_DEF(dbuff, dbuff) FR_DBUFF_MOVE_DEF(dbuff, dbuff_marker) FR_DBUFF_MOVE_DEF(dbuff_marker, dbuff) FR_DBUFF_MOVE_DEF(dbuff_marker, dbuff_marker) +DIAG_ON(overlength-strings) static inline CC_HINT(always_inline) size_t min(size_t x, size_t y) { diff --git a/src/lib/util/dbuff_tests.c b/src/lib/util/dbuff_tests.c index f988bee5c71..e5d86b5ad6e 100644 --- a/src/lib/util/dbuff_tests.c +++ b/src/lib/util/dbuff_tests.c @@ -492,12 +492,12 @@ static void test_dbuff_out(void) TEST_CHECK(fr_dbuff_in(&dbuff2, *(uint32_t *)&fval1) == 4); fr_dbuff_set_to_start(&dbuff2); TEST_CHECK(fr_dbuff_out(&fval2, &dbuff2) == 4); - TEST_CHECK(fval1 == fval2); + TEST_CHECK(memcmp(&fval1, &fval2, sizeof(fval1)) == 0); fr_dbuff_set_to_start(&dbuff2); TEST_CHECK(fr_dbuff_in(&dbuff2, *(uint64_t *)&dval1) == 8); fr_dbuff_set_to_start(&dbuff2); TEST_CHECK(fr_dbuff_out(&dval2, &dbuff2) == 8); - TEST_CHECK(dval1 == dval2); + TEST_CHECK(memcmp(&fval1, &fval2, sizeof(fval1)) == 0); TEST_CASE("Check variable length uint64_t read"); fr_dbuff_set_to_start(&dbuff1); diff --git a/src/lib/util/pair.c b/src/lib/util/pair.c index 4a14afc3073..ccc26159f85 100644 --- a/src/lib/util/pair.c +++ b/src/lib/util/pair.c @@ -33,15 +33,11 @@ RCSID("$Id$") #include -#ifndef NDEBUG -# define FREE_MAGIC (0xF4EEF4EE) -#endif - /** Initialise a pair list header * * @param[in,out] list to initialise */ -inline void fr_pair_list_init(fr_pair_list_t *list) +void fr_pair_list_init(fr_pair_list_t *list) { fr_dlist_talloc_init(&list->head, fr_pair_t, entry); } @@ -373,7 +369,7 @@ void fr_pair_steal(TALLOC_CTX *ctx, fr_pair_t *vp) * * @hidecallergraph */ -inline void fr_pair_list_free(fr_pair_list_t *list) +void fr_pair_list_free(fr_pair_list_t *list) { fr_dlist_talloc_free(&list->head); } @@ -385,7 +381,7 @@ inline void fr_pair_list_free(fr_pair_list_t *list) * * @hidecallergraph */ -inline bool fr_pair_list_empty(fr_pair_list_t const *list) +bool fr_pair_list_empty(fr_pair_list_t const *list) { return fr_dlist_empty(&list->head); } @@ -577,7 +573,7 @@ static inline CC_HINT(always_inline) fr_pair_list_t *pair_children(fr_pair_t *vp * - NULL on error * - pointer to head of the child list. */ -inline fr_pair_list_t *fr_pair_children(fr_pair_t *vp) +fr_pair_list_t *fr_pair_children(fr_pair_t *vp) { return pair_children(vp); } @@ -591,7 +587,7 @@ inline fr_pair_list_t *fr_pair_children(fr_pair_t *vp) * - pointer to the first item in the list. * @hidecallergraph */ -inline void *fr_pair_list_head(fr_pair_list_t const *list) +void *fr_pair_list_head(fr_pair_list_t const *list) { return fr_dlist_head(&list->head); } @@ -605,7 +601,7 @@ inline void *fr_pair_list_head(fr_pair_list_t const *list) * - pointer to the next item * @hidecallergraph */ -inline void *fr_pair_list_next(fr_pair_list_t const *list, fr_pair_t const *item) +void *fr_pair_list_next(fr_pair_list_t const *list, fr_pair_t const *item) { return fr_dlist_next(&list->head, item); } @@ -618,7 +614,7 @@ inline void *fr_pair_list_next(fr_pair_list_t const *list, fr_pair_t const *item * - NULL if the head of the list has been reached * - pointer to the previous item */ -inline void *fr_pair_list_prev(fr_pair_list_t const *list, fr_pair_t const *item) +void *fr_pair_list_prev(fr_pair_list_t const *list, fr_pair_t const *item) { return fr_dlist_prev(&list->head, item); } @@ -631,7 +627,7 @@ inline void *fr_pair_list_prev(fr_pair_list_t const *list, fr_pair_t const *item * - NULL if the list is empty * - pointer to the last item in the list. */ -inline void *fr_pair_list_tail(fr_pair_list_t const *list) +void *fr_pair_list_tail(fr_pair_list_t const *list) { return fr_dlist_tail(&list->head); } @@ -2526,7 +2522,7 @@ bool fr_pair_matches_da(void const *item, void const *uctx) * * @return number of entries in the list */ -inline size_t fr_pair_list_len(fr_pair_list_t const *list) +size_t fr_pair_list_len(fr_pair_list_t const *list) { return list->head.num_elements; } diff --git a/src/lib/util/pair_legacy.c b/src/lib/util/pair_legacy.c index 09fba5b3a6a..e3f20da3d7c 100644 --- a/src/lib/util/pair_legacy.c +++ b/src/lib/util/pair_legacy.c @@ -35,7 +35,7 @@ RCSID("$Id$") #include -fr_sbuff_term_t const bareword_terminals = +static fr_sbuff_term_t const bareword_terminals = FR_SBUFF_TERMS( L("\t"), L("\n"), diff --git a/src/lib/util/rbtree_tests.c b/src/lib/util/rbtree_tests.c index 6c25645e4cb..4b2f542a523 100644 --- a/src/lib/util/rbtree_tests.c +++ b/src/lib/util/rbtree_tests.c @@ -173,8 +173,8 @@ static bool is_prime(uint32_t n) return true; } -uint32_t non_primes[] = { 1, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 26, 27, 28, - 30, 32, 33, 34, 35, 36, 38, 39, 40, 42, 44, 45, 46, 48, 49, 50}; +static uint32_t non_primes[] = { 1, 4, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 26, 27, 28, + 30, 32, 33, 34, 35, 36, 38, 39, 40, 42, 44, 45, 46, 48, 49, 50}; static void test_rbtree_iter_delete(void) {