From ce2e2b141e67e5be8cc85bc394dc6ca9e15f774b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 5 Aug 2013 20:57:13 +0000 Subject: 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. --- intern/guardedalloc/MEM_guardedalloc.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'intern/guardedalloc/MEM_guardedalloc.h') 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))) -- cgit v1.2.3