From 431905e63518af10b353747216bf52e278e54248 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 25 Jul 2016 19:24:52 +0200 Subject: allocsize is dangerous MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- include/malloc.h | 3 ++- include/slibc-alloc.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/malloc.h b/include/malloc.h index ab41632..aba1f0a 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -364,7 +364,8 @@ void* aligned_alloc(size_t, size_t) * @since Always. */ size_t malloc_usable_size(void*) - __GCC_ONLY(__attribute__((__warn_unused_result__))); + __GCC_ONLY(__attribute__((__warn_unused_result__))) + __warning("This function is dangerous, avoid using it instead of manual bookkeeping."); #endif /* TODO add mallopt, M_TRIME_THRESHOLD, M_TOP_PAD, M_MMAP_THRESHOLD, and M_MMAP_MAX */ diff --git a/include/slibc-alloc.h b/include/slibc-alloc.h index 7da40f9..e902f70 100644 --- a/include/slibc-alloc.h +++ b/include/slibc-alloc.h @@ -178,7 +178,8 @@ void secure_free(void*); * @since Always. */ size_t allocsize(void*) - __GCC_ONLY(__attribute__((__warn_unused_result__))); + __GCC_ONLY(__attribute__((__warn_unused_result__))) + __warning("This function is dangerous, avoid using it instead of manual bookkeeping."); /** * Variant of `realloc` that overrides newly allocated space -- cgit v1.2.3-70-g09d2