diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-06 00:57:13 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-06 00:57:13 +0400 |
commit | ce2e2b141e67e5be8cc85bc394dc6ca9e15f774b (patch) | |
tree | 50508e0df59ab92fce66648e354a337d5de20fce /intern/guardedalloc | |
parent | b438c2840cbf533830ecb29b1ef65325d3f77f73 (diff) |
use gcc malloc attribute for low level allocation functions, prevents gcc from checking if resulting pointers alias existing pointers, also use sentinel attribute for uiButGetStrInfo so incorrect usage gives a warning.
Diffstat (limited to 'intern/guardedalloc')
-rw-r--r-- | intern/guardedalloc/MEM_guardedalloc.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h index d46d7ad67bc..0939fe1cf86 100644 --- a/intern/guardedalloc/MEM_guardedalloc.h +++ b/intern/guardedalloc/MEM_guardedalloc.h @@ -98,6 +98,7 @@ extern "C" { * newly allocated block. */ void *MEM_dupallocN(const void *vmemh) #if MEM_GNU_ATTRIBUTES + __attribute__((malloc)) __attribute__((warn_unused_result)) #endif ; @@ -109,6 +110,7 @@ extern "C" { * over from existing memory. */ void *MEM_reallocN_id(void *vmemh, size_t len, const char *str) #if MEM_GNU_ATTRIBUTES + __attribute__((malloc)) __attribute__((warn_unused_result)) __attribute__((alloc_size(2))) #endif @@ -119,6 +121,7 @@ extern "C" { */ void *MEM_recallocN_id(void *vmemh, size_t len, const char *str) #if MEM_GNU_ATTRIBUTES + __attribute__((malloc)) __attribute__((warn_unused_result)) __attribute__((alloc_size(2))) #endif @@ -133,6 +136,7 @@ extern "C" { * pointer to it is stored ! */ void *MEM_callocN(size_t len, const char *str) #if MEM_GNU_ATTRIBUTES + __attribute__((malloc)) __attribute__((warn_unused_result)) __attribute__((nonnull(2))) __attribute__((alloc_size(1))) @@ -145,6 +149,7 @@ extern "C" { * */ void *MEM_mallocN(size_t len, const char *str) #if MEM_GNU_ATTRIBUTES + __attribute__((malloc)) __attribute__((warn_unused_result)) __attribute__((nonnull(2))) __attribute__((alloc_size(1))) @@ -157,6 +162,7 @@ extern "C" { * */ void *MEM_mapallocN(size_t len, const char *str) #if MEM_GNU_ATTRIBUTES + __attribute__((malloc)) __attribute__((warn_unused_result)) __attribute__((nonnull(2))) __attribute__((alloc_size(1))) |