mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-22 18:31:27 +00:00
[qfcc] Use a union to manage specifier bits
Having to remember to copy yet another specifier bit was getting tedious, so use a union of a struct with the bitfields and an unsigned int to access them in parallel. Makes for a tidier spec_merge, and one less headache.
This commit is contained in:
parent
078f36a871
commit
f153e87daa
2 changed files with 16 additions and 17 deletions
|
@ -89,16 +89,21 @@ typedef struct {
|
|||
struct param_s *params;
|
||||
struct symbol_s *sym; ///< for dealing with "int id" etc
|
||||
storage_class_t storage;
|
||||
unsigned multi_type:1;
|
||||
unsigned multi_store:1;
|
||||
unsigned is_signed:1;
|
||||
unsigned is_unsigned:1;
|
||||
unsigned is_short:1;
|
||||
unsigned is_long:1;
|
||||
unsigned is_typedef:1;
|
||||
unsigned is_overload:1;
|
||||
unsigned nosave:1;
|
||||
unsigned no_va_list:1;
|
||||
union {
|
||||
struct {
|
||||
unsigned multi_type:1;
|
||||
unsigned multi_store:1;
|
||||
unsigned is_signed:1;
|
||||
unsigned is_unsigned:1;
|
||||
unsigned is_short:1;
|
||||
unsigned is_long:1;
|
||||
unsigned is_typedef:1;
|
||||
unsigned is_overload:1;
|
||||
unsigned nosave:1;
|
||||
unsigned no_va_list:1;
|
||||
};
|
||||
unsigned spec_bits;
|
||||
};
|
||||
} specifier_t;
|
||||
|
||||
#define EV_TYPE(type) extern type_t type_##type;
|
||||
|
|
|
@ -290,13 +290,7 @@ spec_merge (specifier_t spec, specifier_t new)
|
|||
}
|
||||
}
|
||||
spec.sym = new.sym;
|
||||
spec.is_signed |= new.is_signed;
|
||||
spec.is_unsigned |= new.is_unsigned;
|
||||
spec.is_short |= new.is_short;
|
||||
spec.is_long |= new.is_long;
|
||||
spec.is_overload |= new.is_overload;
|
||||
spec.nosave |= new.nosave;
|
||||
spec.no_va_list |= new.no_va_list;
|
||||
spec.spec_bits |= new.spec_bits;
|
||||
return spec;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue