]> Savannah Git Hosting - gnulib.git/commit
xalloc: no attribute (malloc (free)) on inline
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 2 Aug 2021 05:27:49 +0000 (22:27 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 2 Aug 2021 05:28:48 +0000 (22:28 -0700)
commit9b69ffb766a2f6c0a06ad4b71040209534fde094
tree91595e961514d1f2710c769516b1d1d9c1d08e9f
parent49782e402f5cd7b3fa83eae9c425715c94fc459d
xalloc: no attribute (malloc (free)) on inline

The GCC manual says you can’t use __attribute__ ((__malloc__
(free, 1))) on inline functions.  Problem discovered when
compiling diffutils 3.8 on RHEL 8.4 using a GCC 11.2.0 that I
built myself.  Perhaps the problem was not discovered earlier
because the attribute works with ‘free’ (which is what I was
seeing before on Fedora 34) but not with ‘rpl_free’ (seen on RHEL
8.4).  Anyway, the GCC manual says it shouldn’t work at all, so
don’t use it.
* lib/xalloc.h (xnmalloc, xcharalloc): No longer inline.
* lib/xmalloc.c (xcharalloc, xnmalloc): Move function bodies here.
* m4/gnulib-common.m4 (_GL_ATTRIBUTE_DEALLOC)
(_GL_ATTRIBUTE_DEALLOC_FREE): Document that these cannot be
used on inline functions, as per the GCC 11.2.1 manual.
ChangeLog
lib/xalloc.h
lib/xmalloc.c
m4/gnulib-common.m4