X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Ftr%2Ftrverify.c;h=3c535bbe9616fe15542a469e83f59a1c140eff27;hb=e88385016800d3c56c3fa09770e9f7995c42e106;hp=15b2e91c19b4a2e8ba422dc636f3249fd8a54ad9;hpb=5f9013339e1d6492a0960bd6a4c470eb29351c7e;p=libfirm diff --git a/ir/tr/trverify.c b/ir/tr/trverify.c index 15b2e91c1..3c535bbe9 100644 --- a/ir/tr/trverify.c +++ b/ir/tr/trverify.c @@ -267,21 +267,21 @@ static int check_visited_flag(ir_graph *irg, ir_node *n) /** * helper environment struct for constant_on_wrong_obstack() */ -struct myenv { +typedef struct myenv { int res; ir_graph *irg; -}; +} myenv; /** * called by the walker */ -static void on_irg_storage(ir_node *n, void *env) +static void on_irg_storage(ir_node *n, void *data) { - struct myenv *myenv = env; + myenv *env = (myenv*)data; /* We also test whether the setting of the visited flag is legal. */ - myenv->res = node_is_in_irgs_storage(myenv->irg, n) && - check_visited_flag(myenv->irg, n); + env->res = node_is_in_irgs_storage(env->irg, n) && + check_visited_flag(env->irg, n); } /** @@ -290,7 +290,7 @@ static void on_irg_storage(ir_node *n, void *env) */ static int constant_on_wrong_irg(ir_node *n) { - struct myenv env; + myenv env; env.res = 1; /* on right obstack */ env.irg = get_const_code_irg(); @@ -408,7 +408,7 @@ int check_entity(ir_entity *ent) */ static void check_tore(type_or_ent tore, void *env) { - int *res = env; + int *res = (int*)env; assert(tore.ent); if (is_type(tore.typ)) { *res = check_type(tore.typ); @@ -423,18 +423,31 @@ static void check_tore(type_or_ent tore, void *env) */ int tr_verify(void) { - int res = no_error; - ir_type *constructors; - ir_type *destructors; - ir_type *thread_locals; - int i; static ident *empty = NULL; + int res = no_error; + ir_type *constructors; + ir_type *destructors; + ir_type *thread_locals; + int i; + ir_segment_t s; if (empty == NULL) empty = new_id_from_chars("", 0); type_walk(check_tore, NULL, &res); + for (s = IR_SEGMENT_FIRST; s <= IR_SEGMENT_LAST; ++s) { + const ir_type *type = get_segment_type(s); + int e; + for (e = 0; e < get_compound_n_members(type); ++e) { + ir_entity *entity = get_compound_member(type, e); + ASSERT_AND_RET(get_entity_ld_ident(entity) != NULL || + get_entity_visibility(entity) == ir_visibility_private, + "segment members must have a name or visibility_private", + 1); + } + } + constructors = get_segment_type(IR_SEGMENT_CONSTRUCTORS); for (i = get_compound_n_members(constructors)-1; i >= 0; --i) { const ir_entity *entity = get_compound_member(constructors, i);