mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 06:51:47 +00:00
make @defs work properly and don't do uninitialized checks on structs
This commit is contained in:
parent
83334ce633
commit
7d830ffc1f
5 changed files with 19 additions and 13 deletions
|
@ -100,6 +100,8 @@ void category_add_protocol_methods (category_t *category,
|
|||
struct expr_s *protocols);
|
||||
void class_finish_module (void);
|
||||
|
||||
void class_to_struct (class_t *class, struct struct_s *strct);
|
||||
|
||||
typedef struct protocol_s {
|
||||
const char *name;
|
||||
struct methodlist_s *methods;
|
||||
|
|
|
@ -851,3 +851,17 @@ clear_classes (void)
|
|||
if (class_hash)
|
||||
class_Class.super_class = get_class ("Object", 1);
|
||||
}
|
||||
|
||||
void
|
||||
class_to_struct (class_t *class, struct_t *strct)
|
||||
{
|
||||
|
||||
struct_field_t *s = class->ivars->struct_head;
|
||||
|
||||
if (class->super_class) {
|
||||
class_to_struct (class->super_class, strct);
|
||||
s = s->next;
|
||||
}
|
||||
for (; s; s = s->next)
|
||||
new_struct_field (strct, s->type, s->name, vis_public);
|
||||
}
|
||||
|
|
|
@ -288,6 +288,7 @@ check_initialized (expr_t *e)
|
|||
if (e->type == ex_def
|
||||
&& !(e->e.def->type->type == ev_func
|
||||
&& e->e.def->global)
|
||||
&& !(e->e.def->type->type == ev_struct)
|
||||
&& !e->e.def->external
|
||||
&& !e->e.def->initialized) {
|
||||
warning (e, "%s may be used uninitialized", e->e.def->name);
|
||||
|
|
|
@ -244,12 +244,12 @@ storage_class
|
|||
struct_defs
|
||||
: /* empty */
|
||||
| struct_defs struct_def ';'
|
||||
| DEFS '(' NAME ')'
|
||||
| DEFS '(' maybe_class ')'
|
||||
{
|
||||
class_t *class = get_class ($3, 0);
|
||||
|
||||
if (class) {
|
||||
copy_struct_fields (current_struct, class->ivars);
|
||||
class_to_struct (class, current_struct);
|
||||
} else {
|
||||
error (0, "undefined symbol `%s'", $3);
|
||||
}
|
||||
|
|
|
@ -156,17 +156,6 @@ get_struct (const char *name, int create)
|
|||
return s;
|
||||
}
|
||||
|
||||
void
|
||||
copy_struct_fields (struct_t *dst, struct_t *src)
|
||||
{
|
||||
struct_field_t *s;
|
||||
|
||||
if (!src)
|
||||
return;
|
||||
for (s = src->struct_head; s; s = s->next)
|
||||
new_struct_field (dst, s->type, s->name, s->visibility);
|
||||
}
|
||||
|
||||
int
|
||||
struct_compare_fields (struct_t *s1, struct_t *s2)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue