diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2021-08-01 22:27:49 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2021-08-01 22:28:48 -0700 |
commit | 9b69ffb766a2f6c0a06ad4b71040209534fde094 (patch) | |
tree | 91595e961514d1f2710c769516b1d1d9c1d08e9f /ChangeLog | |
parent | 49782e402f5cd7b3fa83eae9c425715c94fc459d (diff) | |
download | gnulib-9b69ffb766a2f6c0a06ad4b71040209534fde094.tar.gz |
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.
Diffstat (limited to 'ChangeLog')
-rw-r--r-- | ChangeLog | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -1,5 +1,20 @@ 2021-08-01 Paul Eggert <eggert@cs.ucla.edu> + 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. + sigsegv-tests: make more things static * tests/test-sigsegv-catch-segv1.c: * tests/test-sigsegv-catch-stackoverflow1.c: |