Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/guides/blender-guardedalloc.txt2
-rw-r--r--intern/guardedalloc/MEM_guardedalloc.h4
-rw-r--r--intern/guardedalloc/intern/mallocn.c4
-rw-r--r--intern/guardedalloc/intern/mallocn_guarded_impl.c4
-rw-r--r--intern/guardedalloc/intern/mallocn_intern.h4
-rw-r--r--intern/guardedalloc/intern/mallocn_lockfree_impl.c2
-rw-r--r--intern/guardedalloc/test/simpletest/memtest.c4
-rw-r--r--source/blender/blenkernel/intern/cachefile.c1
-rw-r--r--source/blender/blenlib/BLI_assert.h47
-rw-r--r--source/blender/blenlib/intern/math_base_inline.c2
-rw-r--r--source/blender/depsgraph/intern/depsgraph_types.h1
-rw-r--r--source/blender/depsgraph/util/deg_util_function.h2
12 files changed, 35 insertions, 42 deletions
diff --git a/doc/guides/blender-guardedalloc.txt b/doc/guides/blender-guardedalloc.txt
index 3db647a4e77..2e49f25bd92 100644
--- a/doc/guides/blender-guardedalloc.txt
+++ b/doc/guides/blender-guardedalloc.txt
@@ -51,7 +51,7 @@ void MEM_printmemlist(void);
- if err_stream is set by MEM_set_error_stream() this function dumps a list of all
currently allocated memory blocks with length and name to the stream
-int MEM_check_memory_integrity(void);
+bool MEM_consistency_check(void);
- this function tests if the internal structures of the memory manager are intact
- returns 0 on success and !=0 on error
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h
index a57921223e2..65650209711 100644
--- a/intern/guardedalloc/MEM_guardedalloc.h
+++ b/intern/guardedalloc/MEM_guardedalloc.h
@@ -165,8 +165,8 @@ extern "C" {
/**
* Are the start/end block markers still correct ?
*
- * @retval 0 for correct memory, 1 for corrupted memory. */
- extern bool (*MEM_check_memory_integrity)(void);
+ * @retval true for correct memory, false for corrupted memory. */
+ extern bool (*MEM_consistency_check)(void);
/** Set thread locking functions for safe memory allocation from multiple
* threads, pass NULL pointers to disable thread locking again. */
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index b973037358b..a95cc9163c4 100644
--- a/intern/guardedalloc/intern/mallocn.c
+++ b/intern/guardedalloc/intern/mallocn.c
@@ -53,7 +53,7 @@ void (*MEM_printmemlist)(void) = MEM_lockfree_printmemlist;
void (*MEM_callbackmemlist)(void (*func)(void *)) = MEM_lockfree_callbackmemlist;
void (*MEM_printmemlist_stats)(void) = MEM_lockfree_printmemlist_stats;
void (*MEM_set_error_callback)(void (*func)(const char *)) = MEM_lockfree_set_error_callback;
-bool (*MEM_check_memory_integrity)(void) = MEM_lockfree_check_memory_integrity;
+bool (*MEM_consistency_check)(void) = MEM_lockfree_consistency_check;
void (*MEM_set_lock_callback)(void (*lock)(void), void (*unlock)(void)) = MEM_lockfree_set_lock_callback;
void (*MEM_set_memory_debug)(void) = MEM_lockfree_set_memory_debug;
size_t (*MEM_get_memory_in_use)(void) = MEM_lockfree_get_memory_in_use;
@@ -119,7 +119,7 @@ void MEM_use_guarded_allocator(void)
MEM_callbackmemlist = MEM_guarded_callbackmemlist;
MEM_printmemlist_stats = MEM_guarded_printmemlist_stats;
MEM_set_error_callback = MEM_guarded_set_error_callback;
- MEM_check_memory_integrity = MEM_guarded_check_memory_integrity;
+ MEM_consistency_check = MEM_guarded_consistency_check;
MEM_set_lock_callback = MEM_guarded_set_lock_callback;
MEM_set_memory_debug = MEM_guarded_set_memory_debug;
MEM_get_memory_in_use = MEM_guarded_get_memory_in_use;
diff --git a/intern/guardedalloc/intern/mallocn_guarded_impl.c b/intern/guardedalloc/intern/mallocn_guarded_impl.c
index d012cce5334..d09f1b83ad4 100644
--- a/intern/guardedalloc/intern/mallocn_guarded_impl.c
+++ b/intern/guardedalloc/intern/mallocn_guarded_impl.c
@@ -282,7 +282,7 @@ static void mem_unlock_thread(void)
thread_unlock_callback();
}
-bool MEM_guarded_check_memory_integrity(void)
+bool MEM_guarded_consistency_check(void)
{
const char *err_val = NULL;
MemHead *listend;
@@ -292,7 +292,7 @@ bool MEM_guarded_check_memory_integrity(void)
err_val = check_memlist(listend);
- return (err_val != NULL);
+ return (err_val == NULL);
}
diff --git a/intern/guardedalloc/intern/mallocn_intern.h b/intern/guardedalloc/intern/mallocn_intern.h
index 4b2282ae9ad..754a79f08b5 100644
--- a/intern/guardedalloc/intern/mallocn_intern.h
+++ b/intern/guardedalloc/intern/mallocn_intern.h
@@ -137,7 +137,7 @@ void MEM_lockfree_printmemlist(void);
void MEM_lockfree_callbackmemlist(void (*func)(void *));
void MEM_lockfree_printmemlist_stats(void);
void MEM_lockfree_set_error_callback(void (*func)(const char *));
-bool MEM_lockfree_check_memory_integrity(void);
+bool MEM_lockfree_consistency_check(void);
void MEM_lockfree_set_lock_callback(void (*lock)(void), void (*unlock)(void));
void MEM_lockfree_set_memory_debug(void);
size_t MEM_lockfree_get_memory_in_use(void);
@@ -166,7 +166,7 @@ void MEM_guarded_printmemlist(void);
void MEM_guarded_callbackmemlist(void (*func)(void *));
void MEM_guarded_printmemlist_stats(void);
void MEM_guarded_set_error_callback(void (*func)(const char *));
-bool MEM_guarded_check_memory_integrity(void);
+bool MEM_guarded_consistency_check(void);
void MEM_guarded_set_lock_callback(void (*lock)(void), void (*unlock)(void));
void MEM_guarded_set_memory_debug(void);
size_t MEM_guarded_get_memory_in_use(void);
diff --git a/intern/guardedalloc/intern/mallocn_lockfree_impl.c b/intern/guardedalloc/intern/mallocn_lockfree_impl.c
index 2899a37a1b2..4c6ba0cb256 100644
--- a/intern/guardedalloc/intern/mallocn_lockfree_impl.c
+++ b/intern/guardedalloc/intern/mallocn_lockfree_impl.c
@@ -469,7 +469,7 @@ void MEM_lockfree_set_error_callback(void (*func)(const char *))
error_callback = func;
}
-bool MEM_lockfree_check_memory_integrity(void)
+bool MEM_lockfree_consistency_check(void)
{
return true;
}
diff --git a/intern/guardedalloc/test/simpletest/memtest.c b/intern/guardedalloc/test/simpletest/memtest.c
index 79d55dd02cc..d306337d0ab 100644
--- a/intern/guardedalloc/test/simpletest/memtest.c
+++ b/intern/guardedalloc/test/simpletest/memtest.c
@@ -90,7 +90,7 @@ int main(int argc, char *argv[])
if (verbose > 1) MEM_printmemlist();
/* memory is there: test it */
- error_status = MEM_check_memory_integrity();
+ error_status = MEM_consistency_check();
if (verbose) {
if (error_status) {
@@ -125,7 +125,7 @@ int main(int argc, char *argv[])
ip = (int*) p[6];
*(ip+10005) = 0;
- retval = MEM_check_memory_integrity();
+ retval = MEM_consistency_check();
/* the test should have failed */
error_status |= !retval;
diff --git a/source/blender/blenkernel/intern/cachefile.c b/source/blender/blenkernel/intern/cachefile.c
index f8215668034..aebec3dfeed 100644
--- a/source/blender/blenkernel/intern/cachefile.c
+++ b/source/blender/blenkernel/intern/cachefile.c
@@ -181,7 +181,6 @@ void BKE_cachefile_update_frame(Main *bmain, Scene *scene, const float ctime, co
ABC_free_handle(cache_file->handle);
cache_file->handle = ABC_create_handle(filename, NULL);
#endif
- break;
}
}
}
diff --git a/source/blender/blenlib/BLI_assert.h b/source/blender/blenlib/BLI_assert.h
index 9fb0954e77f..b66b95b21fe 100644
--- a/source/blender/blenlib/BLI_assert.h
+++ b/source/blender/blenlib/BLI_assert.h
@@ -46,33 +46,28 @@ extern "C" {
#ifndef NDEBUG
# include "BLI_system.h"
-# ifdef WITH_ASSERT_ABORT
-# define _BLI_DUMMY_ABORT abort
+ /* _BLI_ASSERT_PRINT_POS */
+# if defined(__GNUC__)
+# define _BLI_ASSERT_PRINT_POS(a) \
+ fprintf(stderr, "BLI_assert failed: %s:%d, %s(), at \'%s\'\n", __FILE__, __LINE__, __func__, #a)
+# elif defined(_MSC_VER)
+# define _BLI_ASSERT_PRINT_POS(a) \
+ fprintf(stderr, "BLI_assert failed: %s:%d, %s(), at \'%s\'\n", __FILE__, __LINE__, __FUNCTION__, #a)
# else
-# define _BLI_DUMMY_ABORT() (void)0
+# define _BLI_ASSERT_PRINT_POS(a) \
+ fprintf(stderr, "BLI_assert failed: %s:%d, at \'%s\'\n", __FILE__, __LINE__, #a)
# endif
-# if defined(__GNUC__) || defined(_MSC_VER) /* check __func__ is available */
-# define BLI_assert(a) \
- (void)((!(a)) ? ( \
- ( \
- BLI_system_backtrace(stderr), \
- fprintf(stderr, \
- "BLI_assert failed: %s:%d, %s(), at \'%s\'\n", \
- __FILE__, __LINE__, __func__, "" #a), \
- _BLI_DUMMY_ABORT(), \
- NULL)) : NULL)
+ /* _BLI_ASSERT_ABORT */
+# ifdef WITH_ASSERT_ABORT
+# define _BLI_ASSERT_ABORT abort
# else
-# define BLI_assert(a) \
- (void)((!(a)) ? ( \
- ( \
- fprintf(stderr, \
- "BLI_assert failed: %s:%d, at \'%s\'\n", \
- __FILE__, __LINE__, "" #a), \
- _BLI_DUMMY_ABORT(), \
- NULL)) : NULL)
+# define _BLI_ASSERT_ABORT() (void)0
# endif
+ /* BLI_assert */
+# define BLI_assert(a) \
+ (void)((!(a)) ? ((BLI_system_backtrace(stderr), _BLI_ASSERT_PRINT_POS(a), _BLI_ASSERT_ABORT(), NULL)) : NULL)
#else
-# define BLI_assert(a) (void)0
+# define BLI_assert(a) ((void)0)
#endif
/* C++ can't use _Static_assert, expects static_assert() but c++0x only,
@@ -85,19 +80,19 @@ extern "C" {
/* Code adapted from http://www.pixelbeat.org/programming/gcc/static_assert.html */
/* Note we need the two concats below because arguments to ## are not expanded, so we need to
* expand __LINE__ with one indirection before doing the actual concatenation. */
-# define ASSERT_CONCAT_(a, b) a##b
-# define ASSERT_CONCAT(a, b) ASSERT_CONCAT_(a, b)
+# define _BLI_ASSERT_CONCAT_(a, b) a##b
+# define _BLI_ASSERT_CONCAT(a, b) _BLI_ASSERT_CONCAT_(a, b)
/* These can't be used after statements in c89. */
# if defined(__COUNTER__) /* MSVC */
# define BLI_STATIC_ASSERT(a, msg) \
- ; enum { ASSERT_CONCAT(static_assert_, __COUNTER__) = 1 / (int)(!!(a)) };
+ ; enum { _BLI_ASSERT_CONCAT(static_assert_, __COUNTER__) = 1 / (int)(!!(a)) };
# else /* older gcc, clang... */
/* This can't be used twice on the same line so ensure if using in headers
* that the headers are not included twice (by wrapping in #ifndef...#endif)
* Note it doesn't cause an issue when used on same line of separate modules
* compiled with gcc -combine -fwhole-program. */
# define BLI_STATIC_ASSERT(a, msg) \
- ; enum { ASSERT_CONCAT(assert_line_, __LINE__) = 1 / (int)(!!(a)) };
+ ; enum { _BLI_ASSERT_CONCAT(assert_line_, __LINE__) = 1 / (int)(!!(a)) };
# endif
#endif
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c
index 1f517471407..eed06c7841b 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -368,10 +368,8 @@ MINLINE int compare_ff_relative(float a, float b, const float max_diff, const in
{
union {float f; int i;} ua, ub;
-#if 0 /* No BLI_assert in INLINE :/ */
BLI_assert(sizeof(float) == sizeof(int));
BLI_assert(max_ulps < (1 << 22));
-#endif
if (fabsf(a - b) <= max_diff) {
return 1;
diff --git a/source/blender/depsgraph/intern/depsgraph_types.h b/source/blender/depsgraph/intern/depsgraph_types.h
index f8699186866..b4a0dde1f35 100644
--- a/source/blender/depsgraph/intern/depsgraph_types.h
+++ b/source/blender/depsgraph/intern/depsgraph_types.h
@@ -43,6 +43,7 @@
*/
#include <string>
#include <vector>
+#include <algorithm>
struct bAction;
struct ChannelDriver;
diff --git a/source/blender/depsgraph/util/deg_util_function.h b/source/blender/depsgraph/util/deg_util_function.h
index da31bb037f9..96f52147fe7 100644
--- a/source/blender/depsgraph/util/deg_util_function.h
+++ b/source/blender/depsgraph/util/deg_util_function.h
@@ -30,7 +30,7 @@
#pragma once
-#if (__cplusplus > 199711L)
+#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1800)
#include <functional>