commit d7738db: [Minor] Fix some compiler warnings

Duncan Bellamy dunk at denkimushi.com
Tue Dec 29 23:35:06 UTC 2020


Author: Duncan Bellamy
Date: 2020-12-27 22:41:12 +0000
URL: https://github.com/rspamd/rspamd/commit/d7738db6970c4cd838be067293abcdb5abc6a71c (refs/pull/3589/head)

[Minor] Fix some compiler warnings

---
 CMakeLists.txt               | 2 ++
 contrib/mumhash/mum.h        | 2 +-
 src/fuzzy_storage.c          | 4 ++--
 src/libcryptobox/cryptobox.c | 2 +-
 src/libserver/re_cache.c     | 2 +-
 src/rspamd.c                 | 2 +-
 6 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 076656dee..72382acb6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,6 +23,8 @@ SET(RSPAMD_VERSION         "${RSPAMD_VERSION_MAJOR}.${RSPAMD_VERSION_MINOR}")
 
 PROJECT(rspamd VERSION "${RSPAMD_VERSION}" LANGUAGES C CXX ASM)
 
+CMAKE_POLICY(SET CMP0075 NEW)
+
 # This is supported merely with cmake 3.1
 SET(CMAKE_C_STANDARD 11)
 SET(CMAKE_C_STANDARD_REQUIRED ON)
diff --git a/contrib/mumhash/mum.h b/contrib/mumhash/mum.h
index 24584f291..52b7845f0 100644
--- a/contrib/mumhash/mum.h
+++ b/contrib/mumhash/mum.h
@@ -115,7 +115,7 @@ _mum (uint64_t v, uint64_t p) {
      multiplication.  If we use a generic code we actually call a
      function doing 128x128->128 bit multiplication.  The function is
      very slow.  */
-  lo = v * p, hi;
+  lo = v * p;
   __asm__ ("umulh %0, %1, %2" : "=r" (hi) : "r" (v), "r" (p));
 #else
   __uint128_t r = (__uint128_t) v * (__uint128_t) p;
diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c
index 6d046fcdb..316e19d0e 100644
--- a/src/fuzzy_storage.c
+++ b/src/fuzzy_storage.c
@@ -807,7 +807,7 @@ static void
 rspamd_fuzzy_check_callback (struct rspamd_fuzzy_reply *result, void *ud)
 {
 	struct fuzzy_session *session = ud;
-	gboolean encrypted = FALSE, is_shingle = FALSE;
+	gboolean is_shingle = FALSE, __attribute__ ((unused)) encrypted = FALSE;
 	struct rspamd_fuzzy_cmd *cmd = NULL;
 	const struct rspamd_shingle *shingle = NULL;
 	struct rspamd_shingle sgl_cpy;
@@ -970,7 +970,7 @@ rspamd_fuzzy_check_callback (struct rspamd_fuzzy_reply *result, void *ud)
 static void
 rspamd_fuzzy_process_command (struct fuzzy_session *session)
 {
-	gboolean encrypted = FALSE, is_shingle = FALSE;
+	gboolean is_shingle = FALSE, __attribute__ ((unused)) encrypted = FALSE;
 	struct rspamd_fuzzy_cmd *cmd = NULL;
 	struct rspamd_fuzzy_reply result;
 	struct fuzzy_peer_cmd up_cmd;
diff --git a/src/libcryptobox/cryptobox.c b/src/libcryptobox/cryptobox.c
index cb875c026..e592eccdf 100644
--- a/src/libcryptobox/cryptobox.c
+++ b/src/libcryptobox/cryptobox.c
@@ -70,7 +70,7 @@ static const guchar n0[16] = {0};
 static void
 rspamd_cryptobox_cpuid (gint cpu[4], gint info)
 {
-	guint32 eax, ecx = 0, ebx = 0, edx = 0;
+	guint32 __attribute__ ((unused)) eax, __attribute__ ((unused)) ecx = 0, __attribute__ ((unused)) ebx = 0, __attribute__ ((unused)) edx = 0;
 
 	eax = info;
 #if defined(__GNUC__) && (defined(__x86_64__) || defined(__i386__))
diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c
index b2596d0f4..d8e6d56d2 100644
--- a/src/libserver/re_cache.c
+++ b/src/libserver/re_cache.c
@@ -553,7 +553,7 @@ rspamd_re_cache_check_lua_condition (struct rspamd_task *task,
 {
 	lua_State *L = (lua_State *)task->cfg->lua_state;
 	GError *err = NULL;
-	struct rspamd_lua_text *t;
+	struct rspamd_lua_text __attribute__ ((unused)) *t;
 	gint text_pos;
 
 	if (G_LIKELY (lua_cbref == -1)) {
diff --git a/src/rspamd.c b/src/rspamd.c
index 17b2956ab..fce081b1c 100644
--- a/src/rspamd.c
+++ b/src/rspamd.c
@@ -781,7 +781,7 @@ static void
 mark_old_workers (gpointer key, gpointer value, gpointer unused)
 {
 	struct rspamd_worker *w = value;
-	struct rspamd_main *rspamd_main;
+	struct rspamd_main __attribute__ ((unused)) *rspamd_main;
 
 	rspamd_main = w->srv;
 


More information about the Commits mailing list