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