aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-04-14 10:49:26 +0100
committerGitHub <noreply@github.com>2020-04-14 10:49:26 +0100
commit13724fefdc9dbc31609938c06d6c99ba47d1729d (patch)
treed3ac8a5c59504a0362d0a692069f9b20973e3edf
parent29f38bde308faed44b6298338451fb7b82923c65 (diff)
parentb29b85055e05b1e2f5112ca93c7c6b4673ff42ca (diff)
downloadrspamd-13724fefdc9dbc31609938c06d6c99ba47d1729d.tar.gz
rspamd-13724fefdc9dbc31609938c06d6c99ba47d1729d.zip
Merge pull request #3332 from cgzones/compiler_new
Resolve various Compiler warnings
-rw-r--r--cmake/CompilerWarnings.cmake8
-rw-r--r--cmake/Toolset.cmake3
-rw-r--r--contrib/hiredis/async.h6
-rw-r--r--contrib/hiredis/hiredis.h18
-rw-r--r--contrib/hiredis/sds.h3
-rw-r--r--contrib/kann/kann.c6
-rw-r--r--contrib/kann/kautodiff.c24
-rw-r--r--contrib/libev/ev.c14
-rw-r--r--contrib/librdns/dns_private.h3
-rw-r--r--contrib/librdns/logger.h6
-rw-r--r--contrib/librdns/resolver.c6
-rw-r--r--contrib/replxx/include/replxx.h3
-rw-r--r--contrib/replxx/include/replxx.hxx3
-rw-r--r--contrib/snowball/compiler/driver.c1
-rw-r--r--contrib/uthash/utstring.h3
-rw-r--r--src/controller.c1
-rw-r--r--src/fuzzy_storage.c1
-rw-r--r--src/libcryptobox/cryptobox.c1
-rw-r--r--src/libserver/logger/logger_private.h6
-rw-r--r--src/libserver/re_cache.c2
-rw-r--r--src/libserver/rspamd_control.c4
-rw-r--r--src/libserver/url.c5
-rw-r--r--src/libstat/backends/redis_backend.c9
-rw-r--r--src/libutil/multipattern.c6
-rw-r--r--src/libutil/sqlite_utils.c2
-rw-r--r--src/lua/lua_cryptobox.c4
-rw-r--r--src/lua/lua_task.c4
-rw-r--r--src/lua/lua_worker.c4
-rw-r--r--src/rspamadm/configdump.c1
-rw-r--r--src/rspamadm/confighelp.c1
-rw-r--r--src/rspamd_proxy.c1
-rw-r--r--src/worker.c1
32 files changed, 116 insertions, 44 deletions
diff --git a/cmake/CompilerWarnings.cmake b/cmake/CompilerWarnings.cmake
index 4dd011d98..fe6735c35 100644
--- a/cmake/CompilerWarnings.cmake
+++ b/cmake/CompilerWarnings.cmake
@@ -10,6 +10,8 @@ CHECK_C_COMPILER_FLAG(-Wno-sign-compare SUPPORT_WSIGN_COMPARE)
CHECK_C_COMPILER_FLAG(-Wstrict-prototypes SUPPORT_WSTRICT_PROTOTYPES)
CHECK_C_COMPILER_FLAG(-pedantic SUPPORT_PEDANTIC_FLAG)
CHECK_C_COMPILER_FLAG(-Wno-unused-const-variable SUPPORT_WNO_UNUSED_CONST)
+CHECK_C_COMPILER_FLAG(-Wmissing-noreturn SUPPORT_WMISSING_NORETURN)
+CHECK_C_COMPILER_FLAG(-Wmissing-format-attribute SUPPORT_WMISSING_FORMAT_ATTRIBUTE)
# GCC 6 specific
CHECK_C_COMPILER_FLAG(-Wnull-dereference SUPPORT_WNULL_DEREFERENCE)
CHECK_C_COMPILER_FLAG(-Wduplicated-cond SUPPORT_WDUPLICATED_COND)
@@ -67,6 +69,12 @@ ENDIF()
IF(SUPPORT_WIMPLICIT_FALLTHROUGH)
ADD_COMPILE_OPTIONS("-Wno-implicit-fallthrough")
ENDIF(SUPPORT_WIMPLICIT_FALLTHROUGH)
+IF(SUPPORT_WMISSING_NORETURN)
+ ADD_COMPILE_OPTIONS("-Wmissing-noreturn")
+ENDIF(SUPPORT_WMISSING_NORETURN)
+IF(SUPPORT_WMISSING_FORMAT_ATTRIBUTE)
+ ADD_COMPILE_OPTIONS("-Wmissing-format-attribute")
+ENDIF(SUPPORT_WMISSING_FORMAT_ATTRIBUTE)
CHECK_C_COMPILER_FLAG(-fPIC SUPPORT_FPIC)
IF(SUPPORT_FPIC)
diff --git a/cmake/Toolset.cmake b/cmake/Toolset.cmake
index 638dca9e1..8539dbe0a 100644
--- a/cmake/Toolset.cmake
+++ b/cmake/Toolset.cmake
@@ -175,6 +175,7 @@ option(ENABLE_LTO "Build rspamd with Link Time Optimization if supported [
if (CMAKE_BUILD_TYPE_UC MATCHES "COVERAGE")
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
+ message (STATUS "IPO not enabled for COVERAGE build")
elseif (ENABLE_LTO)
if (${CMAKE_VERSION} VERSION_GREATER "3.9.0")
cmake_policy (SET CMP0069 NEW)
@@ -187,6 +188,8 @@ elseif (ENABLE_LTO)
message(WARNING "IPO is not supported: ${LTO_DIAG}")
endif ()
endif ()
+else ()
+ message (STATUS "IPO not enabled for the ${CMAKE_BUILD_TYPE} build")
endif ()
message (STATUS "Final CFLAGS: ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UC}}")
diff --git a/contrib/hiredis/async.h b/contrib/hiredis/async.h
index 3d20241c6..40a5a49c8 100644
--- a/contrib/hiredis/async.h
+++ b/contrib/hiredis/async.h
@@ -119,7 +119,13 @@ void redisAsyncHandleWrite(redisAsyncContext *ac);
/* Command functions for an async context. Write the command to the
* output buffer and register the provided callback. */
+#ifdef __GNUC__
+__attribute__((format(printf, 4, 0)))
+#endif
int redisvAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, const char *format, va_list ap);
+#ifdef __GNUC__
+__attribute__((format(printf, 4, 5)))
+#endif
int redisAsyncCommand(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, const char *format, ...);
int redisAsyncCommandArgv(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, int argc, const char **argv, const size_t *argvlen);
int redisAsyncFormattedCommand(redisAsyncContext *ac, redisCallbackFn *fn, void *privdata, const char *cmd, size_t len);
diff --git a/contrib/hiredis/hiredis.h b/contrib/hiredis/hiredis.h
index 153bfd7a6..6b531b910 100644
--- a/contrib/hiredis/hiredis.h
+++ b/contrib/hiredis/hiredis.h
@@ -125,7 +125,13 @@ redisReader *redisReaderCreate(void);
void freeReplyObject(void *reply);
/* Functions to format a command according to the protocol. */
+#ifdef __GNUC__
+__attribute__((format(printf, 2, 0)))
+#endif
int redisvFormatCommand(char **target, const char *format, va_list ap);
+#ifdef __GNUC__
+__attribute__((format(printf, 2, 3)))
+#endif
int redisFormatCommand(char **target, const char *format, ...);
int redisFormatCommandArgv(char **target, int argc, const char **argv, const size_t *argvlen);
int redisFormatSdsCommandArgv(sds *target, int argc, const char ** argv, const size_t *argvlen);
@@ -204,7 +210,13 @@ int redisAppendFormattedCommand(redisContext *c, const char *cmd, size_t len);
/* Write a command to the output buffer. Use these functions in blocking mode
* to get a pipeline of commands. */
+#ifdef __GNUC__
+__attribute__((format(printf, 2, 0)))
+#endif
int redisvAppendCommand(redisContext *c, const char *format, va_list ap);
+#ifdef __GNUC__
+__attribute__((format(printf, 2, 3)))
+#endif
int redisAppendCommand(redisContext *c, const char *format, ...);
int redisAppendCommandArgv(redisContext *c, int argc, const char **argv, const size_t *argvlen);
@@ -213,7 +225,13 @@ int redisAppendCommandArgv(redisContext *c, int argc, const char **argv, const s
* NULL if there was an error in performing the request, otherwise it will
* return the reply. In a non-blocking context, it is identical to calling
* only redisAppendCommand and will always return NULL. */
+#ifdef __GNUC__
+__attribute__((format(printf, 2, 0)))
+#endif
void *redisvCommand(redisContext *c, const char *format, va_list ap);
+#ifdef __GNUC__
+__attribute__((format(printf, 2, 3)))
+#endif
void *redisCommand(redisContext *c, const char *format, ...);
void *redisCommandArgv(redisContext *c, int argc, const char **argv, const size_t *argvlen);
diff --git a/contrib/hiredis/sds.h b/contrib/hiredis/sds.h
index 19a2abd31..a494f2efc 100644
--- a/contrib/hiredis/sds.h
+++ b/contrib/hiredis/sds.h
@@ -71,6 +71,9 @@ sds sdscatsds(sds s, const sds t);
sds sdscpylen(sds s, const char *t, size_t len);
sds sdscpy(sds s, const char *t);
+#ifdef __GNUC__
+__attribute__((format(printf, 2, 0)))
+#endif
sds sdscatvprintf(sds s, const char *fmt, va_list ap);
#ifdef __GNUC__
sds sdscatprintf(sds s, const char *fmt, ...)
diff --git a/contrib/kann/kann.c b/contrib/kann/kann.c
index 76ade6a52..72fb0c061 100644
--- a/contrib/kann/kann.c
+++ b/contrib/kann/kann.c
@@ -496,7 +496,7 @@ kann_t *kann_load_fp(FILE *fp)
kann_t *ann;
int n_var, n_const;
- fread(magic, 1, 4, fp);
+ (void) !fread(magic, 1, 4, fp);
if (strncmp(magic, KANN_MAGIC, 4) != 0) {
fclose(fp);
return 0;
@@ -508,8 +508,8 @@ kann_t *kann_load_fp(FILE *fp)
ann->x = (float*)malloc(n_var * sizeof(float));
ann->g = (float*)calloc(n_var, sizeof(float));
ann->c = (float*)malloc(n_const * sizeof(float));
- fread(ann->x, sizeof(float), n_var, fp);
- fread(ann->c, sizeof(float), n_const, fp);
+ (void) !fread(ann->x, sizeof(float), n_var, fp);
+ (void) !fread(ann->c, sizeof(float), n_const, fp);
kad_ext_sync(ann->n, ann->v, ann->x, ann->g, ann->c);
return ann;
}
diff --git a/contrib/kann/kautodiff.c b/contrib/kann/kautodiff.c
index bc9458f42..47a86a71e 100644
--- a/contrib/kann/kautodiff.c
+++ b/contrib/kann/kautodiff.c
@@ -617,28 +617,28 @@ static kad_node_t *kad_load1(FILE *fp, kad_node_t **node)
{
kad_node_t *p;
p = (kad_node_t*)calloc(1, sizeof(kad_node_t));
- fread(&p->ext_label, 4, 1, fp);
- fread(&p->ext_flag, 4, 1, fp);
- fread(&p->flag, 1, 1, fp);
- fread(&p->n_child, 4, 1, fp);
+ (void) !fread(&p->ext_label, 4, 1, fp);
+ (void) !fread(&p->ext_flag, 4, 1, fp);
+ (void) !fread(&p->flag, 1, 1, fp);
+ (void) !fread(&p->n_child, 4, 1, fp);
if (p->n_child) {
int32_t j, k;
p->child = (kad_node_t**)calloc(p->n_child, sizeof(kad_node_t*));
- fread(&p->op, 2, 1, fp);
+ (void) !fread(&p->op, 2, 1, fp);
for (j = 0; j < p->n_child; ++j) {
- fread(&k, 4, 1, fp);
+ (void) !fread(&k, 4, 1, fp);
p->child[j] = node? node[k] : 0;
}
- fread(&k, 4, 1, fp);
+ (void) !fread(&k, 4, 1, fp);
if (k >= 0) p->pre = node[k];
- fread(&p->ptr_size, 4, 1, fp);
+ (void) !fread(&p->ptr_size, 4, 1, fp);
if (p->ptr_size > 0) {
p->ptr = malloc(p->ptr_size);
- fread(p->ptr, p->ptr_size, 1, fp);
+ (void) !fread(p->ptr, p->ptr_size, 1, fp);
}
} else {
- fread(&p->n_d, 1, 1, fp);
- if (p->n_d) fread(p->d, 4, p->n_d, fp);
+ (void) !fread(&p->n_d, 1, 1, fp);
+ if (p->n_d) (void) !fread(p->d, 4, p->n_d, fp);
}
return p;
}
@@ -657,7 +657,7 @@ kad_node_t **kad_load(FILE *fp, int *_n_node)
{
int32_t i, n_node;
kad_node_t **node;
- fread(&n_node, 4, 1, fp);
+ (void) !fread(&n_node, 4, 1, fp);
node = (kad_node_t**)malloc(n_node * sizeof(kad_node_t*));
for (i = 0; i < n_node; ++i) {
kad_node_t *p;
diff --git a/contrib/libev/ev.c b/contrib/libev/ev.c
index 12eafd8a4..e569a010c 100644
--- a/contrib/libev/ev.c
+++ b/contrib/libev/ev.c
@@ -2808,7 +2808,7 @@ evpipe_write (EV_P_ EV_ATOMIC_T *flag)
if (evpipe [0] < 0)
{
uint64_t counter = 1;
- write (evpipe [1], &counter, sizeof (uint64_t));
+ (void) !write (evpipe [1], &counter, sizeof (uint64_t));
}
else
#endif
@@ -2820,7 +2820,7 @@ evpipe_write (EV_P_ EV_ATOMIC_T *flag)
buf.len = 1;
WSASend (EV_FD_TO_WIN32_HANDLE (evpipe [1]), &buf, 1, &sent, 0, 0, 0);
#else
- write (evpipe [1], &(evpipe [1]), 1);
+ (void) !write (evpipe [1], &(evpipe [1]), 1);
#endif
}
@@ -2841,7 +2841,7 @@ pipecb (EV_P_ ev_io *iow, int revents)
if (evpipe [0] < 0)
{
uint64_t counter;
- read (evpipe [1], &counter, sizeof (uint64_t));
+ (void) !read (evpipe [1], &counter, sizeof (uint64_t));
}
else
#endif
@@ -2855,7 +2855,7 @@ pipecb (EV_P_ ev_io *iow, int revents)
buf.len = sizeof (dummy);
WSARecv (EV_FD_TO_WIN32_HANDLE (evpipe [0]), &buf, 1, &recvd, &flags, 0, 0);
#else
- read (evpipe [0], &dummy, sizeof (dummy));
+ (void) !read (evpipe [0], &dummy, sizeof (dummy));
#endif
}
}
@@ -4388,7 +4388,7 @@ ev_io_start (EV_P_ ev_io *w) EV_NOEXCEPT
/* common bug, apparently */
assert (("libev: ev_io_start called with corrupted watcher", ((WL)w)->next != (WL)w));
- fd_change (EV_A_ fd, w->events & EV__IOFDSET | EV_ANFD_REIFY);
+ fd_change (EV_A_ fd, (w->events & EV__IOFDSET) | EV_ANFD_REIFY);
w->events &= ~EV__IOFDSET;
EV_FREQUENT_CHECK;
@@ -5652,8 +5652,8 @@ ev_walk (EV_P_ int types, void (*cb)(EV_P_ int type, void *w)) EV_NOEXCEPT
wl = wn;
}
#endif
-/* EV_STAT 0x00001000 /* stat data changed */
-/* EV_EMBED 0x00010000 /* embedded event loop needs sweep */
+// EV_STAT 0x00001000 /* stat data changed */
+// EV_EMBED 0x00010000 /* embedded event loop needs sweep */
}
#endif
void
diff --git a/contrib/librdns/dns_private.h b/contrib/librdns/dns_private.h
index f734e2312..3f0bee437 100644
--- a/contrib/librdns/dns_private.h
+++ b/contrib/librdns/dns_private.h
@@ -138,6 +138,9 @@ struct rdns_resolver {
struct rdns_plugin *curve_plugin;
struct rdns_fake_reply *fake_elts;
+#ifdef __GNUC__
+ __attribute__((format(printf, 4, 0)))
+#endif
rdns_log_function logger;
void *log_data;
enum rdns_log_level log_level;
diff --git a/contrib/librdns/logger.h b/contrib/librdns/logger.h
index f9c33bbe4..80728763e 100644
--- a/contrib/librdns/logger.h
+++ b/contrib/librdns/logger.h
@@ -26,10 +26,16 @@
#include <stdarg.h>
#include "dns_private.h"
+#ifdef __GNUC__
+__attribute__((format(printf, 4, 0)))
+#endif
void rdns_logger_internal (void *log_data, enum rdns_log_level level,
const char *function, const char *format,
va_list args);
+#ifdef __GNUC__
+__attribute__((format(printf, 4, 5)))
+#endif
void rdns_logger_helper (struct rdns_resolver *resolver,
enum rdns_log_level level,
const char *function, const char *format, ...);
diff --git a/contrib/librdns/resolver.c b/contrib/librdns/resolver.c
index aec0e9381..98807f38e 100644
--- a/contrib/librdns/resolver.c
+++ b/contrib/librdns/resolver.c
@@ -758,14 +758,14 @@ rdns_make_request_full (
type = req->requested_names[i].type;
if (queries > 1) {
if (!rdns_add_rr (req, cur_name, clen, type, &comp)) {
- rdns_err ("cannot add rr", cur_name);
+ rdns_err ("cannot add rr");
REF_RELEASE (req);
rnds_compression_free (comp);
return NULL;
}
} else {
if (!rdns_add_rr (req, cur_name, clen, type, NULL)) {
- rdns_err ("cannot add rr", cur_name);
+ rdns_err ("cannot add rr");
REF_RELEASE (req);
rnds_compression_free (comp);
return NULL;
@@ -1125,4 +1125,4 @@ void rdns_resolver_set_fake_reply (struct rdns_resolver *resolver,
HASH_ADD (hh, resolver->fake_elts, key, sizeof (*srch) + len, fake_rep);
}
-} \ No newline at end of file
+}
diff --git a/contrib/replxx/include/replxx.h b/contrib/replxx/include/replxx.h
index cb1c917b4..4bdad5127 100644
--- a/contrib/replxx/include/replxx.h
+++ b/contrib/replxx/include/replxx.h
@@ -356,6 +356,9 @@ REPLXX_IMPEXP void replxx_set_state( Replxx*, ReplxxState* state );
*
* \param fmt - printf style format.
*/
+#ifdef __GNUC__
+__attribute__((format(printf, 2, 3)))
+#endif
REPLXX_IMPEXP int replxx_print( Replxx*, char const* fmt, ... );
/*! \brief Schedule an emulated key press event.
diff --git a/contrib/replxx/include/replxx.hxx b/contrib/replxx/include/replxx.hxx
index 3fe90e670..1401ea27c 100644
--- a/contrib/replxx/include/replxx.hxx
+++ b/contrib/replxx/include/replxx.hxx
@@ -370,6 +370,9 @@ public:
*
* \param fmt - printf style format.
*/
+#ifdef __GNUC__
+ __attribute__((format(printf, 2, 3)))
+#endif
void print( char const* fmt, ... );
/*! \brief Schedule an emulated key press event.
diff --git a/contrib/snowball/compiler/driver.c b/contrib/snowball/compiler/driver.c
index 9cbe447a5..587028fa4 100644
--- a/contrib/snowball/compiler/driver.c
+++ b/contrib/snowball/compiler/driver.c
@@ -25,6 +25,7 @@ static int eq(const char * s1, const char * s2) {
return strcmp(s1, s2) == 0;
}
+__attribute__((noreturn))
static void print_arglist(int exit_code) {
FILE * f = exit_code ? stderr : stdout;
fprintf(f, "Usage: snowball SOURCE_FILE... [OPTIONS]\n\n"
diff --git a/contrib/uthash/utstring.h b/contrib/uthash/utstring.h
index f11f34b77..6130fac53 100644
--- a/contrib/uthash/utstring.h
+++ b/contrib/uthash/utstring.h
@@ -120,6 +120,9 @@ do { \
#define utstring_body(s) ((s)->d)
+#ifdef __GNUC__
+__attribute__((format(printf, 2, 0)))
+#endif
_UNUSED_ static void utstring_printf_va(UT_string *s, const char *fmt, va_list ap) {
int n;
va_list cp;
diff --git a/src/controller.c b/src/controller.c
index cfea10971..4ed3f187c 100644
--- a/src/controller.c
+++ b/src/controller.c
@@ -3477,6 +3477,7 @@ rspamd_controller_register_plugins_paths (struct rspamd_controller_worker_ctx *c
/*
* Start worker process
*/
+__attribute__((noreturn))
void
start_controller_worker (struct rspamd_worker *worker)
{
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c
index b6d7d8ee7..5eb403ce7 100644
--- a/src/fuzzy_storage.c
+++ b/src/fuzzy_storage.c
@@ -2120,6 +2120,7 @@ fuzzy_peer_rep (struct rspamd_worker *worker,
/*
* Start worker process
*/
+__attribute__((noreturn))
void
start_fuzzy (struct rspamd_worker *worker)
{
diff --git a/src/libcryptobox/cryptobox.c b/src/libcryptobox/cryptobox.c
index 414dbdfa1..4ef366b33 100644
--- a/src/libcryptobox/cryptobox.c
+++ b/src/libcryptobox/cryptobox.c
@@ -93,6 +93,7 @@ rspamd_cryptobox_cpuid (gint cpu[4], gint info)
static sig_atomic_t ok = 0;
static jmp_buf j;
+__attribute__((noreturn))
static void
rspamd_cryptobox_ill_handler (int signo)
{
diff --git a/src/libserver/logger/logger_private.h b/src/libserver/logger/logger_private.h
index 5fc258914..79831f2ee 100644
--- a/src/libserver/logger/logger_private.h
+++ b/src/libserver/logger/logger_private.h
@@ -103,7 +103,7 @@ bool rspamd_log_file_log (const gchar *module, const gchar *id,
bool rspamd_log_file_on_fork (rspamd_logger_t *logger, struct rspamd_config *cfg,
gpointer arg, GError **err);
-const static struct rspamd_logger_funcs file_log_funcs = {
+static const struct rspamd_logger_funcs file_log_funcs = {
.init = rspamd_log_file_init,
.dtor = rspamd_log_file_dtor,
.reload = rspamd_log_file_reload,
@@ -127,7 +127,7 @@ bool rspamd_log_syslog_log (const gchar *module, const gchar *id,
rspamd_logger_t *rspamd_log,
gpointer arg);
-const static struct rspamd_logger_funcs syslog_log_funcs = {
+static const struct rspamd_logger_funcs syslog_log_funcs = {
.init = rspamd_log_syslog_init,
.dtor = rspamd_log_syslog_dtor,
.reload = rspamd_log_syslog_reload,
@@ -151,7 +151,7 @@ bool rspamd_log_console_log (const gchar *module, const gchar *id,
rspamd_logger_t *rspamd_log,
gpointer arg);
-const static struct rspamd_logger_funcs console_log_funcs = {
+static const struct rspamd_logger_funcs console_log_funcs = {
.init = rspamd_log_console_init,
.dtor = rspamd_log_console_dtor,
.reload = rspamd_log_console_reload,
diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c
index 6dc13220b..fe5e1476b 100644
--- a/src/libserver/re_cache.c
+++ b/src/libserver/re_cache.c
@@ -391,7 +391,7 @@ rspamd_re_cache_init (struct rspamd_re_cache *cache, struct rspamd_config *cfg)
rspamd_regexp_set_cache_id (re, i);
if (re_class->st == NULL) {
- posix_memalign ((void **)&re_class->st, _Alignof (rspamd_cryptobox_hash_state_t),
+ (void) !posix_memalign ((void **)&re_class->st, _Alignof (rspamd_cryptobox_hash_state_t),
sizeof (*re_class->st));
g_assert (re_class->st != NULL);
rspamd_cryptobox_hash_init (re_class->st, NULL, 0);
diff --git a/src/libserver/rspamd_control.c b/src/libserver/rspamd_control.c
index 0dc04d291..2670263f3 100644
--- a/src/libserver/rspamd_control.c
+++ b/src/libserver/rspamd_control.c
@@ -781,7 +781,7 @@ rspamd_control_ignore_io_handler (int fd, short what, void *ud)
struct rspamd_control_reply rep;
/* At this point we just ignore replies from the workers */
- (void)read (fd, &rep, sizeof (rep));
+ (void) !read (fd, &rep, sizeof (rep));
rspamd_control_stop_pending (elt);
}
@@ -793,7 +793,7 @@ rspamd_control_log_pipe_io_handler (int fd, short what, void *ud)
struct rspamd_control_reply rep;
/* At this point we just ignore replies from the workers */
- (void) read (fd, &rep, sizeof (rep));
+ (void) !read (fd, &rep, sizeof (rep));
rspamd_control_stop_pending (elt);
}
diff --git a/src/libserver/url.c b/src/libserver/url.c
index 6aceb8fa6..db89073f5 100644
--- a/src/libserver/url.c
+++ b/src/libserver/url.c
@@ -3941,11 +3941,10 @@ bool
rspamd_url_host_set_add (khash_t (rspamd_url_host_hash) *set,
struct rspamd_url *u)
{
- khiter_t k;
gint r;
if (set) {
- k = kh_put (rspamd_url_host_hash, set, u, &r);
+ kh_put (rspamd_url_host_hash, set, u, &r);
if (r == 0) {
return false;
@@ -3991,4 +3990,4 @@ rspamd_url_host_set_has (khash_t (rspamd_url_host_hash) *set, struct rspamd_url
}
return false;
-} \ No newline at end of file
+}
diff --git a/src/libstat/backends/redis_backend.c b/src/libstat/backends/redis_backend.c
index 107af3490..392f1704e 100644
--- a/src/libstat/backends/redis_backend.c
+++ b/src/libstat/backends/redis_backend.c
@@ -372,6 +372,12 @@ rspamd_redis_maybe_auth (struct redis_stat_ctx *ctx, redisAsyncContext *redis)
}
}
+// the `b` conversion type character is unknown to gcc
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat"
+#pragma GCC diagnostic ignored "-Wformat-extra-args"
+#endif
static rspamd_fstring_t *
rspamd_redis_tokens_to_query (struct rspamd_task *task,
struct redis_stat_runtime *rt,
@@ -625,6 +631,9 @@ rspamd_redis_tokens_to_query (struct rspamd_task *task,
return out;
}
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif
static void
rspamd_redis_store_stat_signature (struct rspamd_task *task,
diff --git a/src/libutil/multipattern.c b/src/libutil/multipattern.c
index 547762d26..8ddd9af38 100644
--- a/src/libutil/multipattern.c
+++ b/src/libutil/multipattern.c
@@ -256,7 +256,7 @@ rspamd_multipattern_create (enum rspamd_multipattern_flags flags)
struct rspamd_multipattern *mp;
/* Align due to blake2b state */
- posix_memalign((void **)&mp, _Alignof (struct rspamd_multipattern),
+ (void) !posix_memalign((void **)&mp, _Alignof (struct rspamd_multipattern),
sizeof (*mp));
g_assert (mp != NULL);
memset (mp, 0, sizeof (*mp));
@@ -285,7 +285,7 @@ rspamd_multipattern_create_sized (guint npatterns,
struct rspamd_multipattern *mp;
/* Align due to blake2b state */
- posix_memalign((void **)&mp, _Alignof (struct rspamd_multipattern), sizeof (*mp));
+ (void) !posix_memalign((void **)&mp, _Alignof (struct rspamd_multipattern), sizeof (*mp));
g_assert (mp != NULL);
memset (mp, 0, sizeof (*mp));
mp->flags = flags;
@@ -789,4 +789,4 @@ gboolean
rspamd_multipattern_has_hyperscan (void)
{
return rspamd_hs_check ();
-} \ No newline at end of file
+}
diff --git a/src/libutil/sqlite_utils.c b/src/libutil/sqlite_utils.c
index 9bb0b9c1f..f9e47032c 100644
--- a/src/libutil/sqlite_utils.c
+++ b/src/libutil/sqlite_utils.c
@@ -356,7 +356,7 @@ rspamd_sqlite3_open_or_create (rspamd_mempool_t *pool, const gchar *path, const
else {
pid_t myself = getpid ();
msg_debug_pool_check ("locking %s to block other processes", lock_path);
- (void)write (lock_fd, &myself, sizeof (myself));
+ (void) !write (lock_fd, &myself, sizeof (myself));
g_assert (rspamd_file_lock (lock_fd, FALSE));
has_lock = TRUE;
diff --git a/src/lua/lua_cryptobox.c b/src/lua/lua_cryptobox.c
index 07b4888b9..784abea65 100644
--- a/src/lua/lua_cryptobox.c
+++ b/src/lua/lua_cryptobox.c
@@ -1008,7 +1008,7 @@ rspamd_lua_hash_create (const gchar *type)
}
else if (g_ascii_strcasecmp (type, "blake2") == 0) {
h->type = LUA_CRYPTOBOX_HASH_BLAKE2;
- posix_memalign ((void **)&h->content.h, _Alignof (rspamd_cryptobox_hash_state_t),
+ (void) !posix_memalign ((void **)&h->content.h, _Alignof (rspamd_cryptobox_hash_state_t),
sizeof (*h->content.h));
g_assert (h->content.h != NULL);
rspamd_cryptobox_hash_init (h->content.h, NULL, 0);
@@ -1045,7 +1045,7 @@ rspamd_lua_hash_create (const gchar *type)
}
else {
h->type = LUA_CRYPTOBOX_HASH_BLAKE2;
- posix_memalign ((void **)&h->content.h, _Alignof (rspamd_cryptobox_hash_state_t),
+ (void) !posix_memalign ((void **)&h->content.h, _Alignof (rspamd_cryptobox_hash_state_t),
sizeof (*h->content.h));
g_assert (h->content.h != NULL);
rspamd_cryptobox_hash_init (h->content.h, NULL, 0);
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 2d6257443..6f1eeaf3f 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -2423,13 +2423,13 @@ lua_task_has_urls (lua_State * L)
{
LUA_TRACE_POINT;
struct rspamd_task *task = lua_check_task (L, 1);
- gboolean need_emails = FALSE, ret = FALSE;
+ gboolean ret = FALSE;
gsize sz = 0;
if (task) {
if (task->message) {
if (lua_gettop (L) >= 2) {
- need_emails = lua_toboolean (L, 2);
+ lua_toboolean (L, 2);
}
if (kh_size (MESSAGE_FIELD (task, urls)) > 0) {
diff --git a/src/lua/lua_worker.c b/src/lua/lua_worker.c
index a286069cb..badc50a72 100644
--- a/src/lua/lua_worker.c
+++ b/src/lua/lua_worker.c
@@ -746,7 +746,7 @@ rspamd_lua_subprocess_io (EV_P_ ev_io *w, int revents)
/* Write reply to the child */
rspamd_socket_blocking (cbdata->sp[0]);
memset (rep, 0, sizeof (rep));
- (void)write (cbdata->sp[0], rep, sizeof (rep));
+ (void) !write (cbdata->sp[0], rep, sizeof (rep));
}
}
}
@@ -891,4 +891,4 @@ void
luaopen_worker (lua_State * L)
{
rspamd_lua_new_class (L, "rspamd{worker}", worker_reg);
-} \ No newline at end of file
+}
diff --git a/src/rspamadm/configdump.c b/src/rspamadm/configdump.c
index 90f751487..bbdb58c17 100644
--- a/src/rspamadm/configdump.c
+++ b/src/rspamadm/configdump.c
@@ -230,6 +230,7 @@ rspamadm_dump_section_obj (struct rspamd_config *cfg,
}
}
+__attribute__((noreturn))
static void
rspamadm_configdump (gint argc, gchar **argv, const struct rspamadm_command *cmd)
{
diff --git a/src/rspamadm/confighelp.c b/src/rspamadm/confighelp.c
index f5695ed53..c40891216 100644
--- a/src/rspamadm/confighelp.c
+++ b/src/rspamadm/confighelp.c
@@ -190,6 +190,7 @@ rspamadm_confighelp_search_word (const ucl_object_t *obj, const gchar *str)
return res;
}
+__attribute__((noreturn))
static void
rspamadm_confighelp (gint argc, gchar **argv, const struct rspamadm_command *cmd)
{
diff --git a/src/rspamd_proxy.c b/src/rspamd_proxy.c
index ffcbf5824..83ae3785c 100644
--- a/src/rspamd_proxy.c
+++ b/src/rspamd_proxy.c
@@ -2282,6 +2282,7 @@ adjust_upstreams_limits (struct rspamd_proxy_ctx *ctx)
}
}
+__attribute__((noreturn))
void
start_rspamd_proxy (struct rspamd_worker *worker)
{
diff --git a/src/worker.c b/src/worker.c
index ad7f12674..1a3b118c8 100644
--- a/src/worker.c
+++ b/src/worker.c
@@ -477,6 +477,7 @@ init_worker (struct rspamd_config *cfg)
/*
* Start worker process
*/
+__attribute__((noreturn))
void
start_worker (struct rspamd_worker *worker)
{