diff options
author | Jason Wilkins <Jason.A.Wilkins@gmail.com> | 2012-11-23 19:12:13 +0400 |
---|---|---|
committer | Jason Wilkins <Jason.A.Wilkins@gmail.com> | 2012-11-23 19:12:13 +0400 |
commit | 69b88cf719c7aa9e28e28063557c8fe6f4963327 (patch) | |
tree | e04c1141b92cee50f6f28ae89e16b0d8e3176d42 /source/blender/blenlib | |
parent | c407c951a09c55f6ba64a8b372a24678cc919b5f (diff) |
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.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_base.h | 4 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_math_color.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_math_geom.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_math_inline.h | 5 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/CMakeLists.txt | 6 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_base_inline.c | 5 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_geom_inline.c | 5 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_vector_inline.c | 5 | ||||
-rw-r--r-- | source/blender/blenlib/intern/string.c | 16 | ||||
-rw-r--r-- | source/blender/blenlib/intern/string_utf8.c | 12 |
11 files changed, 35 insertions, 29 deletions
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index 2b513cbec41..69d6478e0e2 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -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 is_power_of_2_i(int n); 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); diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h index 7c8bf88943d..c71463da61d 100644 --- a/source/blender/blenlib/BLI_math_color.h +++ b/source/blender/blenlib/BLI_math_color.h @@ -121,7 +121,7 @@ MINLINE int compare_rgb_uchar(const unsigned char a[3], const unsigned char b[3] 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 diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 509927e589c..cfd163d4e57 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -36,7 +36,7 @@ extern "C" { #include "BLI_math_inline.h" -#ifdef __BLI_MATH_INLINE_H__ +#if BLI_MATH_DO_INLINE #include "intern/math_geom_inline.c" #endif diff --git a/source/blender/blenlib/BLI_math_inline.h b/source/blender/blenlib/BLI_math_inline.h index ce43d5fb941..6dad44644f2 100644 --- a/source/blender/blenlib/BLI_math_inline.h +++ b/source/blender/blenlib/BLI_math_inline.h @@ -35,9 +35,10 @@ extern "C" { #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 diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 5f80d1e52d7..f4572afec84 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -36,7 +36,7 @@ extern "C" { #include "BLI_math_inline.h" -#ifdef __BLI_MATH_INLINE_H__ +#if BLI_MATH_DO_INLINE #include "intern/math_vector_inline.c" #endif diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index a6435bcbd50..10ae26d3757 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -174,3 +174,9 @@ if(WIN32) 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() diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c index 8dccded64d1..b9866f9c6e6 100644 --- a/source/blender/blenlib/intern/math_base_inline.c +++ b/source/blender/blenlib/intern/math_base_inline.c @@ -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 diff --git a/source/blender/blenlib/intern/math_geom_inline.c b/source/blender/blenlib/intern/math_geom_inline.c index 01585c93bc8..ba9770e1bd1 100644 --- a/source/blender/blenlib/intern/math_geom_inline.c +++ b/source/blender/blenlib/intern/math_geom_inline.c @@ -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 **************************/ diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index 191b0e16025..3ede8636aa5 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -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]) diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index ff589764287..14e0dc2f049 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -56,7 +56,7 @@ char *BLI_strdup(const char *str) 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 @@ char *BLI_strdupcat(const char *str1, const char *str2) 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 @@ char *BLI_strncpy(char *dst, const char *src, const size_t maxncpy) 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 @@ size_t BLI_vsnprintf(char *buffer, size_t count, const char *format, va_list arg 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 @@ size_t BLI_snprintf(char *buffer, size_t count, const char *format, ...) return n; } -char *BLI_sprintfN(const char *format, ...) +char *BLI_sprintfN(const char *__restrict format, ...) { DynStr *ds; va_list arg; @@ -133,7 +133,7 @@ char *BLI_sprintfN(const char *format, ...) * 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 @@ escape_finish: * * 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 @@ char *BLI_str_quoted_substrN(const char *str, const char *prefix) /* 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); diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index e80f96ee0fe..16a5f03095d 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -184,7 +184,7 @@ static const size_t utf8_skip_data[256] = { *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 @@ char *BLI_strncpy_utf8(char *dst, const char *src, size_t maxncpy) return dst_r; } -char *BLI_strncat_utf8(char *dst, const char *src, size_t maxncpy) +char *BLI_strncat_utf8(char *__restrict dst, const char *__restrict src, size_t maxncpy) { while (*dst && maxncpy > 0) { dst++; @@ -213,7 +213,7 @@ char *BLI_strncat_utf8(char *dst, const char *src, size_t maxncpy) /* --------------------------------------------------------------------------*/ /* wchar_t / utf8 functions */ -size_t BLI_strncpy_wchar_as_utf8(char *dst, const wchar_t *src, const size_t maxncpy) +size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst, const wchar_t *__restrict src, const size_t maxncpy) { size_t len = 0; @@ -289,7 +289,7 @@ size_t BLI_strnlen_utf8(const char *start, const size_t maxlen) return len; } -size_t BLI_strncpy_wchar_from_utf8(wchar_t *dst_w, const char *src_c, const size_t maxncpy) +size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w, const char *__restrict src_c, const size_t maxncpy) { int len = 0; @@ -419,7 +419,7 @@ unsigned int BLI_str_utf8_as_unicode(const char *p) } /* variant that increments the length */ -unsigned int BLI_str_utf8_as_unicode_and_size(const char *p, size_t *index) +unsigned int BLI_str_utf8_as_unicode_and_size(const char *__restrict p, size_t *__restrict index) { int i, mask = 0, len; unsigned int result; @@ -435,7 +435,7 @@ unsigned int BLI_str_utf8_as_unicode_and_size(const char *p, size_t *index) /* another variant that steps over the index, * note, currently this also falls back to latin1 for text drawing. */ -unsigned int BLI_str_utf8_as_unicode_step(const char *p, size_t *index) +unsigned int BLI_str_utf8_as_unicode_step(const char *__restrict p, size_t *__restrict index) { int i, mask = 0, len; unsigned int result; |