mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 01:11:45 +00:00
[qfcc] Warn when messaging a forward-declared class
But only once.
This commit is contained in:
parent
a4582e526d
commit
1bf56b28ac
3 changed files with 14 additions and 2 deletions
|
@ -48,6 +48,7 @@ typedef struct class_type_s {
|
|||
|
||||
typedef struct class_s {
|
||||
int defined;
|
||||
int interface_declared;
|
||||
const char *name;
|
||||
struct class_s *super_class;
|
||||
struct category_s *categories;
|
||||
|
|
|
@ -1042,7 +1042,10 @@ class_find_ivar (class_t *class, int vis, const char *name)
|
|||
symbol_t *ivar;
|
||||
|
||||
if (!class->ivars) {
|
||||
error (0, "accessing incomplete type %s", class->name);
|
||||
if (!class->interface_declared) {
|
||||
class->interface_declared = 1;
|
||||
error (0, "accessing incomplete type %s", class->name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
ivar = symtab_lookup (class->ivars, name);
|
||||
|
@ -1119,6 +1122,11 @@ class_message_response (class_t *class, int class_msg, expr_t *sel)
|
|||
if (!selector)
|
||||
return 0;
|
||||
if (class && class->type != &type_obj_object) {
|
||||
if (!class->interface_declared) {
|
||||
class->interface_declared = 1;
|
||||
warning (0, "cannot find interface declaration for `%s'",
|
||||
class->name);
|
||||
}
|
||||
while (c) {
|
||||
for (cat = c->categories; cat; cat = cat->next) {
|
||||
for (m = cat->methods->head; m; m = m->next) {
|
||||
|
|
|
@ -1612,6 +1612,7 @@ new_class_name
|
|||
$1 = check_redefined ($1);
|
||||
$$ = get_class ($1, 1);
|
||||
}
|
||||
$$->interface_declared = 1;
|
||||
current_class = &$$->class_type;
|
||||
if (!$1->table)
|
||||
symtab_addsymbol (current_symtab, $1);
|
||||
|
@ -1630,10 +1631,12 @@ class_with_super
|
|||
new_class_with_super
|
||||
: new_class_name ':' class_name
|
||||
{
|
||||
if (!$3->ivars) {
|
||||
if (!$3->interface_declared) {
|
||||
$3->interface_declared = 1;
|
||||
error (0, "cannot find interface declaration for `%s', "
|
||||
"superclass of `%s'", $3->name, $1->name);
|
||||
}
|
||||
$1->interface_declared = 1;
|
||||
$1->super_class = $3;
|
||||
$$ = $1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue