[Fwd: Re: [RFA]: Add declaration for `alloca' to stdlib.h]
Joel Sherrill
joel.sherrill at OARcorp.com
Wed Nov 14 21:08:31 UTC 2001
I noticed this on the newlib list. Haven't we had problems
because of a missing alloca() before? Does this help?
--joel
-------- Original Message --------
From: Corinna Vinschen <vinschen at redhat.com>
Subject: Re: [RFA]: Add declaration for `alloca' to stdlib.h
To: newlib <newlib at sources.redhat.com>
On Tue, Nov 13, 2001 at 05:26:18PM -0500, J. Johnston wrote:
> "J. Johnston" wrote:
> > This is a BSD-extension, it is not ANSI, POSIX, nor Single Unix.
> > It should be protected from __STRICT_ANSI__ applications.
> >
> > IMO, the file from libc/sys/linux/include could be copied to the common
> > include directory with an added __GNUC__ check. There is no reason that
> > other platforms couldn't use this functionality as well.
> >
> > The stdlib.h directory should include <alloca.h> only if not
>
> ^ replace "directory" with "header file"
> > __STRICT_ANSI__.
> >
> > -- Jeff J.
Which would result in the following patch. Ok to checkin?
2001-11-12 Corinna Vinschen <vinschen at redhat.com>
* libc/include/alloca.h: Move libc/sys/linux/include/alloca.h
to here. Rearrange for general inclusion by stdlib.h.
* libc/include/stdlib.h: Include <alloca.h> if __STRICT_ANSI__
isn't defined.
* libc/sys/linux/include/alloca.h: Move to libc/include.
Index: libc/include/alloca.h
===================================================================
--- libc/include/alloca.h.EMPTY Tue Nov 13 23:45:23 2001
+++ libc/include/alloca.h Tue Nov 13 23:38:21 2001
@@ -0,0 +1,19 @@
+/* libc/include/alloca.h - Allocate memory on stack */
+
+/* Written 2000 by Werner Almesberger */
+/* Rearranged for general inclusion by stdlib.h.
+ 2001, Corinna Vinschen <vinschen at redhat.com> */
+
+#ifndef _NEWLIB_ALLOCA_H
+#define _NEWLIB_ALLOCA_H
+
+#include "_ansi.h"
+#include <sys/reent.h>
+
+#ifdef __GNUC__
+#define alloca(size) __builtin_alloca(size)
+#else
+void * _EXFUN(alloca,(size_t));
+#endif
+
+#endif
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
--- libc/include/stdlib.h 2001/10/01 18:05:09 1.11
+++ libc/include/stdlib.h 2001/11/13 22:46:03
@@ -18,6 +18,10 @@ extern "C" {
#include <sys/reent.h>
+#ifndef __STRICT_ANSI__
+#include <alloca.h>
+#endif
+
typedef struct
{
int quot; /* quotient */
--
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen at redhat.com
More information about the users
mailing list