mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-14 00:40:55 +00:00
[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:
parent
b2de2a9f3b
commit
75394cc4f8
2 changed files with 4 additions and 3 deletions
|
@ -94,11 +94,11 @@ typedef struct qfot_array_s {
|
||||||
arrays.
|
arrays.
|
||||||
*/
|
*/
|
||||||
typedef struct qfot_type_s {
|
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
|
pr_int_t size; ///< total word size of this encoding
|
||||||
string_t encoding; ///< Objective-QC encoding
|
string_t encoding; ///< Objective-QC encoding
|
||||||
union {
|
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_fldptr_t fldptr; ///< ty_basic, ev_pointer/ev_field
|
||||||
qfot_func_t func; ///< ty_basic, ev_func
|
qfot_func_t func; ///< ty_basic, ev_func
|
||||||
qfot_struct_t strct; ///< ty_struct/ty_union/ty_enum
|
qfot_struct_t strct; ///< ty_struct/ty_union/ty_enum
|
||||||
|
|
|
@ -151,7 +151,8 @@ qfo_encode_none (type_t *type)
|
||||||
else if (type->type == ev_pointer || type->type == ev_field)
|
else if (type->type == ev_pointer || type->type == ev_field)
|
||||||
return qfo_encode_fldptr (type);
|
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 = D_POINTER (qfot_type_t, def);
|
||||||
enc->t.type = type->type;
|
enc->t.type = type->type;
|
||||||
return def;
|
return def;
|
||||||
|
|
Loading…
Reference in a new issue