From 9fe9c20a1570729f1bdd21a6f174ec045d2ff986 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Thu, 2 Dec 2004 16:26:35 +0000 Subject: [PATCH] fixed config.h include used xmalloc instead of malloc [r4558] --- ir/ir/ircgcons.c | 5 ++++- ir/ir/ircgopt.c | 2 +- ir/ir/ircons.c | 14 +++++++++++--- ir/ir/irdump.c | 8 +++++++- ir/ir/irdumptxt.c | 10 +++++++++- ir/ir/irflag.c | 2 +- ir/ir/irgmod.c | 2 +- ir/ir/irgopt.c | 14 +++++++------- ir/ir/irgraph.c | 9 ++++++--- ir/ir/irgwalk.c | 16 ++++++++++------ ir/ir/irgwalk_blk.c | 2 +- ir/ir/irmode.c | 12 +++++++----- ir/ir/irnode.c | 7 +++++-- ir/ir/irop.c | 4 +++- ir/ir/iropt.c | 12 +++++++++++- ir/ir/irprintf.c | 7 +++++-- ir/ir/irprog.c | 6 ++++-- ir/ir/irreflect.c | 17 +++++++++++++---- ir/ir/irvrfy.c | 2 +- 19 files changed, 107 insertions(+), 44 deletions(-) diff --git a/ir/ir/ircgcons.c b/ir/ir/ircgcons.c index 52f0dcd7b..75a5c8180 100644 --- a/ir/ir/ircgcons.c +++ b/ir/ir/ircgcons.c @@ -11,10 +11,13 @@ * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. */ #ifdef HAVE_CONFIG_H -# include +# include "config.h" #endif +#ifdef HAVE_STRING_H #include +#endif + #include #include "ircgcons.h" diff --git a/ir/ir/ircgopt.c b/ir/ir/ircgopt.c index 0fedf2350..060fc99e7 100644 --- a/ir/ir/ircgopt.c +++ b/ir/ir/ircgopt.c @@ -16,7 +16,7 @@ * Aufrufrelation bestimmt. */ #ifdef HAVE_CONFIG_H -# include +# include "config.h" #endif #include "ircgopt.h" diff --git a/ir/ir/ircons.c b/ir/ir/ircons.c index f59976f98..dd9388fb7 100644 --- a/ir/ir/ircons.c +++ b/ir/ir/ircons.c @@ -12,7 +12,17 @@ */ #ifdef HAVE_CONFIG_H -# include +# include "config.h" +#endif + +#ifdef HAVE_ALLOCA_H +#include +#endif +#ifdef HAVE_MALLOC_H +#include +#endif +#ifdef HAVE_STRING_H +#include #endif # include "irgraph_t.h" @@ -25,8 +35,6 @@ # include "iropt_t.h" # include "irgmod.h" # include "array.h" -/* memset belongs to string.h */ -# include "string.h" # include "irbackedge_t.h" # include "irflag_t.h" diff --git a/ir/ir/irdump.c b/ir/ir/irdump.c index 0a55d342f..4cb0f136e 100644 --- a/ir/ir/irdump.c +++ b/ir/ir/irdump.c @@ -9,10 +9,16 @@ * Copyright: (c) 1998-2003 Universität Karlsruhe * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif - +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif #include #include "firm_common_t.h" diff --git a/ir/ir/irdumptxt.c b/ir/ir/irdumptxt.c index 383278613..2ed06eded 100644 --- a/ir/ir/irdumptxt.c +++ b/ir/ir/irdumptxt.c @@ -1,6 +1,6 @@ /* * Project: libFIRM - * File name: ir/ir/irdump.c + * File name: ir/ir/irdumptxt.c * Purpose: Write vcg representation of firm to file. * Author: Martin Trapp, Christian Schaefer * Modified by: Goetz Lindenmaier, Hubert Schmidt @@ -9,9 +9,17 @@ * Copyright: (c) 1998-2003 Universität Karlsruhe * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif + #include #include "irdump_t.h" diff --git a/ir/ir/irflag.c b/ir/ir/irflag.c index 9d53b351e..f30d0d4dd 100644 --- a/ir/ir/irflag.c +++ b/ir/ir/irflag.c @@ -11,7 +11,7 @@ */ #ifdef HAVE_CONFIG_H -# include +# include "config.h" #endif #include "firm_common.h" diff --git a/ir/ir/irgmod.c b/ir/ir/irgmod.c index 3de1fa2c7..39f255c8c 100644 --- a/ir/ir/irgmod.c +++ b/ir/ir/irgmod.c @@ -11,7 +11,7 @@ */ #ifdef HAVE_CONFIG_H -# include +# include "config.h" #endif # include "irvrfy.h" diff --git a/ir/ir/irgopt.c b/ir/ir/irgopt.c index 27ce6fcac..babf9c55b 100644 --- a/ir/ir/irgopt.c +++ b/ir/ir/irgopt.c @@ -12,11 +12,10 @@ #ifdef HAVE_CONFIG_H -# include +# include "config.h" #endif #include -#include #include "irnode_t.h" #include "irgraph_t.h" @@ -32,6 +31,7 @@ #include "pset.h" #include "eset.h" #include "pdeq.h" /* Fuer code placement */ +#include "xmalloc.h" #include "irouts.h" #include "irloop_t.h" @@ -907,8 +907,8 @@ int inline_method(ir_node *call, ir_graph *called_graph) { arity = get_irn_arity(end_bl); /* arity = n_exc + n_ret */ n_res = get_method_n_ress(get_Call_type(call)); - res_pred = (ir_node **) malloc (n_res * sizeof (ir_node *)); - cf_pred = (ir_node **) malloc (arity * sizeof (ir_node *)); + res_pred = (ir_node **) xmalloc (n_res * sizeof (ir_node *)); + cf_pred = (ir_node **) xmalloc (arity * sizeof (ir_node *)); set_irg_current_block(current_ir_graph, post_bl); /* just to make sure */ @@ -1039,7 +1039,7 @@ int inline_method(ir_node *call, ir_graph *called_graph) { } main_end_bl = get_irg_end_block(current_ir_graph); main_end_bl_arity = get_irn_arity(main_end_bl); - end_preds = (ir_node **) malloc ((n_exc + main_end_bl_arity) * sizeof (ir_node *)); + end_preds = (ir_node **) xmalloc ((n_exc + main_end_bl_arity) * sizeof (ir_node *)); for (i = 0; i < main_end_bl_arity; ++i) end_preds[i] = get_irn_n(main_end_bl, i); @@ -1083,7 +1083,7 @@ int inline_method(ir_node *call, ir_graph *called_graph) { if (i < get_Block_n_cfgpreds(end_bl)) { bl = get_nodes_block(cf_op); arity = get_Block_n_cfgpreds(end_bl) + get_Block_n_cfgpreds(bl) - 1; - cf_pred = (ir_node **) malloc (arity * sizeof (ir_node *)); + cf_pred = (ir_node **) xmalloc (arity * sizeof (ir_node *)); for (j = 0; j < i; j++) cf_pred[j] = get_Block_cfgpred(end_bl, j); for (j = j; j < i + get_Block_n_cfgpreds(bl); j++) @@ -1215,7 +1215,7 @@ typedef struct { } inline_irg_env; static inline_irg_env *new_inline_irg_env(void) { - inline_irg_env *env = malloc(sizeof(inline_irg_env)); + inline_irg_env *env = xmalloc(sizeof(inline_irg_env)); env->n_nodes = -2; /* uncount Start, End */ env->n_nodes_orig = -2; /* uncount Start, End */ env->call_nodes = eset_create(); diff --git a/ir/ir/irgraph.c b/ir/ir/irgraph.c index 2e5c0f511..e33d1ea12 100644 --- a/ir/ir/irgraph.c +++ b/ir/ir/irgraph.c @@ -11,11 +11,14 @@ */ #ifdef HAVE_CONFIG_H -# include +# include "config.h" #endif +#ifdef HAVE_STRING_H # include +#endif +# include "xmalloc.h" # include "ircons.h" # include "irgraph_t.h" # include "irprog_t.h" @@ -86,7 +89,7 @@ new_r_ir_graph (entity *ent, int n_loc) ir_node *first_block; ir_node *projX; - res = (ir_graph *) malloc (sizeof (ir_graph)); + res = (ir_graph *) xmalloc (sizeof (ir_graph)); memset(res, 0, sizeof (ir_graph)); res->kind = k_ir_graph; @@ -195,7 +198,7 @@ ir_graph *new_const_code_irg(void) { ir_graph *res; ir_node *projX; - res = (ir_graph *) malloc (sizeof(*res)); + res = (ir_graph *) xmalloc (sizeof(*res)); memset(res, 0, sizeof(*res)); /* inform statistics here, as blocks will be already build on this graph */ diff --git a/ir/ir/irgwalk.c b/ir/ir/irgwalk.c index e34402d58..2df2c1809 100644 --- a/ir/ir/irgwalk.c +++ b/ir/ir/irgwalk.c @@ -11,17 +11,21 @@ */ /** -* traverse an ir graph -* - execute the pre function before recursion -* - execute the post function after recursion -*/ + * @file irgwalk.c + * + * traverse an ir graph + * - execute the pre function before recursion + * - execute the post function after recursion + */ #ifdef HAVE_CONFIG_H -# include +# include "config.h" #endif -#include +#ifdef HAVE_STDLIB_H +# include +#endif #include "irnode_t.h" #include "irgraph_t.h" /* visited flag */ diff --git a/ir/ir/irgwalk_blk.c b/ir/ir/irgwalk_blk.c index 413747ba1..9e04aeac0 100644 --- a/ir/ir/irgwalk_blk.c +++ b/ir/ir/irgwalk_blk.c @@ -10,7 +10,7 @@ * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. */ #ifdef HAVE_CONFIG_H -# include +# include "config.h" #endif #include "irnode_t.h" diff --git a/ir/ir/irmode.c b/ir/ir/irmode.c index de7ed6340..d1591e3e5 100644 --- a/ir/ir/irmode.c +++ b/ir/ir/irmode.c @@ -9,16 +9,18 @@ * Copyright: (c) 1998-2003 Universität Karlsruhe * Licence: This file protected by GPL - GNU GENERAL PUBLIC LICENSE. */ - - #ifdef HAVE_CONFIG_H -# include +# include "config.h" #endif +#ifdef HAVE_STDLIB_H # include -# include +#endif +#ifdef HAVE_STRING_H # include -# include +#endif + +# include # include "irmode_t.h" # include "ident.h" diff --git a/ir/ir/irnode.c b/ir/ir/irnode.c index d13d3140b..ce3d3e646 100644 --- a/ir/ir/irnode.c +++ b/ir/ir/irnode.c @@ -11,9 +11,12 @@ */ #ifdef HAVE_CONFIG_H -# include +# include "config.h" +#endif + +#ifdef HAVE_STRING_H +# include #endif -#include #include "ident.h" #include "irnode_t.h" diff --git a/ir/ir/irop.c b/ir/ir/irop.c index 8074dc7d4..da43121b7 100644 --- a/ir/ir/irop.c +++ b/ir/ir/irop.c @@ -11,10 +11,12 @@ */ #ifdef HAVE_CONFIG_H -# include +# include "config.h" #endif +#ifdef HAVE_STRING_H # include +#endif # include "irop_t.h" # include "irnode_t.h" diff --git a/ir/ir/iropt.c b/ir/ir/iropt.c index 2a8df25bd..6b3e6b418 100644 --- a/ir/ir/iropt.c +++ b/ir/ir/iropt.c @@ -11,7 +11,17 @@ */ #ifdef HAVE_CONFIG_H -# include +# include "config.h" +#endif + +#ifdef HAVE_ALLOCA_H +#include +#endif +#ifdef HAVE_MALLOC_H +#include +#endif +#ifdef HAVE_STRING_H +#include #endif # include "irnode_t.h" diff --git a/ir/ir/irprintf.c b/ir/ir/irprintf.c index f87fe0c40..e6705b51d 100644 --- a/ir/ir/irprintf.c +++ b/ir/ir/irprintf.c @@ -18,12 +18,15 @@ */ #ifdef HAVE_CONFIG_H -#include +#include "config.h" #endif #include #include -#include + +#ifdef HAVE_STRING_H +# include +#endif #include "ident.h" #include "irmode_t.h" diff --git a/ir/ir/irprog.c b/ir/ir/irprog.c index 1e58c68c3..233b145bd 100644 --- a/ir/ir/irprog.c +++ b/ir/ir/irprog.c @@ -11,10 +11,12 @@ */ #ifdef HAVE_CONFIG_H -# include +# include "config.h" #endif +#ifdef HAVE_STRING_H # include +#endif # include "irprog_t.h" # include "irgraph_t.h" @@ -58,7 +60,7 @@ INLINE void remove_irp_type_from_list (type *typ) { ir_prog *new_ir_prog (void) { ir_prog *res; - res = (ir_prog *) malloc (sizeof(ir_prog)); + res = (ir_prog *) xmalloc (sizeof(ir_prog)); memset(res, 0, sizeof(res)); irp = res; /* res->obst = (struct obstack *) xmalloc (sizeof (struct obstack)); */ diff --git a/ir/ir/irreflect.c b/ir/ir/irreflect.c index ad211f6a3..b88aa3c6b 100644 --- a/ir/ir/irreflect.c +++ b/ir/ir/irreflect.c @@ -6,10 +6,19 @@ * * $Id$ */ - -#include -#include -#include +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#ifdef HAVE_STDLIB_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif #define obstack_chunk_alloc malloc #define obstack_chunk_free free diff --git a/ir/ir/irvrfy.c b/ir/ir/irvrfy.c index 44cddfe81..a7f3ef32f 100644 --- a/ir/ir/irvrfy.c +++ b/ir/ir/irvrfy.c @@ -11,7 +11,7 @@ */ #ifdef HAVE_CONFIG_H -# include +# include "config.h" #endif # include "irprog.h" -- 2.20.1