This is the mail archive of the
mailing list for the GCC project.
Re: malloc attributes and realloc
On Sun, 4 Jan 2004, Bruce Korb wrote:
> The source base still has quite a few references to plain "realloc",
Only two to really_call_realloc in c-parse.in, and realloc is poisoned in
system.h to prevent it being used directly other than through
> Another approach might simply be to say, "realloc has traditionally
> been used in way that can not allow the compiler to presume that all
> old aliases are now invalid. Therefore, let there be a new function,
But has xrealloc in libiberty been so used (whether or not realloc has)?
If not, it can be given the attribute and documented accordingly
(independently of glibc's choice to be stricter about the conforming
nature expected of code including <stdlib.h> and calling realloc). If it
has, libiberty could get a new function (and then all callers need
examining to work out which they should use).
(0.5% speed improvements are clearly desirable, if genuine, given the
persistent compile-time performace regressions.)
Joseph S. Myers