mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
[qfcc] Merge duplicate methods in interfaces
Duplicate methods in an interface (especially across protocols and between protocols and the interface) are both harmless and even to be expected. They certainly should not cause the compiler to demand duplicate method implementations :)
This commit is contained in:
parent
e33d83fc9e
commit
f6d650d473
2 changed files with 9 additions and 6 deletions
|
@ -631,8 +631,7 @@ class_add_methods (class_t *class, methodlist_t *methods)
|
|||
if (!methods)
|
||||
return;
|
||||
|
||||
*class->methods->tail = methods->head;
|
||||
class->methods->tail = methods->tail;
|
||||
copy_methods (class->methods, methods);
|
||||
free (methods);
|
||||
|
||||
methods_set_self_type (class, class->methods);
|
||||
|
@ -1260,8 +1259,7 @@ category_add_methods (category_t *category, methodlist_t *methods)
|
|||
{
|
||||
if (!methods)
|
||||
return;
|
||||
*category->methods->tail = methods->head;
|
||||
category->methods->tail = methods->tail;
|
||||
copy_methods (category->methods, methods);
|
||||
free (methods);
|
||||
|
||||
methods_set_self_type (category->class, category->methods);
|
||||
|
@ -1520,8 +1518,7 @@ protocol_add_methods (protocol_t *protocol, methodlist_t *methods)
|
|||
{
|
||||
if (!methods)
|
||||
return;
|
||||
*protocol->methods->tail = methods->head;
|
||||
protocol->methods->tail = methods->tail;
|
||||
copy_methods (protocol->methods, methods);
|
||||
free (methods);
|
||||
}
|
||||
|
||||
|
|
|
@ -147,6 +147,12 @@ add_method (methodlist_t *methodlist, method_t *method)
|
|||
if (method->next)
|
||||
internal_error (0, "add_method: method loop detected");
|
||||
|
||||
for (method_t *m = methodlist->head; m; m = m->next) {
|
||||
if (method_compare (m, method)) {
|
||||
debug (0, "dropping duplicate method: %s", method->name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
*methodlist->tail = method;
|
||||
methodlist->tail = &method->next;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue