Commit fbcb96cc authored by Götz Lindenmaier's avatar Götz Lindenmaier
Browse files

moved misc.h to adt, splitted into misc and xmalloc,

updated dependencies, removed unused stuff and stdbool header

[r1727]
parent be2183c3
......@@ -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
......
......@@ -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
......@@ -23,6 +25,12 @@
#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
......
......@@ -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 */
......
......@@ -17,7 +17,7 @@
#include <stdlib.h>
#include <string.h>
#include "debug.h"
#include "misc.h"
#include "xmalloc.h"
int
......
/*
* 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_ */
......@@ -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
......@@ -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 */
......
......@@ -15,6 +15,7 @@
#define _PDEQ_H_
#include <string.h>
#include "misc.h"
typedef struct pdeq pdeq;
......
......@@ -66,12 +66,14 @@
#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"
......
......@@ -19,7 +19,8 @@
#include <stdlib.h>
#include <string.h>
#include "misc.h"
#include "xmalloc.h"
#include "panic.h"
......
/*
* 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_ */
......@@ -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
......
......@@ -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 fr jede Methode */
......
......@@ -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"
......
......@@ -15,14 +15,15 @@
# 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;
......
......@@ -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; }
......
......@@ -23,15 +23,12 @@
#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;
......
......@@ -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"
......
......@@ -15,7 +15,7 @@
# include <config.h>
#endif
# include "misc.h"
# include "xmalloc.h"
# include "tpop_t.h"
# include "type_t.h"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment