mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 05:00:35 +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);
|
struct expr_s *protocols);
|
||||||
void class_finish_module (void);
|
void class_finish_module (void);
|
||||||
|
|
||||||
|
void class_to_struct (class_t *class, struct struct_s *strct);
|
||||||
|
|
||||||
typedef struct protocol_s {
|
typedef struct protocol_s {
|
||||||
const char *name;
|
const char *name;
|
||||||
struct methodlist_s *methods;
|
struct methodlist_s *methods;
|
||||||
|
|
|
@ -851,3 +851,17 @@ clear_classes (void)
|
||||||
if (class_hash)
|
if (class_hash)
|
||||||
class_Class.super_class = get_class ("Object", 1);
|
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
|
if (e->type == ex_def
|
||||||
&& !(e->e.def->type->type == ev_func
|
&& !(e->e.def->type->type == ev_func
|
||||||
&& e->e.def->global)
|
&& e->e.def->global)
|
||||||
|
&& !(e->e.def->type->type == ev_struct)
|
||||||
&& !e->e.def->external
|
&& !e->e.def->external
|
||||||
&& !e->e.def->initialized) {
|
&& !e->e.def->initialized) {
|
||||||
warning (e, "%s may be used uninitialized", e->e.def->name);
|
warning (e, "%s may be used uninitialized", e->e.def->name);
|
||||||
|
|
|
@ -244,12 +244,12 @@ storage_class
|
||||||
struct_defs
|
struct_defs
|
||||||
: /* empty */
|
: /* empty */
|
||||||
| struct_defs struct_def ';'
|
| struct_defs struct_def ';'
|
||||||
| DEFS '(' NAME ')'
|
| DEFS '(' maybe_class ')'
|
||||||
{
|
{
|
||||||
class_t *class = get_class ($3, 0);
|
class_t *class = get_class ($3, 0);
|
||||||
|
|
||||||
if (class) {
|
if (class) {
|
||||||
copy_struct_fields (current_struct, class->ivars);
|
class_to_struct (class, current_struct);
|
||||||
} else {
|
} else {
|
||||||
error (0, "undefined symbol `%s'", $3);
|
error (0, "undefined symbol `%s'", $3);
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,17 +156,6 @@ get_struct (const char *name, int create)
|
||||||
return s;
|
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
|
int
|
||||||
struct_compare_fields (struct_t *s1, struct_t *s2)
|
struct_compare_fields (struct_t *s1, struct_t *s2)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue