moved misc.h to adt, splitted into misc and xmalloc,
authorGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Wed, 20 Aug 2003 09:56:28 +0000 (09:56 +0000)
committerGötz Lindenmaier <goetz@ipd.info.uni-karlsruhe.de>
Wed, 20 Aug 2003 09:56:28 +0000 (09:56 +0000)
updated dependencies, removed unused stuff and stdbool header

[r1727]

19 files changed:
ir/adt/Makefile.in
ir/adt/array.c
ir/adt/array.h
ir/adt/debug.c
ir/adt/misc.h [new file with mode: 0644]
ir/adt/obst.h
ir/adt/pdeq.c
ir/adt/pdeq.h
ir/adt/set.c
ir/adt/xmalloc.c
ir/adt/xmalloc.h [new file with mode: 0644]
ir/common/Makefile.in
ir/ir/ircgcons.c
ir/ir/irgopt.c
ir/ir/irmode.c
ir/ir/irop.c
ir/st/st.c
ir/tr/mangle.c
ir/tr/tpop.c

index 58ee167..6d14ac7 100644 (file)
@@ -17,8 +17,10 @@ subdir := ir/adt
 disable_libiberty := @disable_libiberty@
 
 
-SOURCES = Makefile.in array.c array.h cookies.h debug.c debug.h host.h obst.h \
-          pdeq.c pdeq.h pset.h set.c set.h pmap.h pmap.c eset.h eset.c
+SOURCES = Makefile.in                                                  \
+       array.c array.h cookies.h debug.c debug.h host.h obst.h         \
+       pdeq.c pdeq.h pset.h set.c set.h pmap.h pmap.c eset.h eset.c    \
+       misc.h xmalloc.h
 
 ifeq ($(disable_libiberty),no)
 SOURCES += xmalloc.c
index 1c4ab0a..b73eac2 100644 (file)
@@ -15,7 +15,9 @@
 #endif
 
 #include <stdlib.h>
+
 #include "array.h"
+#include "xmalloc.h"
 
 /* Undefine the macros to get the functions instead, cf tmalloc.c.  */
 #undef xmalloc
 #undef xstrdup
 #undef xfree
 
+#ifndef MAX
+# define MAX(a,b) ((a) > (b) ? (a) : (b))
+#endif
+#ifndef MIN
+# define MIN(a,b) ((a) > (b) ? (b) : (a))
+#endif
 
 _arr_descr arr_mt_descr
 #ifndef NDEBUG
index d4b4173..43dd9eb 100644 (file)
@@ -18,8 +18,9 @@
 #include <assert.h>
 #include <stddef.h>
 #include <obstack.h>
+
 #include "cookies.h"
-#include "misc.h"
+#include "xmalloc.h"
 
 
 /* Flexible create / delete */
index edb6876..e8616d3 100644 (file)
@@ -17,7 +17,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "debug.h"
-#include "misc.h"
+#include "xmalloc.h"
 
 
 int
diff --git a/ir/adt/misc.h b/ir/adt/misc.h
new file mode 100644 (file)
index 0000000..7de7315
--- /dev/null
@@ -0,0 +1,20 @@
+/*
+ * Project:     libFIRM
+ * File name:   ir/adt/misc.h
+ * Purpose:     Misc. declarations.
+ * Author:      Markus Armbruster
+ * Modified by:
+ * Created:     1999 by getting from fiasco
+ * CVS-ID:      $Id$
+ * Copyright:   (c) 1995, 1996 Markus Armbruster
+ * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ */
+
+#ifndef _MISC_H_
+#define _MISC_H_
+
+/* Miscellaneous */
+
+typedef int (*cmp_fun) (const void *, const void *);
+
+#endif /* _MISC_H_ */
index a25482a..865c96a 100644 (file)
@@ -15,5 +15,7 @@
 # include <stdlib.h>
 # include <strings.h>
 
+# include "xmalloc.h"
+
 # define obstack_chunk_alloc xmalloc
-# define obstack_chunk_free free
+# define obstack_chunk_free  free
index 51211c2..284da05 100644 (file)
@@ -18,6 +18,7 @@
 #include <assert.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdbool.h>
 # ifdef HAVE_STRING_H
 #  include <string.h>
 # endif
@@ -25,6 +26,7 @@
 #include "cookies.h"
 #include "debug.h"
 #include "pdeq.h"
+#include "xmalloc.h"
 
 
 /** Size of pdeq block cache */
index a8043dc..f9c5239 100644 (file)
@@ -15,6 +15,7 @@
 #define _PDEQ_H_
 
 #include <string.h>
+
 #include "misc.h"
 
 typedef struct pdeq pdeq;
index 9a30bd5..f43a0a3 100644 (file)
 #include <stdio.h>
 #include <string.h>
 #include "misc.h"
+#include "xmalloc.h"
 #ifdef PSET
 # include "pset.h"
 #else
 # include "set.h"
 #endif
 
+
 #define TOBSTACK_ID MANGLEP(tag)
 #include "obst.h"
 
index 087a0db..89ab63a 100644 (file)
@@ -19,7 +19,8 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include "misc.h"
+
+#include "xmalloc.h"
 #include "panic.h"
 
 
