aboutsummaryrefslogtreecommitdiff
path: root/src/check_type.cpp
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2024-05-07 00:47:15 +0200
committerGitHub <noreply@github.com>2024-05-07 00:47:15 +0200
commit96abe8627c885a8829dd8e3fb3455a3b5e196c7a (patch)
tree7dd4eb75e2a9fbae7cd727d74ff4c0540a85a435 /src/check_type.cpp
parent15f7148eae89a36696916e15ed4c83fb7fed01c5 (diff)
parent6ec7845249d2e77e68f2e802e3bebe5b5fc3480f (diff)
Merge pull request #3551 from Feoramund/fix-max-bitfield-size
Fix lack of adding to `total_bit_size`
Diffstat (limited to 'src/check_type.cpp')
-rw-r--r--src/check_type.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/check_type.cpp b/src/check_type.cpp
index 61c502a68..457375779 100644
--- a/src/check_type.cpp
+++ b/src/check_type.cpp
@@ -1080,6 +1080,8 @@ gb_internal void check_bit_field_type(CheckerContext *ctx, Type *bit_field_type,
array_add(&tags, tag);
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) {
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,
s,
cast(unsigned long long)maximum_bit_size);