[gamecode,qfcc] Use enums for type encoding types

The enums are forced to 32 bits via bitfield spec, so can't use sizeof
on them, but this makes switch enum checks work in gcc.
This commit is contained in:
Bill Currie 2020-03-27 12:24:14 +09:00
parent b2de2a9f3b
commit 75394cc4f8
2 changed files with 4 additions and 3 deletions

View file

@ -94,11 +94,11 @@ typedef struct qfot_array_s {
arrays.
*/
typedef struct qfot_type_s {
pr_int_t meta; ///< meta type: ty_meta_e
ty_meta_e meta:32; ///< meta type
pr_int_t size; ///< total word size of this encoding
string_t encoding; ///< Objective-QC encoding
union {
pr_int_t type; ///< ty_basic: etype_t
etype_t type:32; ///< ty_basic: etype_t
qfot_fldptr_t fldptr; ///< ty_basic, ev_pointer/ev_field
qfot_func_t func; ///< ty_basic, ev_func
qfot_struct_t strct; ///< ty_struct/ty_union/ty_enum

View file

@ -151,7 +151,8 @@ qfo_encode_none (type_t *type)
else if (type->type == ev_pointer || type->type == ev_field)
return qfo_encode_fldptr (type);
def = qfo_new_encoding (type, sizeof (enc->t.type));
// can't use sizeof on enc->t.type, but pr_uint_t is the backing type
def = qfo_new_encoding (type, sizeof (pr_uint_t));
enc = D_POINTER (qfot_type_t, def);
enc->t.type = type->type;
return def;