[RFA]: Add declaration for `alloca' to stdlib.h

Corinna Vinschen vinschen@redhat.com
Wed Jan 3 17:24:00 GMT 2001


newlib omits a declaration for alloca() in stdlib.h as it's described
e.g. in the Linux man pages.

The following patch to libc/include/stdlib.h does that.  It declares
alloca() as external unless __GNUC__ is defined.  In that case alloca()
is defined as __builtin_alloca().

Another way to implement that would be to include <alloca.h> if the
system has that file (as e.g. for linux in libc/sys/linux/include).

If you prefer that, I will propose another patch which only includes
alloca.h for Linux and Cygwin and add a alloca.h file to libc/sys/cygwin.


2001-11-12  Corinna Vinschen  <vinschen@redhat.com>

	* libc/include/stdlib.h: Add declaration for alloca().

Index: libc/include/stdlib.h
RCS file: /cvs/src/src/newlib/libc/include/stdlib.h,v
retrieving revision 1.11
diff -u -p -r1.11 stdlib.h
--- stdlib.h	2001/10/01 18:05:09	1.11
+++ stdlib.h	2001/11/12 12:50:04
@@ -45,6 +45,12 @@ extern __IMPORT int __mb_cur_max;
 _VOID	_EXFUN(abort,(_VOID) _ATTRIBUTE ((noreturn)));
 int	_EXFUN(abs,(int));
+#ifdef __GNUC__
+#define alloca(size) __builtin_alloca(size)
+void *	_EXFUN(alloca,(size_t));
 int	_EXFUN(atexit,(_VOID (*__func)(_VOID)));
 double	_EXFUN(atof,(const char *__nptr));
 #ifndef __STRICT_ANSI__

Corinna Vinschen
Cygwin Developer
Red Hat, Inc.

More information about the Newlib mailing list