This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix implicit declaration warnings for alloca in target files
> On Thu, Sep 16, 2004 at 08:55:50AM -0400, Kaveh R. Ghazi wrote:
> > +/* GCC always provides __builtin_alloca(x). */
> > +#ifndef alloca
> > +#define alloca(x) __builtin_alloca(x)
> > +#endif
>
> Should be #undef, not #ifndef.
> r~
Done, thanks. Here's what I checked in:
2004-09-15 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* tsystem.h (alloca): Provide a default definition.
Revert:
2001-08-31 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* unwind-dw2.c: Call __builtin_alloca, not alloca.
diff -rup orig/egcc-CVS20040919/gcc/tsystem.h egcc-CVS20040919/gcc/tsystem.h
--- orig/egcc-CVS20040919/gcc/tsystem.h 2004-09-03 13:44:36.000000000 -0400
+++ egcc-CVS20040919/gcc/tsystem.h 2004-09-20 17:40:23.759807820 -0400
@@ -117,4 +117,8 @@ extern int errno;
#define NULL 0
#endif
+/* GCC always provides __builtin_alloca(x). */
+#undef alloca
+#define alloca(x) __builtin_alloca(x)
+
#endif /* ! GCC_TSYSTEM_H */
diff -rup orig/egcc-CVS20040919/gcc/unwind-dw2.c egcc-CVS20040919/gcc/unwind-dw2.c
--- orig/egcc-CVS20040919/gcc/unwind-dw2.c 2004-09-07 21:32:54.000000000 -0400
+++ egcc-CVS20040919/gcc/unwind-dw2.c 2004-09-20 17:40:07.981316123 -0400
@@ -840,7 +840,7 @@ execute_cfa_program (const unsigned char
unused_rs = unused_rs->prev;
}
else
- new_rs = __builtin_alloca (sizeof (struct frame_state_reg_info));
+ new_rs = alloca (sizeof (struct frame_state_reg_info));
*new_rs = fs->regs;
fs->regs.prev = new_rs;