This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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

[Get raw message]
Hi,

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.

Corinna


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)
+#else
+void *	_EXFUN(alloca,(size_t));
+#endif
+
 int	_EXFUN(atexit,(_VOID (*__func)(_VOID)));
 double	_EXFUN(atof,(const char *__nptr));
 #ifndef __STRICT_ANSI__

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]