[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52516] trunk/blender: Patch [#33196] Warning Fixes 11-16-2012

Jason Wilkins Jason.A.Wilkins at gmail.com
Fri Nov 23 16:12:14 CET 2012


Revision: 52516
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52516
Author:   jwilkins
Date:     2012-11-23 15:12:13 +0000 (Fri, 23 Nov 2012)
Log Message:
-----------
Patch [#33196] Warning Fixes 11-16-2012

* MEM_CacheLimitier - Size type to int conversion, should be safe for now (doing my best Bill Gates 640k impression)
* OpenNL CMakeLists.txt - MSVC and GCC have slightly different ways to remove definitions (DEBUG) without the compiler complaining
* BLI_math inlines - The include guard name and inline option macro name should be different. Suppressed warning about not exporting any symbols from inline math library
* BLI string / utf8 - Fixed some inconsistencies between declarations and definitions
* nodes - node_composite_util is apparently not used unless you enable the legacy compositor, so it should not be compiled in that case.

Leaving out changes to BLI_fileops for now, need to do more testing.

Modified Paths:
--------------
    trunk/blender/intern/memutil/MEM_CacheLimiter.h
    trunk/blender/intern/opennl/CMakeLists.txt
    trunk/blender/source/blender/blenlib/BLI_math_base.h
    trunk/blender/source/blender/blenlib/BLI_math_color.h
    trunk/blender/source/blender/blenlib/BLI_math_geom.h
    trunk/blender/source/blender/blenlib/BLI_math_inline.h
    trunk/blender/source/blender/blenlib/BLI_math_vector.h
    trunk/blender/source/blender/blenlib/CMakeLists.txt
    trunk/blender/source/blender/blenlib/intern/math_base_inline.c
    trunk/blender/source/blender/blenlib/intern/math_geom_inline.c
    trunk/blender/source/blender/blenlib/intern/math_vector_inline.c
    trunk/blender/source/blender/blenlib/intern/string.c
    trunk/blender/source/blender/blenlib/intern/string_utf8.c
    trunk/blender/source/blender/nodes/CMakeLists.txt

Modified: trunk/blender/intern/memutil/MEM_CacheLimiter.h
===================================================================
--- trunk/blender/intern/memutil/MEM_CacheLimiter.h	2012-11-23 14:33:14 UTC (rev 52515)
+++ trunk/blender/intern/memutil/MEM_CacheLimiter.h	2012-11-23 15:12:13 UTC (rev 52516)
@@ -247,8 +247,10 @@
 			if (!elem->can_destroy())
 				continue;
 
-			/* by default 0 means higherst priority element */
-			int priority = -(queue.size() - i - 1);
+			/* by default 0 means highest priority element */
+			/* casting a size type to int is questionable,
+			   but unlikely to cause problems */
+			int priority = -((int)(queue.size()) - i - 1);
 			priority = getItemPriority(elem->get()->get_data(), priority);
 
 			if (priority < best_match_priority || best_match_elem == NULL) {

Modified: trunk/blender/intern/opennl/CMakeLists.txt
===================================================================
--- trunk/blender/intern/opennl/CMakeLists.txt	2012-11-23 14:33:14 UTC (rev 52515)
+++ trunk/blender/intern/opennl/CMakeLists.txt	2012-11-23 15:12:13 UTC (rev 52516)
@@ -28,7 +28,11 @@
 
 # remove debug flag here since this is not a blender maintained library
 # and debug gives a lot of prints on UV unwrapping. developers can enable if they need to.
-add_definitions(-UDEBUG)
+if(MSVC)
+	remove_definitions(-DDEBUG)
+else()
+	add_definitions(-UDEBUG)
+endif()
 
 
 # quiet compiler warnings about undefined defines

Modified: trunk/blender/source/blender/blenlib/BLI_math_base.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_base.h	2012-11-23 14:33:14 UTC (rev 52515)
+++ trunk/blender/source/blender/blenlib/BLI_math_base.h	2012-11-23 15:12:13 UTC (rev 52516)
@@ -170,7 +170,7 @@
 } (void)0
 #endif
 
-#ifdef __BLI_MATH_INLINE_H__
+#if BLI_MATH_DO_INLINE
 #include "intern/math_base_inline.c"
 #endif
 
@@ -203,7 +203,7 @@
 MINLINE int power_of_2_max_i(int n);
 MINLINE int power_of_2_min_i(int n);
 
-MINLINE float shell_angle_to_dist(float angle);
+MINLINE float shell_angle_to_dist(const float angle);
 
 #if (defined(WIN32) || defined(WIN64)) && !defined(FREE_WINDOWS)
 extern double copysign(double x, double y);

Modified: trunk/blender/source/blender/blenlib/BLI_math_color.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_color.h	2012-11-23 14:33:14 UTC (rev 52515)
+++ trunk/blender/source/blender/blenlib/BLI_math_color.h	2012-11-23 15:12:13 UTC (rev 52516)
@@ -121,7 +121,7 @@
 
 void lift_gamma_gain_to_asc_cdl(float *lift, float *gamma, float *gain, float *offset, float *slope, float *power);
 
-#ifdef __BLI_MATH_INLINE_H__
+#if BLI_MATH_DO_INLINE
 #include "intern/math_color_inline.c"
 #endif
 

Modified: trunk/blender/source/blender/blenlib/BLI_math_geom.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_geom.h	2012-11-23 14:33:14 UTC (rev 52515)
+++ trunk/blender/source/blender/blenlib/BLI_math_geom.h	2012-11-23 15:12:13 UTC (rev 52516)
@@ -36,7 +36,7 @@
 
 #include "BLI_math_inline.h"
 
-#ifdef __BLI_MATH_INLINE_H__
+#if BLI_MATH_DO_INLINE
 #include "intern/math_geom_inline.c"
 #endif
 

Modified: trunk/blender/source/blender/blenlib/BLI_math_inline.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_inline.h	2012-11-23 14:33:14 UTC (rev 52515)
+++ trunk/blender/source/blender/blenlib/BLI_math_inline.h	2012-11-23 15:12:13 UTC (rev 52516)
@@ -35,9 +35,10 @@
 #endif
 
 /* add platform/compiler checks here if it is not supported */
-#define __BLI_MATH_INLINE_H__
+/* all platforms support forcing inline so this is always enabled */
+#define BLI_MATH_DO_INLINE 1
 
-#ifdef __BLI_MATH_INLINE_H__
+#if BLI_MATH_DO_INLINE
 #  ifdef _MSC_VER
 #    define MINLINE static __forceinline
 #    define MALWAYS_INLINE MINLINE

Modified: trunk/blender/source/blender/blenlib/BLI_math_vector.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_vector.h	2012-11-23 14:33:14 UTC (rev 52515)
+++ trunk/blender/source/blender/blenlib/BLI_math_vector.h	2012-11-23 15:12:13 UTC (rev 52516)
@@ -36,7 +36,7 @@
 
 #include "BLI_math_inline.h"
 
-#ifdef __BLI_MATH_INLINE_H__
+#if BLI_MATH_DO_INLINE
 #include "intern/math_vector_inline.c"
 #endif
 

Modified: trunk/blender/source/blender/blenlib/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/blenlib/CMakeLists.txt	2012-11-23 14:33:14 UTC (rev 52515)
+++ trunk/blender/source/blender/blenlib/CMakeLists.txt	2012-11-23 15:12:13 UTC (rev 52516)
@@ -174,3 +174,9 @@
 endif()
 
 blender_add_lib(bf_blenlib "${SRC}" "${INC}" "${INC_SYS}")
+
+if(MSVC)
+	# Quiet warning about inline math library files that do not export symbols.
+	# (normally you'd exclude from project, but we still want to see the files in MSVC)
+	set_target_properties(bf_blenlib PROPERTIES STATIC_LIBRARY_FLAGS /ignore:4221)
+endif()

Modified: trunk/blender/source/blender/blenlib/intern/math_base_inline.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_base_inline.c	2012-11-23 14:33:14 UTC (rev 52515)
+++ trunk/blender/source/blender/blenlib/intern/math_base_inline.c	2012-11-23 15:12:13 UTC (rev 52516)
@@ -27,6 +27,8 @@
  *  \ingroup bli
  */
 
+#ifndef __MATH_BASE_INLINE_C__
+#define __MATH_BASE_INLINE_C__
 
 #include <float.h>
 #include <stdio.h>
@@ -35,9 +37,6 @@
 
 #include "BLI_math.h"
 
-#ifndef __MATH_BASE_INLINE_C__
-#define __MATH_BASE_INLINE_C__
-
 /* A few small defines. Keep'em local! */
 #define SMALL_NUMBER  1.e-8f
 

Modified: trunk/blender/source/blender/blenlib/intern/math_geom_inline.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_geom_inline.c	2012-11-23 14:33:14 UTC (rev 52515)
+++ trunk/blender/source/blender/blenlib/intern/math_geom_inline.c	2012-11-23 15:12:13 UTC (rev 52516)
@@ -27,11 +27,12 @@
  *  \ingroup bli
  */
 
+#ifndef __MATH_GEOM_INLINE_C__
+#define __MATH_GEOM_INLINE_C__
 
 #include "BLI_math.h"
 
-#ifndef __MATH_GEOM_INLINE_C__
-#define __MATH_GEOM_INLINE_C__
+#include <string.h>
 
 /****************************** Spherical Harmonics **************************/
 

Modified: trunk/blender/source/blender/blenlib/intern/math_vector_inline.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_vector_inline.c	2012-11-23 14:33:14 UTC (rev 52515)
+++ trunk/blender/source/blender/blenlib/intern/math_vector_inline.c	2012-11-23 15:12:13 UTC (rev 52516)
@@ -27,12 +27,11 @@
  *  \ingroup bli
  */
 
-
-#include "BLI_math.h"
-
 #ifndef __MATH_VECTOR_INLINE_C__
 #define __MATH_VECTOR_INLINE_C__
 
+#include "BLI_math.h"
+
 /********************************** Init *************************************/
 
 MINLINE void zero_v2(float r[2])

Modified: trunk/blender/source/blender/blenlib/intern/string.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/string.c	2012-11-23 14:33:14 UTC (rev 52515)
+++ trunk/blender/source/blender/blenlib/intern/string.c	2012-11-23 15:12:13 UTC (rev 52516)
@@ -56,7 +56,7 @@
 	return BLI_strdupn(str, strlen(str));
 }
 
-char *BLI_strdupcat(const char *str1, const char *str2)
+char *BLI_strdupcat(const char *__restrict str1, const char *__restrict str2)
 {
 	size_t len;
 	char *n;
@@ -69,7 +69,7 @@
 	return n;
 }
 
-char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy)
+char *BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy)
 {
 	size_t srclen = strlen(src);
 	size_t cpylen = (srclen > (maxncpy - 1)) ? (maxncpy - 1) : srclen;
@@ -81,7 +81,7 @@
 	return dst;
 }
 
