mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 16:18:52 +00:00
Allow edge-case where backing type of a bit_field is (array of) u8, to allow any endian type
This commit is contained in:
+3
-2
@@ -1133,12 +1133,13 @@ gb_internal void check_bit_field_type(CheckerContext *ctx, Type *bit_field_type,
|
|||||||
return Endian_Native;
|
return Endian_Native;
|
||||||
};
|
};
|
||||||
|
|
||||||
EndianKind backing_type_endian_kind = determine_endian_kind(core_array_type(backing_type));
|
Type *backing_type_elem = core_array_type(backing_type);
|
||||||
|
EndianKind backing_type_endian_kind = determine_endian_kind(backing_type_elem);
|
||||||
EndianKind endian_kind = Endian_Unknown;
|
EndianKind endian_kind = Endian_Unknown;
|
||||||
for (Entity *f : fields) {
|
for (Entity *f : fields) {
|
||||||
EndianKind field_kind = determine_endian_kind(f->type);
|
EndianKind field_kind = determine_endian_kind(f->type);
|
||||||
|
|
||||||
if (field_kind && backing_type_endian_kind != field_kind) {
|
if (field_kind && backing_type_endian_kind != field_kind && backing_type_elem != t_u8) {
|
||||||
error(f->token, "All 'bit_field' field types must match the same endian kind as the backing type, i.e. all native, all little, or all big");
|
error(f->token, "All 'bit_field' field types must match the same endian kind as the backing type, i.e. all native, all little, or all big");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user