[Bf-blender-cvs] [78bd029] master: MSVC: add errors for BLI_strict_flags.h

Campbell Barton noreply at git.blender.org
Sun Feb 16 04:51:27 CET 2014


Commit: 78bd029bbe5631fa42739c2c5ec2de0fe80932c5
Author: Campbell Barton
Date:   Sun Feb 16 14:50:15 2014 +1100
https://developer.blender.org/rB78bd029bbe5631fa42739c2c5ec2de0fe80932c5

MSVC: add errors for BLI_strict_flags.h

===================================================================

M	CMakeLists.txt
M	source/blender/blenkernel/intern/mask_rasterize.c
M	source/blender/blenlib/BLI_strict_flags.h

===================================================================

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6836121..b022233 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1001,7 +1001,23 @@ elseif(WIN32)
 		set(CMAKE_C_FLAGS_RELWITHDEBINFO "/O2 /Ob1 /MT /Zi /MP" CACHE STRING "MSVC MT flags " FORCE)
 
 		# most msvc warnings are C & C++
-		set(_WARNINGS "/W3 /wd4018 /wd4244 /wd4305 /wd4800 /wd4181 /wd4065 /wd4267 /we4013 /wd4200")
+		set(_WARNINGS
+			# warning level:
+			"/W3"
+			# disable:
+			"/wd4018"  # signed/unsigned mismatch
+			"/wd4065"  # switch statement contains 'default' but no 'case' labels
+			"/wd4181"  # qualifier applied to reference type; ignored
+			"/wd4200"  # zero-sized array in struct/union
+			"/wd4244"  # conversion from 'type1' to 'type2', possible loss of data
+			"/wd4267"  # conversion from 'size_t' to 'type', possible loss of data
+			"/wd4305"  # truncation from 'type1' to 'type2'
+			"/wd4800"  # forcing value to bool 'true' or 'false'
+			# errors:
+			"/we4013"  # 'function' undefined; assuming extern returning int
+		)
+
+		string(REPLACE ";" " " _WARNINGS "${_WARNINGS}")
 		set(C_WARNINGS "${_WARNINGS}")
 		set(CXX_WARNINGS "${_WARNINGS}")
 		unset(_WARNINGS)
diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c
old mode 100644
new mode 100755
index 2c60f52..ba1b873
--- a/source/blender/blenkernel/intern/mask_rasterize.c
+++ b/source/blender/blenkernel/intern/mask_rasterize.c
@@ -1440,7 +1440,7 @@ void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle,
 #endif
 
 #pragma omp parallel for private(y)
-	for (y = 0; y < height; y++) {
+	for (y = 0; (unsigned int)y < height; y++) {
 		unsigned int i = y * width;
 		unsigned int x;
 		float xy[2];
diff --git a/source/blender/blenlib/BLI_strict_flags.h b/source/blender/blenlib/BLI_strict_flags.h
index 5c5a6f4..cb92f78 100644
--- a/source/blender/blenlib/BLI_strict_flags.h
+++ b/source/blender/blenlib/BLI_strict_flags.h
@@ -38,4 +38,13 @@
 #  endif
 #endif
 
+#ifdef _MSC_VER
+#  pragma warning(error:4018)  /* signed/unsigned mismatch */
+#  pragma warning(error:4244)  /* conversion from 'type1' to 'type2', possible loss of data */
+#  pragma warning(error:4245)  /* conversion from 'int' to 'unsigned int' */
+#  pragma warning(error:4267)  /* conversion from 'size_t' to 'type', possible loss of data */
+#  pragma warning(error:4305)  /* truncation from 'type1' to 'type2' */
+#  pragma warning(error:4389)  /* signed/unsigned mismatch */
+#endif
+
 #endif  /* __BLI_STRICT_FLAGS_H__ */




More information about the Bf-blender-cvs mailing list