constructors/destructors must not have a name
authorMatthias Braun <matze@braunis.de>
Fri, 5 Feb 2010 22:28:10 +0000 (22:28 +0000)
committerMatthias Braun <matze@braunis.de>
Fri, 5 Feb 2010 22:28:10 +0000 (22:28 +0000)
[r27077]

ir/ident/ident.c
ir/tr/trvrfy.c

index 38e37a4..f129eb5 100644 (file)
@@ -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);
 }
 
index 504b32a..1d11b46 100644 (file)
@@ -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;