mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-02 20:58:15 +00:00
Fix #3531
Individual `bit_field` size was not being added to the total size. Error message was changed to be more explicit.
This commit is contained in:
+3
-1
@@ -1080,6 +1080,8 @@ gb_internal void check_bit_field_type(CheckerContext *ctx, Type *bit_field_type,
|
|||||||
array_add(&tags, tag);
|
array_add(&tags, tag);
|
||||||
|
|
||||||
add_entity_use(ctx, field, e);
|
add_entity_use(ctx, field, e);
|
||||||
|
|
||||||
|
total_bit_size += bit_size_u8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1094,7 +1096,7 @@ gb_internal void check_bit_field_type(CheckerContext *ctx, Type *bit_field_type,
|
|||||||
|
|
||||||
if (total_bit_size > maximum_bit_size) {
|
if (total_bit_size > maximum_bit_size) {
|
||||||
gbString s = type_to_string(backing_type);
|
gbString s = type_to_string(backing_type);
|
||||||
error(node, "The numbers required %llu exceeds the backing type's (%s) bit size %llu",
|
error(node, "The total bit size of a bit_field's fields (%llu) must fit into its backing type's (%s) bit size of %llu",
|
||||||
cast(unsigned long long)total_bit_size,
|
cast(unsigned long long)total_bit_size,
|
||||||
s,
|
s,
|
||||||
cast(unsigned long long)maximum_bit_size);
|
cast(unsigned long long)maximum_bit_size);
|
||||||
|
|||||||
Reference in New Issue
Block a user