Index: ChangeLog =================================================================== --- ChangeLog (revision 37548) +++ ChangeLog (working copy) @@ -1,3 +1,14 @@ +Thu Nov 8 14:50:03 2012 Akinori MUSHA + + * include/ruby/ruby.h (alloca), eval_intern.h, gc.c: Make alloca + universally work by placing the ultimate ifdef's in ruby/ruby.h. + Gcc hides its builtin alloca() when -ansi is given, and build + thus fails on platforms that lack their own alloca() + implementation in libc, such as OpenBSD and some ports of + NetBSD. + + * addr2line.c (alloca): Place the ultimate ifdef's for alloca. + Thu Nov 8 11:32:11 2012 Akinori MUSHA * configure.in (--with-opt-dir): Avoid nesting of double quotes Index: addr2line.c =================================================================== --- addr2line.c (revision 37548) +++ addr2line.c (working copy) @@ -32,9 +32,26 @@ #include #include -#if defined(HAVE_ALLOCA_H) -#include -#endif +/* Make alloca work the best possible way. */ +#ifdef __GNUC__ +# ifndef atarist +# ifndef alloca +# define alloca __builtin_alloca +# endif +# endif /* atarist */ +#else +# ifdef HAVE_ALLOCA_H +# include +# else +# ifdef _AIX +#pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +void *alloca(); +# endif +# endif /* AIX */ +# endif /* HAVE_ALLOCA_H */ +#endif /* __GNUC__ */ #ifdef HAVE_DL_ITERATE_PHDR # ifndef _GNU_SOURCE Index: eval_intern.h =================================================================== --- eval_intern.h (revision 37548) +++ eval_intern.h (working copy) @@ -31,27 +31,6 @@ #include #endif -/* Make alloca work the best possible way. */ -#ifdef __GNUC__ -# ifndef atarist -# ifndef alloca -# define alloca __builtin_alloca -# endif -# endif /* atarist */ -#else -# ifdef HAVE_ALLOCA_H -# include -# else -# ifdef _AIX -#pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -void *alloca(); -# endif -# endif /* AIX */ -# endif /* HAVE_ALLOCA_H */ -#endif /* __GNUC__ */ - #ifndef HAVE_STRING_H char *strrchr(const char *, const char); #endif Index: gc.c =================================================================== --- gc.c (revision 37548) +++ gc.c (working copy) @@ -65,27 +65,6 @@ #define rb_setjmp(env) RUBY_SETJMP(env) #define rb_jmp_buf rb_jmpbuf_t -/* Make alloca work the best possible way. */ -#ifdef __GNUC__ -# ifndef atarist -# ifndef alloca -# define alloca __builtin_alloca -# endif -# endif /* atarist */ -#else -# ifdef HAVE_ALLOCA_H -# include -# else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -void *alloca (); -# endif -# endif /* AIX */ -# endif /* HAVE_ALLOCA_H */ -#endif /* __GNUC__ */ - #ifndef GC_MALLOC_LIMIT #define GC_MALLOC_LIMIT 8000000 #endif Index: include/ruby/ruby.h =================================================================== --- include/ruby/ruby.h (revision 37548) +++ include/ruby/ruby.h (working copy) @@ -73,13 +73,26 @@ extern "C" { #pragma GCC visibility push(default) #endif -#if defined(HAVE_ALLOCA_H) -#include +/* Make alloca work the best possible way. */ +#ifdef __GNUC__ +# ifndef atarist +# ifndef alloca +# define alloca __builtin_alloca +# endif +# endif /* atarist */ #else +# ifdef HAVE_ALLOCA_H +# include +# else # ifdef _AIX #pragma alloca -# endif -#endif +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +void *alloca(); +# endif +# endif /* AIX */ +# endif /* HAVE_ALLOCA_H */ +#endif /* __GNUC__ */ #if defined HAVE_UINTPTR_T && 0 typedef uintptr_t VALUE;