summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordefanor <defanor@uberspace.net>2020-11-23 23:47:02 +0300
committerdefanor <defanor@uberspace.net>2020-11-23 23:47:02 +0300
commit470fda71e045f4921d93977f354a955af6a1195c (patch)
treec94b99509cd90ea77ae78ecb6483ef80422357e5
parentfbda87a3866678a0bf6acf09acd6f50890583be5 (diff)
Use stricter compiler checks
-rw-r--r--src/Makefile.am3
-rw-r--r--src/rexmpp.c14
-rw-r--r--src/rexmpp_console.c1
-rw-r--r--src/rexmpp_openpgp.c4
-rw-r--r--src/rexmpp_roster.c1
-rw-r--r--src/rexmpp_tcp.c1
-rw-r--r--src/rexmpp_tcp.h10
7 files changed, 29 insertions, 5 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 2a0dab0..ac34f06 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,5 @@
-AM_CFLAGS = -Werror -Wall -Wextra -Wno-pointer-sign -Wno-unused-parameter
+AM_CFLAGS = -Werror -Wall -Wextra -pedantic -std=gnu99 \
+ -Wno-pointer-sign
# -Wno-pointer-sign is used to suppress libxml2-related warnings.
# Since we only care about UTF-8, and in almost all cases just its
diff --git a/src/rexmpp.c b/src/rexmpp.c
index 8be0fc4..ded2b67 100644
--- a/src/rexmpp.c
+++ b/src/rexmpp.c
@@ -320,6 +320,7 @@ xmlNodePtr rexmpp_disco_info (rexmpp_t *s) {
}
int rexmpp_sasl_cb (Gsasl *ctx, Gsasl_session *sctx, Gsasl_property prop) {
+ (void)sctx; /* The session should already be in rexmpp_t. */
rexmpp_t *s = gsasl_callback_hook_get(ctx);
if (s == NULL || s->sasl_property_cb == NULL) {
return GSASL_NO_CALLBACK;
@@ -1462,6 +1463,8 @@ void rexmpp_carbons_enabled (rexmpp_t *s,
xmlNodePtr response,
int success)
{
+ (void)req; /* The request is always the same. */
+ (void)response; /* Only checking whether it's a success. */
if (success) {
rexmpp_log(s, LOG_INFO, "carbons enabled");
s->carbons_state = REXMPP_CARBONS_ACTIVE;
@@ -1476,6 +1479,9 @@ void rexmpp_pong (rexmpp_t *s,
xmlNodePtr response,
int success)
{
+ (void)req;
+ (void)response;
+ (void)success;
s->ping_requested = 0;
}
@@ -1484,6 +1490,7 @@ void rexmpp_iq_discovery_info (rexmpp_t *s,
xmlNodePtr response,
int success)
{
+ (void)req;
if (! success) {
rexmpp_log(s, LOG_ERR, "Failed to discover features");
return;
@@ -1554,6 +1561,7 @@ void rexmpp_stream_is_ready(rexmpp_t *s) {
/* Resource binding,
https://tools.ietf.org/html/rfc6120#section-7 */
void rexmpp_bound (rexmpp_t *s, xmlNodePtr req, xmlNodePtr response, int success) {
+ (void)req;
if (! success) {
/* todo: reconnect here? */
rexmpp_log(s, LOG_ERR, "Resource binding failed.");
@@ -2154,6 +2162,11 @@ void rexmpp_sax_start_elem_ns (rexmpp_t *s,
int nb_defaulted,
const char **attributes)
{
+ /* Not checking namespaces beyond URI. */
+ (void)nb_namespaces;
+ (void)namespaces;
+ (void)nb_defaulted;
+
int i;
if (s->stream_state == REXMPP_STREAM_OPENING &&
strcmp(localname, "stream") == 0 &&
@@ -2190,6 +2203,7 @@ void rexmpp_sax_end_elem_ns (rexmpp_t *s,
const char *prefix,
const char *URI)
{
+ (void)prefix; /* Not interested in prefix here. */
if ((s->stream_state == REXMPP_STREAM_CLOSING ||
s->stream_state == REXMPP_STREAM_ERROR) &&
strcmp(localname, "stream") == 0 &&
diff --git a/src/rexmpp_console.c b/src/rexmpp_console.c
index 3bafd88..6b38f65 100644
--- a/src/rexmpp_console.c
+++ b/src/rexmpp_console.c
@@ -128,6 +128,7 @@ void rexmpp_console_on_run (rexmpp_t *s, rexmpp_err_t result) {
void rexmpp_console_feed (rexmpp_t *s, char *str, ssize_t str_len) {
/* todo: buffering */
+ (void)str_len; /* Unused for now (todo). */
char *words_save_ptr;
char *word, *jid_str, *msg_text;
struct rexmpp_jid jid;
diff --git a/src/rexmpp_openpgp.c b/src/rexmpp_openpgp.c
index b7bb493..2721bf9 100644
--- a/src/rexmpp_openpgp.c
+++ b/src/rexmpp_openpgp.c
@@ -24,6 +24,7 @@ void rexmpp_pgp_fp_reply (rexmpp_t *s,
xmlNodePtr response,
int success)
{
+ (void)req; /* Not of interest. */
if (! success) {
rexmpp_log(s, LOG_WARNING, "Failed to retrieve an OpenpPGP key");
return;
@@ -189,6 +190,8 @@ void rexmpp_pgp_key_publish_list_iq (rexmpp_t *s,
xmlNodePtr response,
int success)
{
+ (void)req;
+ (void)response;
if (! success) {
rexmpp_log(s, LOG_WARNING, "Failed to publish an OpenpPGP key list");
return;
@@ -201,6 +204,7 @@ void rexmpp_pgp_key_publish_iq (rexmpp_t *s,
xmlNodePtr response,
int success)
{
+ (void)response;
if (! success) {
rexmpp_log(s, LOG_WARNING, "Failed to publish an OpenpPGP key");
return;
diff --git a/src/rexmpp_roster.c b/src/rexmpp_roster.c
index 3d62613..5012282 100644
--- a/src/rexmpp_roster.c
+++ b/src/rexmpp_roster.c
@@ -142,6 +142,7 @@ void rexmpp_iq_roster_get (rexmpp_t *s,
xmlNodePtr response,
int success)
{
+ (void)req; /* Nothing interesting in the request. */
if (! success) {
rexmpp_log(s, LOG_ERR, "Roster loading failed.");
return;
diff --git a/src/rexmpp_tcp.c b/src/rexmpp_tcp.c
index ac32e57..27c3ba4 100644
--- a/src/rexmpp_tcp.c
+++ b/src/rexmpp_tcp.c
@@ -197,6 +197,7 @@ rexmpp_tcp_conn_proceed (rexmpp_tcp_conn_t *conn,
fd_set *read_fds,
fd_set *write_fds)
{
+ (void)read_fds; /* Not checking any read FDs at the moment. */
struct timeval now;
int i;
diff --git a/src/rexmpp_tcp.h b/src/rexmpp_tcp.h
index c8cbdea..1e13ca3 100644
--- a/src/rexmpp_tcp.h
+++ b/src/rexmpp_tcp.h
@@ -19,13 +19,12 @@
#ifndef REXMPP_TCP_H
#define REXMPP_TCP_H
+#include <sys/time.h>
+
#define REXMPP_TCP_MAX_CONNECTION_ATTEMPTS 20
#define REXMPP_TCP_IPV6_DELAY_MS 50
#define REXMPP_TCP_CONN_DELAY_MS 250
-typedef enum rexmpp_tcp_conn_resolution_status
-rexmpp_tcp_conn_resolution_status_t;
-
/**
@brief Resolution status.
*/
@@ -40,7 +39,8 @@ enum rexmpp_tcp_conn_resolution_status {
REXMPP_CONN_RESOLUTION_FAILURE
};
-typedef enum rexmpp_tcp_conn_error rexmpp_tcp_conn_error_t;
+typedef enum rexmpp_tcp_conn_resolution_status
+rexmpp_tcp_conn_resolution_status_t;
/**
@brief Connection errors.
@@ -59,6 +59,8 @@ enum rexmpp_tcp_conn_error {
REXMPP_CONN_ERROR
};
+typedef enum rexmpp_tcp_conn_error rexmpp_tcp_conn_error_t;
+
typedef struct rexmpp_tcp_connection rexmpp_tcp_conn_t;
/** @brief A connection establishment structure. */