2 Copyright (C) 1995, 1996 Markus Armbruster
3 All rights reserved. */
10 /* Declare alloca() */
13 /* @@@ on a true GNU system, this is defined by stdlib.h */
15 # define alloca(size) __builtin_alloca (size)
20 # if defined(_AIX) && !defined(C_ALLOCA)
21 /* if your version of AIX chokes on this, use gcc @@@ or alloca.o */
24 # ifndef alloca /* predefined by HP cc +Olibcalls */
35 /* Alignment of nodes, cf common/tag.h, a power of two.
37 Most nodes are allocated from obstacks and therefore are aligned
38 identically on the obstacks' alignment boundary. We'd like gcc to
39 align *all* nodes identically to avoid its cast-align warning and
40 perhaps allow for better code. Since the common node alignment is
41 not known in time, we use an educated guess and check it against
42 the correct value later. */
43 #define NODE_ALIGN ALIGNOF (struct { void *p; int i; })
49 # define MAX(a,b) ((a) > (b) ? (a) : (b))
52 # define MIN(a,b) ((a) > (b) ? (b) : (a))
55 #define IS_POW2(n) ((((n)-1) & (n)) == 0)
57 typedef int (*cmp_fun) (const void *, const void *);
60 /* xmalloc() & friends.
62 The macros set tmalloc_tag to __FILE__, the functions leave it
63 alone. Use the latter if you set it yourself. See tmalloc.c for
66 extern void *xmalloc (size_t);
67 extern void *xrealloc (void *, size_t);
68 extern char *xstrdup (const char *);
69 extern void xnomem (void);
71 # define xmalloc(size) (XMALLOC_TRACE (xmalloc) ((size)))
72 # define xrealloc(ptr, size) (XMALLOC_TRACE (xrealloc) ((ptr), (size)))
73 # define xstrdup(str) (XMALLOC_TRACE (xstrdup) ((str)))
74 # define xfree(ptr) (XMALLOC_TRACE free ((ptr)))
76 #if defined(HAVE_GNU_MALLOC) && defined(DEBUG)
77 extern const char *tmalloc_tag;
78 # define XMALLOC_TRACE tmalloc_tag = __FILE__,
80 # define XMALLOC_TRACE