Branch: Tag:

2012-10-09

2012-10-09 12:36:34 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Don't complain about unused private LFUNs. Fixes [bug 6553].

2373:    if (ref->id_flags & ID_HIDDEN) continue;    if (ref->inherit_offset != 0) continue;    override_identifier (ref, ID_FROM_PTR (p, ref)->name); -  -  if ((ref->id_flags & (ID_HIDDEN|ID_PRIVATE|ID_USED)) == ID_PRIVATE) { -  yywarning("%S is private but not used anywhere.", -  ID_FROM_PTR(p, ref)->name); +     } -  } +        /* Ok, sort for binsearch */    for(e=i=0;i<(int)p->num_identifier_references;i++)
2496:    /* Yes, it is supposed to start at 1 /Hubbe */    for(i=1;i<NUM_LFUNS;i++) {    int id = p->lfuns[i] = low_find_lfun(p, i); +  if (id >= 0) { +  // LFUNs are used. +  p->identifier_references[id].id_flags |= ID_USED;    } -  +  }    -  +  /* Complain about unused private symbols. */ +  for (i = 0; i < p->num_identifier_references; i++) { +  struct reference *ref = p->identifier_references + i; +  if (ref->id_flags & ID_HIDDEN) continue; +  if (ref->inherit_offset != 0) continue; +  +  if ((ref->id_flags & (ID_HIDDEN|ID_PRIVATE|ID_USED)) == ID_PRIVATE) { +  yywarning("%S is private but not used anywhere.", +  ID_FROM_PTR(p, ref)->name); +  } +  } +     /* Set the PROGRAM_LIVE_OBJ flag by looking for destroy() and    * inherited PROGRAM_LIVE_OBJ flags. This is done at fixation time    * to allow the user to set and clear that flag while the program is