[qfcc] Use a union to manage function attributes

Same idea as the specifiers, but makes checking function types are the
same much easier.
This commit is contained in:
Bill Currie 2022-02-05 18:49:40 +09:00
parent f153e87daa
commit 8cc6cbc157
3 changed files with 8 additions and 3 deletions

View file

@ -39,7 +39,12 @@ typedef struct ty_func_s {
struct type_s *type; struct type_s *type;
int num_params; int num_params;
struct type_s **param_types; struct type_s **param_types;
int no_va_list; ///< don't inject va_list for ... function union {
struct {
unsigned no_va_list:1;///< don't inject va_list for ... function
};
unsigned attribute_bits;
};
} ty_func_t; } ty_func_t;
typedef struct ty_fldptr_s { typedef struct ty_fldptr_s {

View file

@ -90,7 +90,7 @@ type_t type_IMP = {
.alignment = 1, .alignment = 1,
.width = 1, .width = 1,
.meta = ty_basic, .meta = ty_basic,
{{&type_id, -3, IMP_params, 1}}, {{&type_id, -3, IMP_params, .no_va_list = 1}},
}; };
type_t type_super = { type_t type_super = {
.type = ev_invalid, .type = ev_invalid,

View file

@ -379,7 +379,7 @@ types_same (type_t *a, type_t *b)
case ev_func: case ev_func:
if (a->t.func.type != b->t.func.type if (a->t.func.type != b->t.func.type
|| a->t.func.num_params != b->t.func.num_params || a->t.func.num_params != b->t.func.num_params
|| a->t.func.no_va_list != b->t.func.no_va_list) || a->t.func.attribute_bits != b->t.func.attribute_bits)
return 0; return 0;
count = a->t.func.num_params; count = a->t.func.num_params;
if (count < 0) if (count < 0)