From: Paul Eggert Date: Fri, 13 Dec 2002 08:44:28 +0000 (+0000) Subject: (alloca): Remove; decl no longer needed. X-Git-Tag: BISON-1_875~81 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/deedb0b77c569bf6be408e67cb07bad6c7ce1214?ds=sidebyside (alloca): Remove; decl no longer needed. (): Include, for offsetof. (, ): Include if available. (uintptr_t): New type, if system lacks it. (CALLOC, MALLOC, REALLOC): New macros. All uses of XCALLOC, XMALLOC, and XREALLOC changed to use these new macros. --- diff --git a/src/system.h b/src/system.h index 50149c98..bf1ef4cc 100644 --- a/src/system.h +++ b/src/system.h @@ -22,23 +22,7 @@ # include #endif -/* AIX requires this to be the first thing in the file. */ -#ifdef __GNUC__ -# define alloca(Size) __builtin_alloca (Size) -#else -# if HAVE_ALLOCA_H -# include -# else -# ifdef _AIX - #pragma alloca -# else -# ifndef alloca /* predefined by HP cc +Olibcalls */ -char *alloca (); -# endif -# endif -# endif -#endif - +#include #include /* Verify a requirement at compile-time (unlike assert, which is runtime). */ @@ -81,7 +65,24 @@ char *alloca (); #include +#if HAVE_UINTPTR_T +# if HAVE_INTTYPES_H +# include +# else +# if HAVE_STDINT_H +# include +# endif +# endif +#else +/* This isn't perfect, but it's good enough for Bison, which needs + only to hash pointers. */ +typedef size_t uintptr_t; +#endif + #include +#define CALLOC(P, N) ((P) = xcalloc (N, sizeof *(P))) +#define MALLOC(P, N) ((P) = xmalloc ((N) * sizeof *(P))) +#define REALLOC(P, N) ((P) = xrealloc (P, (N) * sizeof *(P))) /* From xstrndup.c. */ char *xstrndup (const char *s, size_t n);