Build warning fixes.

This commit is contained in:
Roger A. Light 2021-08-26 10:54:03 +01:00
parent 756b3fcb08
commit 376226c129
10 changed files with 57 additions and 13 deletions

View File

@ -31,13 +31,14 @@ special_variants = [
]
import os
import random
import subprocess
def run_test(msg, opts):
subprocess.run(["make", "clean"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
print("%s: %s" % (msg, str(opts)))
args = ["make", "-j"] + opts
args = ["make", "-j%d" % (os.cpu_count())] + opts
proc = subprocess.run(args, stdout=subprocess.DEVNULL)
if proc.returncode != 0:
raise RuntimeError("BUILD FAILED: %s" % (' '.join(args)))

View File

@ -920,6 +920,9 @@ int net__socket_connect_step3(struct mosquitto *mosq, const char *host)
}
}
#else
UNUSED(mosq);
UNUSED(host);
#endif
return MOSQ_ERR_SUCCESS;
}
@ -1213,6 +1216,8 @@ void *mosquitto_ssl_get(struct mosquitto *mosq)
#ifdef WITH_TLS
return mosq->ssl;
#else
UNUSED(mosq);
return NULL;
#endif
}

View File

@ -205,6 +205,13 @@ int mosquitto_tls_set(struct mosquitto *mosq, const char *cafile, const char *ca
return MOSQ_ERR_SUCCESS;
#else
UNUSED(mosq);
UNUSED(cafile);
UNUSED(capath);
UNUSED(certfile);
UNUSED(keyfile);
UNUSED(pw_callback);
return MOSQ_ERR_NOT_SUPPORTED;
#endif
@ -241,8 +248,12 @@ int mosquitto_tls_opts_set(struct mosquitto *mosq, int cert_reqs, const char *tl
return MOSQ_ERR_SUCCESS;
#else
return MOSQ_ERR_NOT_SUPPORTED;
UNUSED(mosq);
UNUSED(cert_reqs);
UNUSED(tls_version);
UNUSED(ciphers);
return MOSQ_ERR_NOT_SUPPORTED;
#endif
}
@ -254,6 +265,9 @@ int mosquitto_tls_insecure_set(struct mosquitto *mosq, bool value)
mosq->tls_insecure = value;
return MOSQ_ERR_SUCCESS;
#else
UNUSED(mosq);
UNUSED(value);
return MOSQ_ERR_NOT_SUPPORTED;
#endif
}
@ -373,6 +387,11 @@ int mosquitto_tls_psk_set(struct mosquitto *mosq, const char *psk, const char *i
return MOSQ_ERR_SUCCESS;
#else
UNUSED(mosq);
UNUSED(psk);
UNUSED(identity);
UNUSED(ciphers);
return MOSQ_ERR_NOT_SUPPORTED;
#endif
}

View File

