From: Matthias Braun Date: Fri, 5 Feb 2010 22:28:10 +0000 (+0000) Subject: constructors/destructors must not have a name X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=9892d7b1232ce0a8129228bd088fef4ac0121dc2;p=libfirm constructors/destructors must not have a name [r27077] --- diff --git a/ir/ident/ident.c b/ir/ident/ident.c index 38e37a4f7..f129eb584 100644 --- a/ir/ident/ident.c +++ b/ir/ident/ident.c @@ -60,8 +60,6 @@ static ident *set_new_id_from_chars(void *handle, const char *str, int len) { set *id_set = handle; - /* GL: Who added this assert? And why? */ - //assert(len > 0); return (ident *)set_hinsert0(id_set, str, len, ID_HASH(unsigned char, str, len)); } @@ -160,13 +158,12 @@ void init_ident(ident_if_t *id_if, int initial_n_idents) ident *new_id_from_str(const char *str) { - assert(str); + assert(str != NULL); return impl.new_id_from_str(impl.handle, str); } ident *new_id_from_chars(const char *str, int len) { - assert(len > 0); return impl.new_id_from_chars(impl.handle, str, len); } diff --git a/ir/tr/trvrfy.c b/ir/tr/trvrfy.c index 504b32a5f..1d11b46ef 100644 --- a/ir/tr/trvrfy.c +++ b/ir/tr/trvrfy.c @@ -418,6 +418,10 @@ int tr_vrfy(void) ir_type *constructors; ir_type *destructors; int i; + static ident *empty = NULL; + + if (empty == NULL) + empty = new_id_from_chars("", 0); type_walk(check_tore, NULL, &res); @@ -427,6 +431,9 @@ int tr_vrfy(void) ASSERT_AND_RET(get_entity_linkage(entity) & IR_LINKAGE_HIDDEN_USER, "entity without LINKAGE_HIDDEN_USER in constructors is pointless", 1); + /* Mach-O doesn't like labels in this section */ + ASSERT_AND_RET(get_entity_ld_ident(entity), + "entity in constructors should have ld_ident ''", 1); } destructors = get_segment_type(IR_SEGMENT_DESTRUCTORS); for (i = get_compound_n_members(destructors)-1; i >= 0; --i) { @@ -434,6 +441,9 @@ int tr_vrfy(void) ASSERT_AND_RET(get_entity_linkage(entity) & IR_LINKAGE_HIDDEN_USER, "entity without LINKAGE_HIDDEN_USER in destructors is pointless", 1); + /* Mach-O doesn't like labels in this section */ + ASSERT_AND_RET(get_entity_ld_ident(entity), + "entity in destructors should have ld_ident ''", 1); } return res;