This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] patch for valarray support
Robert Lipe <robertlipe@usa.net> writes:
| > I've checked in both the mainline and the gcc-2.95 branch the
| > patch appended below.
|
| This patch breaks on systems without <alloca.h>. There is even a
| comment in the code to that effect.
|
| Simply removing the include <alloca.h> in std/std_valarray.h works for
| my targets.
|
| Could you please adjust this?
The following should fix that inconvenience.
-- Gaby
* std/std_valarray.h: Don't #include unconditionally <alloca.h>
Index: std/std_valarray.h
===================================================================
RCS file: /cvs/egcs/egcs/libstdc++/std/std_valarray.h,v
retrieving revision 1.1
diff -r1.1 std_valarray.h
43c43,67
< #include <alloca.h> // XXX non-standard.
---
> #ifndef alloca
> #ifdef __GNUC__
> #define alloca __builtin_alloca
> #else /* not GNU C. */
> #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
> #include <alloca.h>
> #else /* not sparc */
> #if defined (MSDOS) && !defined (__TURBOC__)
> #include <malloc.h>
> #else /* not MSDOS, or __TURBOC__ */
> #if defined(_AIX)
> #include <malloc.h>
> #pragma alloca
> #else /* not MSDOS, __TURBOC__, or _AIX */
> #ifdef __hpux
> #endif /* __hpux */
> #endif /* not _AIX */
> #endif /* not MSDOS, or __TURBOC__ */
> #endif /* not sparc. */
> #endif /* not GNU C. */
> #endif /* alloca not defined. */
>
> extern "C" {
> void* alloca(size_t);
> }