Patch to add ATTRIBUTE_MALLOC to libiberty C_alloca
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Sun Jan 27 10:09:00 GMT 2002
This patch adds ATTRIBUTE_MALLOC to C_alloca in libiberty. This would
be useful if one uses gcc and defines USE_C_ALLOCA when compiling code
using libiberty, (e.g. on a platform where stack space is restricted.)
I tested the patch by adding USE_C_ALLOCA to BOOT_CFLAGS on
sparc-sun-solaris2.7 and bootstrapping (minus java, because of some
unrelated libffi failures.) There were no testsuite regressions.
Incidently, it also verifies that using C_alloca in stage2,3 has no
inherent problems either. :-)
Ok to install?
Thanks,
--Kaveh
PS: I wonder whether __builtin_alloca marks itself so that the
appropriate ATTRIBUTE_MALLOC aliasing info also gets propagated.
Anyone know?
2002-01-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* libiberty.h (C_alloca): Add ATTRIBUTE_MALLOC.
diff -rup orig/egcc-CVS20020120/include/libiberty.h egcc-CVS20020120/include/libiberty.h
--- orig/egcc-CVS20020120/include/libiberty.h Mon Oct 22 23:13:10 2001
+++ egcc-CVS20020120/include/libiberty.h Mon Jan 21 10:33:36 2002
@@ -283,7 +283,7 @@ extern int vasprintf PARAMS ((char **, c
USE_C_ALLOCA yourself. The canonical autoconf macro C_ALLOCA is
also set/unset as it is often used to indicate whether code needs
to call alloca(0). */
-extern PTR C_alloca PARAMS((size_t));
+extern PTR C_alloca PARAMS ((size_t)) ATTRIBUTE_MALLOC;
#undef alloca
#if GCC_VERSION >= 2000 && !defined USE_C_ALLOCA
# define alloca(x) __builtin_alloca(x)
More information about the Gcc-patches
mailing list