Browse Source

Added extra GCC/Clang warnings.

Branimir Karadžić 8 years ago
parent
commit
5ba4d9f6d9
3 changed files with 19 additions and 5 deletions
  1. 2 2
      include/bx/inline/spscqueue.inl
  2. 8 1
      include/bx/macros.h
  3. 9 2
      scripts/toolchain.lua

+ 2 - 2
include/bx/inline/spscqueue.inl

@@ -29,7 +29,7 @@ namespace bx
 
 
 	inline void SpScUnboundedQueue::push(void* _ptr)
 	inline void SpScUnboundedQueue::push(void* _ptr)
 	{
 	{
-		m_last->m_next = new Node( (void*)_ptr);
+		m_last->m_next = new Node(_ptr);
 		atomicExchangePtr( (void**)&m_last, m_last->m_next);
 		atomicExchangePtr( (void**)&m_last, m_last->m_next);
 		while (m_first != m_divider)
 		while (m_first != m_divider)
 		{
 		{
@@ -106,7 +106,7 @@ namespace bx
 
 
 	inline void SpScBlockingUnboundedQueue::push(void* _ptr)
 	inline void SpScBlockingUnboundedQueue::push(void* _ptr)
 	{
 	{
-		m_queue.push( (void*)_ptr);
+		m_queue.push(_ptr);
 		m_count.post();
 		m_count.post();
 	}
 	}
 
 

+ 8 - 1
include/bx/macros.h

@@ -118,7 +118,14 @@
 #define BX_NOOP(...) BX_MACRO_BLOCK_BEGIN BX_MACRO_BLOCK_END
 #define BX_NOOP(...) BX_MACRO_BLOCK_BEGIN BX_MACRO_BLOCK_END
 
 
 ///
 ///
-#define BX_UNUSED_1(_a1) BX_MACRO_BLOCK_BEGIN (void)(true ? (void)0 : ( (void)(_a1) ) ); BX_MACRO_BLOCK_END
+#define BX_UNUSED_1(_a1)                                          \
+	BX_MACRO_BLOCK_BEGIN                                          \
+		BX_PRAGMA_DIAGNOSTIC_PUSH();                              \
+		BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wuseless-cast"); \
+		(void)(true ? (void)0 : ( (void)(_a1) ) );                \
+		BX_PRAGMA_DIAGNOSTIC_POP();                               \
+	BX_MACRO_BLOCK_END
+
 #define BX_UNUSED_2(_a1, _a2) BX_UNUSED_1(_a1); BX_UNUSED_1(_a2)
 #define BX_UNUSED_2(_a1, _a2) BX_UNUSED_1(_a1); BX_UNUSED_1(_a2)
 #define BX_UNUSED_3(_a1, _a2, _a3) BX_UNUSED_2(_a1, _a2); BX_UNUSED_1(_a3)
 #define BX_UNUSED_3(_a1, _a2, _a3) BX_UNUSED_2(_a1, _a2); BX_UNUSED_1(_a3)
 #define BX_UNUSED_4(_a1, _a2, _a3, _a4) BX_UNUSED_3(_a1, _a2, _a3); BX_UNUSED_1(_a4)
 #define BX_UNUSED_4(_a1, _a2, _a3, _a4) BX_UNUSED_3(_a1, _a2, _a3); BX_UNUSED_1(_a4)

+ 9 - 2
scripts/toolchain.lua

@@ -476,7 +476,7 @@ function toolchain(_buildDir, _libDir)
 			location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
 			location (path.join(_buildDir, "projects", _ACTION .. "-xp"))
 
 
 		end
 		end
-			
+
 	elseif _ACTION == "xcode4" then
 	elseif _ACTION == "xcode4" then
 
 
 		if "osx" == _OPTIONS["xcode"] then
 		if "osx" == _OPTIONS["xcode"] then
@@ -723,9 +723,16 @@ function toolchain(_buildDir, _libDir)
 	configuration { "linux-gcc* or linux-clang*" }
 	configuration { "linux-gcc* or linux-clang*" }
 		buildoptions {
 		buildoptions {
 			"-msse2",
 			"-msse2",
+--			"-Wdouble-promotion",
+--			"-Wduplicated-branches",
+			"-Wduplicated-cond",
+--			"-Wjump-misses-init",
+			"-Wlogical-op",
+			"-Wshadow",
+--			"-Wnull-dereference",
 			"-Wunused-value",
 			"-Wunused-value",
 			"-Wundef",
 			"-Wundef",
-			"-Wno-strict-overflow",
+--			"-Wuseless-cast",
 		}
 		}
 		buildoptions_cpp {
 		buildoptions_cpp {
 			"-std=c++11",
 			"-std=c++11",