2008-09-04
2008-09-04 11:36:45 by Henrik Grubbström (Grubba) <grubba@grubba.org>
-
2fb986bf22b9c68fb3b9090ba5fd53b018949e14
(33 lines)
(+27/-6)
[
Show
| Annotate
]
Branch: 7.9
Added duplicate filtering pass to fixate_program() after fsort_program_identifier_index().
This fixes issues where duplicate identifiers shows up in indices() on objects.
Made program_identifier_index_compare() more stable.
Added output of the identifier name in the identifier index table in dump_program_tables().
Rev: src/program.c:1.753
2:
|| This file is part of Pike. For copyright information see COPYRIGHT.
|| Pike is distributed under GPL, LGPL and MPL. See the file COPYING
|| for more information.
- || $Id: program.c,v 1.752 2008/09/03 14:46:13 mast Exp $
+ || $Id: program.c,v 1.753 2008/09/04 11:36:45 grubba Exp $
*/
#include "global.h"
1952:
{
size_t val_a = PTR_TO_INT (ID_FROM_INT(p, a)->name);
size_t val_b = PTR_TO_INT (ID_FROM_INT(p, b)->name);
- return val_a < val_b ? -1 : (val_a == val_b ? 0 : 1);
+ return val_a < val_b ? -1 : (val_a == val_b ? (a < b? -1:(a != b)) : 1);
}
#define CMP(X,Y) program_identifier_index_compare(*(X), *(Y), prog)
2237:
p->num_identifier_index - 1,
p);
+ /* Take care of duplicates in the identifier index table;
+ * this can happen eg when the overloading definition is
+ * before an inherit being overloaded. This happens for
+ * eg the default master object.
+ */
+ if (p->num_identifier_index) {
+ struct identifier *id = ID_FROM_INT(p, p->identifier_index[0]);
+ for (e = i = 1; e < p->num_identifier_index; e++) {
+ struct identifier *probe = ID_FROM_INT(p, p->identifier_index[e]);
+ if (probe == id) {
+ /* Duplicate. */
+ continue;
+ }
+ p->identifier_index[i++] = p->identifier_index[e];
+ id = probe;
+ }
+ p->num_identifier_index = i;
+ }
p->flags |= PROGRAM_FIXED;
3036: Inside #if defined(PIKE_DEBUG)
fprintf(stderr, "\n"
"%*sIdentifier index table:\n"
- "%*s ####: Index\n",
+ "%*s ####: Index\tName\n",
indent, "", indent, "");
for (d = 0; d < p->num_identifier_index; d++) {
- fprintf(stderr, "%*s %4d: %5d\n",
+ struct identifier *id = ID_FROM_INT(p, p->identifier_index[d]);
+ fprintf(stderr, "%*s %4d: %5d\t%s\n",
indent, "",
- d, p->identifier_index[d]);
+ d, p->identifier_index[d],
+ id->name->size_shift ? "(wide)" : id->name->str);
}
fprintf(stderr, "\n"
5593:
*
* FIXME: Force PRIVATE?
*/
- flags |= ID_PROTECTED;
+ flags |= ID_PROTECTED /* | ID_PRIVATE | ID_INLINE | ID_USED */;
free_type(symbol_type);
free_string(symbol);
}