commit 364641b: [Minor] Fix various crap

Vsevolod Stakhov vsevolod at highsecure.ru
Sat Jun 22 13:35:06 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-06-22 14:29:40 +0100
URL: https://github.com/rspamd/rspamd/commit/364641b4bdbf141d33813d2e4a0660b82a8dd387 (HEAD -> master)

[Minor] Fix various crap

---
 CMakeLists.txt                                     | 53 ++++++++++++----------
 .../lua-torch/torch7/lib/TH/generic/simd/simd.h    |  2 +-
 src/rspamd.c                                       |  3 --
 3 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index fec771663..33d9cfecd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -688,13 +688,12 @@ IF (ENABLE_HYPERSCAN MATCHES "ON")
 	ENDIF()
 ENDIF()
 
-# Process with warn flags
-SET(CMAKE_C_WARN_FLAGS "")
 CHECK_C_COMPILER_FLAG(-Wall SUPPORT_WALL)
 CHECK_C_COMPILER_FLAG(-W SUPPORT_W)
 CHECK_C_COMPILER_FLAG(-Wpointer-arith SUPPORT_WPOINTER)
 CHECK_C_COMPILER_FLAG(-Wno-unused-parameter SUPPORT_WPARAM)
 CHECK_C_COMPILER_FLAG(-Wno-unused-function SUPPORT_WFUNCTION)
+CHECK_C_COMPILER_FLAG(-Wno-strict-aliasing SUPPORT_WSTRICT_ALIASING)
 CHECK_C_COMPILER_FLAG(-Wunused-variable SUPPORT_WUNUSED_VAR)
 CHECK_C_COMPILER_FLAG(-Wno-pointer-sign SUPPORT_WPOINTER_SIGN)
 CHECK_C_COMPILER_FLAG(-Wno-sign-compare SUPPORT_WSIGN_COMPARE)
@@ -712,62 +711,66 @@ IF(NOT "${CMAKE_C_COMPILER_ID}" MATCHES SunPro)
 	CHECK_C_COMPILER_FLAG("-std=c99" SUPPORT_STD99_FLAG)
 ENDIF(NOT "${CMAKE_C_COMPILER_ID}" MATCHES SunPro)
 IF(SUPPORT_W)
-	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -W")
+	ADD_DEFINITIONS("-W")
 ENDIF(SUPPORT_W)
 IF(SUPPORT_WALL)
-	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wall")
+	ADD_DEFINITIONS("-Wall")
 ENDIF(SUPPORT_WALL)
 IF(SUPPORT_WPOINTER)
-	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wpointer-arith")
+	ADD_DEFINITIONS("-Wpointer-arith")
 ENDIF(SUPPORT_WPOINTER)
 IF(SUPPORT_WPARAM)
-	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wno-unused-parameter")
+	ADD_DEFINITIONS("-Wno-unused-parameter")
 ENDIF(SUPPORT_WPARAM)
 IF(SUPPORT_WFUNCTION)
-	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wno-unused-function")
+	ADD_DEFINITIONS("-Wno-unused-function")
 ENDIF(SUPPORT_WFUNCTION)
 IF(SUPPORT_WUNUSED_VAR)
-	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wunused-variable")
+	ADD_DEFINITIONS("-Wunused-variable")
 ENDIF(SUPPORT_WUNUSED_VAR)
 IF(SUPPORT_WPOINTER_SIGN)
-	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wno-pointer-sign")
+	ADD_DEFINITIONS("-Wno-pointer-sign")
 ENDIF(SUPPORT_WPOINTER_SIGN)
 IF(SUPPORT_WSTRICT_PROTOTYPES)
-	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wstrict-prototypes")
+	ADD_DEFINITIONS("-Wstrict-prototypes")
 ENDIF(SUPPORT_WSTRICT_PROTOTYPES)
+IF(SUPPORT_WSTRICT_ALIASING)
+	ADD_DEFINITIONS("-Wno-strict-aliasing")
+	ADD_DEFINITIONS("-fno-strict-aliasing")
+ENDIF(SUPPORT_WSTRICT_ALIASING)
 #IF(SUPPORT_PEDANTIC_FLAG)
 #	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -pedantic")
 #ENDIF(SUPPORT_PEDANTIC_FLAG)
 IF(SUPPORT_WNULL_DEREFERENCE)
-	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wnull-dereference")
+	ADD_DEFINITIONS("-Wnull-dereference")
 ENDIF()
 IF(SUPPORT_WDUPLICATED_COND)
-	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wduplicated-cond")
+	ADD_DEFINITIONS("-Wduplicated-cond")
 ENDIF()
 IF(SUPPORT_WLOGICAL_OP)
-	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wlogical-op")
+	ADD_DEFINITIONS("-Wlogical-op")
 ENDIF()
 IF(SUPPORT_WNO_UNUSED_CONST)
-	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wno-unused-const-variable")
+	ADD_DEFINITIONS("-Wno-unused-const-variable")
 ENDIF()
 IF(SUPPORT_WSIGN_COMPARE)
-	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wno-sign-compare")
+	ADD_DEFINITIONS("-Wno-sign-compare")
 ENDIF()
 IF(SUPPORT_STD11_FLAG)
-	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -std=c11")
+	ADD_DEFINITIONS("-std=c11")
 ELSE(SUPPORT_STD11_FLAG)
 	MESSAGE("C11 compatible compiler is strongly recommended")
 	IF(SUPPORT_STD99_FLAG)
