commit aeac58f: [Minor] Fix some compiler warnings

Duncan Bellamy dunk at denkimushi.com
Fri Mar 17 11:49:03 UTC 2023


Author: Duncan Bellamy
Date: 2023-03-14 18:44:21 +0000
URL: https://github.com/rspamd/rspamd/commit/aeac58faaf9826f2b1de0786ccc50ba9d4495cdb (refs/pull/4436/head)

[Minor] Fix some compiler warnings

---
 contrib/libottery/aes_cryptobox.c | 2 ++
 src/libcryptobox/base64/avx2.c    | 4 ++++
 src/libcryptobox/base64/sse42.c   | 4 ++++
 test/rspamd_dkim_test.c           | 2 +-
 test/rspamd_dns_test.c            | 2 +-
 test/rspamd_lua_test.c            | 2 +-
 test/rspamd_mem_pool_test.c       | 2 +-
 test/rspamd_rrd_test.c            | 2 +-
 test/rspamd_statfile_test.c       | 2 +-
 test/rspamd_url_test.c            | 2 +-
 10 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/contrib/libottery/aes_cryptobox.c b/contrib/libottery/aes_cryptobox.c
index 0e5434442..ea86dc747 100644
--- a/contrib/libottery/aes_cryptobox.c
+++ b/contrib/libottery/aes_cryptobox.c
@@ -28,8 +28,10 @@
 #include "cryptobox.h"
 
 #if defined(__x86_64__) && defined(RSPAMD_HAS_TARGET_ATTR)
+#if defined(__GNUC__) && !defined(__clang__)
 #pragma GCC push_options
 #pragma GCC target("aes")
+#endif
 #ifndef __SSE2__
 #define __SSE2__
 #endif
diff --git a/src/libcryptobox/base64/avx2.c b/src/libcryptobox/base64/avx2.c
index 432149a29..c44f8edf1 100644
--- a/src/libcryptobox/base64/avx2.c
+++ b/src/libcryptobox/base64/avx2.c
@@ -49,8 +49,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 extern const uint8_t base64_table_dec[256];
 
 #ifdef RSPAMD_HAS_TARGET_ATTR
+#if defined(__GNUC__) && !defined(__clang__)
 #pragma GCC push_options
 #pragma GCC target("avx2")
+#endif
 #ifndef __SSE2__
 #define __SSE2__
 #endif
@@ -281,5 +283,7 @@ repeat:
 	return ret;
 }
 
+#if defined(__GNUC__) && !defined(__clang__)
 #pragma GCC pop_options
 #endif
+#endif
diff --git a/src/libcryptobox/base64/sse42.c b/src/libcryptobox/base64/sse42.c
index 806dd5298..f3b812dc9 100644
--- a/src/libcryptobox/base64/sse42.c
+++ b/src/libcryptobox/base64/sse42.c
@@ -49,8 +49,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 extern const uint8_t base64_table_dec[256];
 
 #ifdef RSPAMD_HAS_TARGET_ATTR
+#if defined(__GNUC__) && !defined(__clang__)
 #pragma GCC push_options
 #pragma GCC target("sse4.2")
+#endif
 #ifndef __SSE2__
 #define __SSE2__
 #endif
@@ -263,5 +265,7 @@ repeat:
 	return ret;
 }
 
+#if defined(__GNUC__) && !defined(__clang__)
 #pragma GCC pop_options
 #endif
+#endif
diff --git a/test/rspamd_dkim_test.c b/test/rspamd_dkim_test.c
index f9018bf68..fde27e4ae 100644
--- a/test/rspamd_dkim_test.c
+++ b/test/rspamd_dkim_test.c
@@ -50,7 +50,7 @@ session_fin (gpointer unused)
 }
 #endif
 void
-rspamd_dkim_test_func ()
+rspamd_dkim_test_func (void)
 {
 #if 0
 	rspamd_dkim_context_t *ctx;
diff --git a/test/rspamd_dns_test.c b/test/rspamd_dns_test.c
index 25c28528e..336e58bfb 100644
--- a/test/rspamd_dns_test.c
+++ b/test/rspamd_dns_test.c
@@ -61,7 +61,7 @@ test_dns_cb (struct rdns_reply *reply, gpointer arg)
 }
 
 void
-rspamd_dns_test_func ()
+rspamd_dns_test_func (void)
 {
 
 	struct rspamd_config *cfg;
diff --git a/test/rspamd_lua_test.c b/test/rspamd_lua_test.c
index b014604b5..cc1e96474 100644
--- a/test/rspamd_lua_test.c
+++ b/test/rspamd_lua_test.c
@@ -56,7 +56,7 @@ traceback (lua_State *L)
 	return 1;
 }
 
-void
+_Noreturn void
 rspamd_lua_test_func (void)
 {
 	lua_State *L = (lua_State *)rspamd_main->cfg->lua_state;
diff --git a/test/rspamd_mem_pool_test.c b/test/rspamd_mem_pool_test.c
index b7e0f0811..156b913dc 100644
--- a/test/rspamd_mem_pool_test.c
+++ b/test/rspamd_mem_pool_test.c
@@ -12,7 +12,7 @@
 #define TEST2_BUF "test buffertest buffer"
 
 void
-rspamd_mem_pool_test_func ()
+rspamd_mem_pool_test_func (void)
 {
 	rspamd_mempool_t *pool;
 	rspamd_mempool_stat_t st;
diff --git a/test/rspamd_rrd_test.c b/test/rspamd_rrd_test.c
index 066864222..0fc16edea 100644
--- a/test/rspamd_rrd_test.c
+++ b/test/rspamd_rrd_test.c
@@ -24,7 +24,7 @@ const int rows_cnt = 20;
 const int pdp_per_cdp = 60;
 
 void
-rspamd_rrd_test_func ()
+rspamd_rrd_test_func (void)
 {
 	gchar  tmpfile[PATH_MAX];
 	struct rrd_rra_def rra[4];
diff --git a/test/rspamd_statfile_test.c b/test/rspamd_statfile_test.c
index 2ee32ea48..155e4ad68 100644
--- a/test/rspamd_statfile_test.c
+++ b/test/rspamd_statfile_test.c
@@ -7,7 +7,7 @@
 #define HASHES_NUM 256
 
 void 
-rspamd_statfile_test_func ()
+rspamd_statfile_test_func (void)
 {
 	/*
 	 * XXX: broken, old, need to be rewritten
diff --git a/test/rspamd_url_test.c b/test/rspamd_url_test.c
index aadc18409..092274cb1 100644
--- a/test/rspamd_url_test.c
+++ b/test/rspamd_url_test.c
@@ -55,7 +55,7 @@ const char *test_html = "<some_tag>This is test file with <a href=\"http://micro
 
 /* Function for using in glib test suite */
 void
-rspamd_url_test_func ()
+rspamd_url_test_func (void)
 {
 	/* XXX: maybe write test for this */
 }


More information about the Commits mailing list