-size_t BLI_vsnprintf(char *buffer, size_t count, const char *format, va_list arg)
+size_t BLI_vsnprintf(char *__restrict buffer, size_t count, const char *__restrict format, va_list arg)
 {
 	size_t n;
 
@@ -97,7 +97,7 @@
 	return n;
 }
 
-size_t BLI_snprintf(char *buffer, size_t count, const char *format, ...)
+size_t BLI_snprintf(char *__restrict buffer, size_t count, const char *__restrict format, ...)
 {
 	size_t n;
 	va_list arg;
@@ -109,7 +109,7 @@
 	return n;
 }
 
-char *BLI_sprintfN(const char *format, ...)
+char *BLI_sprintfN(const char *__restrict format, ...)
 {
 	DynStr *ds;
 	va_list arg;
@@ -133,7 +133,7 @@
  * TODO: support more fancy string escaping. current code is primitive
  *    this basically is an ascii version of PyUnicode_EncodeUnicodeEscape()
  *    which is a useful reference. */
-size_t BLI_strescape(char *dst, const char *src, const size_t maxncpy)
+size_t BLI_strescape(char *__restrict dst, const char *__restrict src, const size_t maxncpy)
 {
 	size_t len = 0;
 
@@ -186,7 +186,7 @@
  *
  * TODO, return the offset and a length so as to avoid doing an allocation.
  */
-char *BLI_str_quoted_substrN(const char *str, const char *prefix)
+char *BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict prefix)
 {
 	size_t prefixLen = strlen(prefix);
 	char *startMatch, *endMatch;
@@ -207,7 +207,7 @@
 
 /* A rather wasteful string-replacement utility, though this shall do for now...
  * Feel free to replace this with an even safe + nicer alternative */
-char *BLI_replacestr(char *str, const char *oldText, const char *newText)
+char *BLI_replacestr(char *__restrict str, const char *__restrict oldText, const char *__restrict newText)
 {
 	DynStr *ds = NULL;
 	size_t lenOld = strlen(oldText);

Modified: trunk/blender/source/blender/blenlib/intern/string_utf8.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/string_utf8.c	2012-11-23 14:33:14 UTC (rev 52515)
+++ trunk/blender/source/blender/blenlib/intern/string_utf8.c	2012-11-23 15:12:13 UTC (rev 52516)
@@ -184,7 +184,7 @@
 		*dst = '\0';                                                          \
 	} (void)0
 
-char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy)
+char *BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy)
 {
 	char *dst_r = dst;
 
@@ -196,7 +196,7 @@
 	return dst_r;
 }
 
-char *BLI_strncat_utf8(char *dst, const char *src, size_t maxncpy)

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list