-		SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -std=c99")
+		ADD_DEFINITIONS("-std=c99")
 	ENDIF(SUPPORT_STD99_FLAG)
 ENDIF(SUPPORT_STD11_FLAG)
 IF(SUPPORT_WIMPLICIT_FALLTHROUGH)
-	SET(CMAKE_C_WARN_FLAGS "${CMAKE_C_WARN_FLAGS} -Wno-implicit-fallthrough")
+	ADD_DEFINITIONS("-Wno-implicit-fallthrough")
 ENDIF(SUPPORT_WIMPLICIT_FALLTHROUGH)
 
 CHECK_C_COMPILER_FLAG(-fPIC SUPPORT_FPIC)
 IF(SUPPORT_FPIC)
-	SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
+	ADD_DEFINITIONS("-fPIC")
 ENDIF(SUPPORT_FPIC)
 
  # Optimization flags
@@ -781,7 +784,7 @@ IF(NOT CMAKE_C_OPT_FLAGS)
 			MARK_AS_ADVANCED(CMAKE_GCC_AR CMAKE_GCC_RANLIB)
 		ENDIF()
 		IF(CMAKE_GCC_AR AND CMAKE_GCC_RANLIB)
-			SET(CMAKE_C_OPT_FLAGS "-g -O3 -fstrict-aliasing -flto")
+			SET(CMAKE_C_OPT_FLAGS "-g -O3 -flto")
 			SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto")
 			SET(CMAKE_C_ARCHIVE_CREATE "${CMAKE_GCC_AR} cr <TARGET> <LINK_FLAGS> <OBJECTS>")
 			SET(CMAKE_C_ARCHIVE_APPEND "${CMAKE_GCC_AR} r <TARGET> <LINK_FLAGS> <OBJECTS>")
@@ -791,19 +794,19 @@ IF(NOT CMAKE_C_OPT_FLAGS)
 			SET(CMAKE_CXX_ARCHIVE_FINISH "${CMAKE_GCC_RANLIB} <TARGET>")
 		ENDIF()
 	ELSE()
-		SET(CMAKE_C_OPT_FLAGS "-g -O3 -fstrict-aliasing")
+		SET(CMAKE_C_OPT_FLAGS "-g -O3")
 	ENDIF()
 	ELSE(ENABLE_OPTIMIZATION MATCHES "ON")
 		IF(ENABLE_FULL_DEBUG MATCHES "ON")
-			SET(CMAKE_C_OPT_FLAGS "-g -O0 -fstrict-aliasing")
+			SET(CMAKE_C_OPT_FLAGS "-g -O0")
 		ELSE(ENABLE_FULL_DEBUG MATCHES "ON")
-			SET(CMAKE_C_OPT_FLAGS "-g -O2 -fstrict-aliasing")
+			SET(CMAKE_C_OPT_FLAGS "-g -O2")
 		ENDIF(ENABLE_FULL_DEBUG MATCHES "ON")
 	ENDIF(ENABLE_OPTIMIZATION MATCHES "ON")
 ENDIF(NOT CMAKE_C_OPT_FLAGS)
 
 IF(ENABLE_COVERAGE)
-	SET(CMAKE_C_OPT_FLAGS "-g -O0 -fno-strict-aliasing")
+	SET(CMAKE_C_OPT_FLAGS "-g -O0")
 	SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
 	SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
 ENDIF(ENABLE_COVERAGE)
@@ -812,7 +815,7 @@ IF(ENABLE_LUA_TRACE)
 	SET(WITH_LUA_TRACE 1)
 ENDIF(ENABLE_LUA_TRACE)
 
-SET(CMAKE_C_FLAGS "${CMAKE_C_OPT_FLAGS} ${CMAKE_C_FLAGS} ${CMAKE_C_WARN_FLAGS}")
+SET(CMAKE_C_FLAGS "${CMAKE_C_OPT_FLAGS} ${CMAKE_C_FLAGS}")
 
 ADD_DEFINITIONS(-DHAVE_CONFIG_H)
 
diff --git a/contrib/lua-torch/torch7/lib/TH/generic/simd/simd.h b/contrib/lua-torch/torch7/lib/TH/generic/simd/simd.h
index 83c4c5681..b1878ad5b 100644
--- a/contrib/lua-torch/torch7/lib/TH/generic/simd/simd.h
+++ b/contrib/lua-torch/torch7/lib/TH/generic/simd/simd.h
@@ -111,7 +111,7 @@ static inline void cpuid(uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *
   __get_cpuid (level, eax, ebx, ecx, edx);
 #else
   uint32_t a = *eax, b, c = *ecx, d;
-  asm volatile ( "cpuid\n\t"
+  __asm volatile ( "cpuid\n\t"
 		 : "+a"(a), "=b"(b), "+c"(c), "=d"(d) );
   *eax = a;
   *ebx = b;
diff --git a/src/rspamd.c b/src/rspamd.c
index fb87df06f..8e7b8153b 100644
--- a/src/rspamd.c
+++ b/src/rspamd.c
@@ -1146,9 +1146,6 @@ main (gint argc, gchar **argv, gchar **env)
 	struct rspamd_main *rspamd_main;
 	gboolean skip_pid = FALSE;
 
-#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION <= 30))
-	g_thread_init (NULL);
-#endif
 	rspamd_main = (struct rspamd_main *) g_malloc0 (sizeof (struct rspamd_main));
 
 	rspamd_main->server_pool = rspamd_mempool_new (rspamd_mempool_suggest_size (),


More information about the Commits mailing list