@ -42,8 +42,8 @@ Contributors:
int send__publish(struct mosquitto *mosq, uint16_t mid, const char *topic, uint32_t payloadlen, const void *payload, uint8_t qos, bool retain, bool dup, const mosquitto_property *cmsg_props, const mosquitto_property *store_props, uint32_t expiry_interval)
{
#ifdef WITH_BROKER
#ifdef WITH_BRIDGE
size_t len;
#ifdef WITH_BRIDGE
int i;
struct mosquitto__bridge_topic *cur_topic;
bool match;

View File

@ -108,6 +108,12 @@ int mosquitto_socks5_set(struct mosquitto *mosq, const char *host, int port, con
return MOSQ_ERR_SUCCESS;
#else
UNUSED(mosq);
UNUSED(host);
UNUSED(port);
UNUSED(username);
UNUSED(password);
return MOSQ_ERR_NOT_SUPPORTED;
#endif
}

View File

@ -37,6 +37,9 @@ static void srv_callback(void *arg, int status, int timeouts, unsigned char *abu
{
struct mosquitto *mosq = arg;
struct ares_srv_reply *reply = NULL;
UNUSED(timeouts);
if(status == ARES_SUCCESS){
status = ares_parse_srv_reply(abuf, alen, &reply);
if(status == ARES_SUCCESS){
@ -69,6 +72,8 @@ int mosquitto_connect_srv(struct mosquitto *mosq, const char *host, int keepaliv
int rc;
if(!mosq) return MOSQ_ERR_INVAL;
UNUSED(bind_address);
if(keepalive < 0 || keepalive > UINT16_MAX){
return MOSQ_ERR_INVAL;
}

View File

@ -434,9 +434,9 @@ int net__tls_server_ctx(struct mosquitto__listener *listener)
#endif
#ifdef WITH_TLS
static int net__load_crl_file(struct mosquitto__listener *listener)
{
#ifdef WITH_TLS
X509_STORE *store;
X509_LOOKUP *lookup;
int rc;
@ -456,10 +456,10 @@ static int net__load_crl_file(struct mosquitto__listener *listener)
return MOSQ_ERR_TLS;
}
X509_STORE_set_flags(store, X509_V_FLAG_CRL_CHECK);
#endif
return MOSQ_ERR_SUCCESS;
}
#endif
int net__load_certificates(struct mosquitto__listener *listener)
@ -499,14 +499,16 @@ int net__load_certificates(struct mosquitto__listener *listener)
return rc;
}
}
#else
UNUSED(listener);
#endif
return MOSQ_ERR_SUCCESS;
}
#if defined(WITH_TLS) && !defined(OPENSSL_NO_ENGINE)
static int net__load_engine(struct mosquitto__listener *listener)
{
#if defined(WITH_TLS) && !defined(OPENSSL_NO_ENGINE)
ENGINE *engine = NULL;
UI_METHOD *ui_method;
EVP_PKEY *pkey;
@ -556,10 +558,10 @@ static int net__load_engine(struct mosquitto__listener *listener)
}
}
ENGINE_free(engine); /* release the structural reference from ENGINE_by_id() */
#endif
return MOSQ_ERR_SUCCESS;
}
#endif
int net__tls_load_verify(struct mosquitto__listener *listener)

View File

@ -80,6 +80,8 @@ void *mosquitto_client_certificate(const struct mosquitto *client)
return NULL;
}
#else
UNUSED(client);
return NULL;
#endif
}

View File

@ -106,7 +106,10 @@ int retain__store(const char *topic, struct mosquitto_msg_store *stored, char **
* they aren't for $SYS. */
db.persistence_changes++;
}
#else
UNUSED(topic);
#endif
if(retainhier->retained){
db__msg_store_ref_dec(&retainhier->retained);
#ifdef WITH_SYS_TREE

View File

@ -34,10 +34,11 @@ Contributors:
static void client_cost(FILE *fptr, struct mosquitto *context, int fn_index)
{
size_t pkt_count, pkt_bytes;
size_t cmsg_count, cmsg_bytes;
long pkt_count, pkt_bytes;
long cmsg_count;
long cmsg_bytes;
struct mosquitto__packet *pkt_tmp;
size_t tBytes;
long tBytes;
pkt_count = 1;
pkt_bytes = context->in_packet.packet_length;
@ -52,14 +53,14 @@ static void client_cost(FILE *fptr, struct mosquitto *context, int fn_index)
pkt_tmp = pkt_tmp->next;
}
cmsg_count = (size_t)context->msgs_in.msg_count;
cmsg_count = context->msgs_in.msg_count;
cmsg_bytes = context->msgs_in.msg_bytes;
cmsg_count += (size_t)context->msgs_out.msg_count;
cmsg_count += context->msgs_out.msg_count;
cmsg_bytes += context->msgs_out.msg_bytes;
tBytes = pkt_bytes + cmsg_bytes;
if(context->id){
tBytes += strlen(context->id);
tBytes += (long)strlen(context->id);
}
fprintf(fptr, "%d %ld %lu %lu %lu %lu %d\n", fn_index,
tBytes,