As mentioned in <https://lists.gnu.org/archive/html/bug-gnulib/2021-08/msg00092.html>, I believe the attribute will someday be supported also on inline functions.
2021-08-07 Bruno Haible <br...@clisp.org> ialloc: Prepare for allocation-deallocation checking. * lib/ialloc.h (imalloc, irealloc, icalloc): Add comment that deallocation must happen through 'free'. diff --git a/lib/ialloc.h b/lib/ialloc.h index ebe4aaa..5ceda46 100644 --- a/lib/ialloc.h +++ b/lib/ialloc.h @@ -43,13 +43,17 @@ _gl_alloc_nomem (void) return NULL; } -IALLOC_INLINE void * +IALLOC_INLINE +_GL_ATTRIBUTE_MALLOC /*_GL_ATTRIBUTE_DEALLOC_FREE*/ +void * imalloc (idx_t s) { return s <= SIZE_MAX ? malloc (s) : _gl_alloc_nomem (); } -IALLOC_INLINE void * +IALLOC_INLINE +/*_GL_ATTRIBUTE_DEALLOC_FREE*/ +void * irealloc (void *p, idx_t s) { /* Work around GNU realloc glitch by treating a zero size as if it @@ -57,7 +61,9 @@ irealloc (void *p, idx_t s) return s <= SIZE_MAX ? realloc (p, s | !s) : _gl_alloc_nomem (); } -IALLOC_INLINE void * +IALLOC_INLINE +_GL_ATTRIBUTE_MALLOC /*_GL_ATTRIBUTE_DEALLOC_FREE*/ +void * icalloc (idx_t n, idx_t s) { if (SIZE_MAX < n)