mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-18 03:42:23 -07:00
Begin work for bit_set[...; [N]T] (not working)
This commit is contained in:
+4
-17
@@ -939,22 +939,6 @@ gb_internal void check_enum_type(CheckerContext *ctx, Type *enum_type, Type *nam
|
||||
enum_type->Enum.max_value_index = max_value_index;
|
||||
}
|
||||
|
||||
gb_internal bool is_valid_bit_field_backing_type(Type *type) {
|
||||
if (type == nullptr) {
|
||||
return false;
|
||||
}
|
||||
type = base_type(type);
|
||||
if (is_type_untyped(type)) {
|
||||
return false;
|
||||
}
|
||||
if (is_type_integer(type)) {
|
||||
return true;
|
||||
}
|
||||
if (type->kind == Type_Array) {
|
||||
return is_type_integer(type->Array.elem);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
gb_internal void check_bit_field_type(CheckerContext *ctx, Type *bit_field_type, Type *named_type, Ast *node) {
|
||||
ast_node(bf, BitFieldType, node);
|
||||
@@ -1268,11 +1252,14 @@ gb_internal void check_bit_set_type(CheckerContext *c, Type *type, Type *named_t
|
||||
Type *t = default_type(lhs.type);
|
||||
if (bs->underlying != nullptr) {
|
||||
Type *u = check_type(c, bs->underlying);
|
||||
// if (!is_valid_bit_field_backing_type(u)) {
|
||||
if (!is_type_integer(u)) {
|
||||
gbString ts = type_to_string(u);
|
||||
error(bs->underlying, "Expected an underlying integer for the bit set, got %s", ts);
|
||||
gb_string_free(ts);
|
||||
return;
|
||||
if (!is_valid_bit_field_backing_type(u)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
type->BitSet.underlying = u;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user