diff --git a/ir/adt/xmalloc.h b/ir/adt/xmalloc.h
new file mode 100644 (file)
index 0000000..942c3ff
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * Project:     libFIRM
+ * File name:   ir/adt/xmalloc.h
+ * Purpose:     More comfortable allocations.
+ * Author:      Markus Armbruster
+ * Modified by:
+ * Created:     1999 by getting from fiasco
+ * CVS-ID:      $Id$
+ * Copyright:   (c) 1995, 1996 Markus Armbruster
+ * Licence:     This file protected by GPL -  GNU GENERAL PUBLIC LICENSE.
+ */
+
+
+#ifndef _XMALLOC_H_
+#define _XMALLOC_H_
+
+#include "host.h"
+
+/* Declare alloca() */
+
+#ifdef __GNUC__
+  /* @@@ on a true GNU system, this is defined by stdlib.h */
+# undef alloca
+# define alloca(size) __builtin_alloca (size)
+#else
+# if HAVE_ALLOCA_H
+#   include <alloca.h>
+# else
+#   if defined(_AIX) && !defined(C_ALLOCA)
+      /* if your version of AIX chokes on this, use gcc @@@ or alloca.o */
+    #pragma alloca
+#   else
+#     ifndef alloca /* predefined by HP cc +Olibcalls */
+void *alloca ();
+#     endif
+#   endif
+# endif
+#endif
+
+/* xmalloc() & friends.
+
+   The macros set tmalloc_tag to __FILE__, the functions leave it
+   alone.  Use the latter if you set it yourself.  See tmalloc.c for
+   details.  */
+
+extern void *xmalloc (size_t);
+extern void *xrealloc (void *, size_t);
+extern char *xstrdup (const char *);
+extern void  xnomem (void);
+extern void  free (void *);
+
+# define xmalloc(size)       (XMALLOC_TRACE (xmalloc) ((size)))
+# define xrealloc(ptr, size) (XMALLOC_TRACE (xrealloc) ((ptr), (size)))
+# define xstrdup(str)        (XMALLOC_TRACE (xstrdup) ((str)))
+# define xfree(ptr)          (XMALLOC_TRACE free ((ptr)))
+
+#if defined(HAVE_GNU_MALLOC) && defined(DEBUG)
+extern const char *tmalloc_tag;
+# define XMALLOC_TRACE tmalloc_tag = __FILE__,
+#else
+# define XMALLOC_TRACE
+#endif
+
+#endif /* _XMALLOC_H_ */
index e3e068c..bdb6699 100644 (file)
@@ -19,8 +19,9 @@ INSTALL_HEADERS := firm_common.h firm.h firmwalk.h
 
 SOURCES = $(INSTALL_HEADERS)
 
-SOURCES += Makefile.in panic.c firm_common.c firm.c firmwalk.c \
-               misc.h panic.h firm_common_t.h
+SOURCES += Makefile.in                                                 \
+       panic.c firm_common.c firm.c firmwalk.c                 \
+       panic.h firm_common_t.h
 
 include $(topdir)/MakeRules
 
index 5c72a40..be6d0f8 100644 (file)
@@ -13,6 +13,7 @@
 
 
 #include <string.h>
+#include <stdbool.h>
 #include "ircgcons.h"
 
 #include "array.h"
@@ -21,7 +22,6 @@
 #include "irgmod.h"
 #include "irgwalk.h"
 #include "irflag.h"
-#include "misc.h"
 
 
 /* Datenstruktur für jede Methode */
index c5e7b04..c63a524 100644 (file)
@@ -16,6 +16,7 @@
 #endif
 
 # include <assert.h>
+# include <stdbool.h>
 
 # include "irprog.h"
 # include "irgopt.h"
@@ -24,7 +25,6 @@
 # include "iropt_t.h"
 # include "irgwalk.h"
 # include "ircons.h"
-# include "misc.h"
 # include "irgmod.h"
 # include "array.h"
 # include "pset.h"
index e0bb6ee..f3b62e7 100644 (file)
 # include <config.h>
 #endif
 
-# include "irmode_t.h"
-# include "ident.h"
 # include <stdlib.h>
 # include <stddef.h>
 # include <string.h>
+# include <stdbool.h>
+
+# include "irmode_t.h"
+# include "ident.h"
 # include "tv.h"
 # include "obst.h"
-# include "misc.h"
 
 #if 0
 static long long count = 0;
index 79a0730..26b46a3 100644 (file)
@@ -18,7 +18,8 @@
 
 # include "irop_t.h"
 # include "irnode_t.h"
-# include "misc.h"
+
+# include "xmalloc.h"
 
 ir_op *op_Block;           ir_op *get_op_Block     () { return op_Block;     }
 
index ed7d501..26f083d 100644 (file)
 #include "config.h"
 #endif
 
-# include "st.h"
+# include <stdio.h>
+# include <stdlib.h>
 
+# include "st.h"
 # include "irgwalk.h"
-
-#  include <stdio.h>
-# ifdef DEBUG_libfirm
-# endif /* def DEBUG_libfirm */
-#  include <stdlib.h>
-# include "misc.h"
+# include "xmalloc.h"
 
 /* init globals: */
 /*static*/ dtree_t *trees = 0;
index 9bca822..5adb666 100644 (file)
@@ -18,7 +18,6 @@
 
 # include "mangle.h"
 # include "obst.h"
-# include "misc.h"
 
 /* Make types visible to allow most efficient access */
 # include "entity_t.h"
index 71885e0..13454a5 100644 (file)
@@ -15,7 +15,7 @@
 # include <config.h>
 #endif
 
-# include "misc.h"
+# include "xmalloc.h"
 # include "tpop_t.h"
 # include "type_t.h"