[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58377] trunk/blender: enable type limits warning when compiling with gcc.

Campbell Barton ideasman42 at gmail.com
Fri Jul 19 12:39:26 CEST 2013


Revision: 58377
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58377
Author:   campbellbarton
Date:     2013-07-19 10:39:25 +0000 (Fri, 19 Jul 2013)
Log Message:
-----------
enable type limits warning when compiling with gcc.

Modified Paths:
--------------
    trunk/blender/CMakeLists.txt
    trunk/blender/source/blender/blenkernel/intern/implicit.c
    trunk/blender/source/blender/blenkernel/intern/mask_rasterize.c
    trunk/blender/source/blender/bmesh/intern/bmesh_operators.c

Modified: trunk/blender/CMakeLists.txt
===================================================================
--- trunk/blender/CMakeLists.txt	2013-07-19 09:14:01 UTC (rev 58376)
+++ trunk/blender/CMakeLists.txt	2013-07-19 10:39:25 UTC (rev 58377)
@@ -1977,6 +1977,7 @@
 	ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_NULL -Wnonnull)  # C only
 	ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
 	ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
+	ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_TYPE_LIMITS -Wtype-limits)
 
 	# gcc 4.2 gives annoying warnings on every file with this
 	if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")
@@ -2003,6 +2004,7 @@
 	ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_INIT_SELF -Winit-self)  # needs -Wuninitialized
 	ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_MISSING_INCLUDE_DIRS -Wmissing-include-dirs)
 	ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_DIV_BY_ZERO -Wno-div-by-zero)
+	ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_TYPE_LIMITS -Wtype-limits)
 
 	# gcc 4.2 gives annoying warnings on every file with this
 	if(NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "4.3")

Modified: trunk/blender/source/blender/blenkernel/intern/implicit.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/implicit.c	2013-07-19 09:14:01 UTC (rev 58376)
+++ trunk/blender/source/blender/blenkernel/intern/implicit.c	2013-07-19 10:39:25 UTC (rev 58377)
@@ -48,6 +48,10 @@
 #include "BKE_global.h"
 
 
+#ifdef __GNUC__
+#  pragma GCC diagnostic ignored "-Wtype-limits"
+#endif
+
 #ifdef _OPENMP
 #  define CLOTH_OPENMP_LIMIT 512
 #endif

Modified: trunk/blender/source/blender/blenkernel/intern/mask_rasterize.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/mask_rasterize.c	2013-07-19 09:14:01 UTC (rev 58376)
+++ trunk/blender/source/blender/blenkernel/intern/mask_rasterize.c	2013-07-19 10:39:25 UTC (rev 58377)
@@ -496,10 +496,10 @@
 
 					/* this should _almost_ never happen but since it can in extreme cases,
 					 * we have to clamp the values or we overrun the buffer and crash */
-					CLAMP(xi_min, 0, layer->buckets_x - 1);
-					CLAMP(xi_max, 0, layer->buckets_x - 1);
-					CLAMP(yi_min, 0, layer->buckets_y - 1);
-					CLAMP(yi_max, 0, layer->buckets_y - 1);
+					if (xi_min >= layer->buckets_x) xi_min = layer->buckets_x - 1;
+					if (xi_max >= layer->buckets_x) xi_max = layer->buckets_x - 1;
+					if (yi_min >= layer->buckets_y) yi_min = layer->buckets_y - 1;
+					if (yi_max >= layer->buckets_y) yi_max = layer->buckets_y - 1;
 
 					for (yi = yi_min; yi <= yi_max; yi++) {
 						unsigned int bucket_index = (layer->buckets_x * yi) + xi_min;

Modified: trunk/blender/source/blender/bmesh/intern/bmesh_operators.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_operators.c	2013-07-19 09:14:01 UTC (rev 58376)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_operators.c	2013-07-19 10:39:25 UTC (rev 58377)
@@ -561,8 +561,6 @@
 	BMElemF *ele_f;
 	int i;
 
-	BLI_assert((unsigned int)test_for_enabled <= 1);
-
 	for (i = 0; i < 3; i++) {
 		if (htype & flag_types[i]) {
 			BM_ITER_MESH (ele_f, &iter, bm, iter_types[i]) {
@@ -937,7 +935,6 @@
 	int totelement, i = 0;
 
 	BLI_assert(op->slots_in == slot_args || op->slots_out == slot_args);
-	BLI_assert((unsigned int)test_for_enabled <= 1);
 
 	if (test_for_enabled)
 		totelement = BMO_mesh_enabled_flag_count(bm, htype, oflag);




More information about the Bf-blender-cvs mailing list