From 4f77ad5d019618893c59a0f8d5bfa6b98e50a3be Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Tue, 18 Aug 2026 13:31:47 +0200 Subject: Make Int and Word aliases to fixed-size types --- boot/symbol.cc | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'boot/symbol.cc') diff --git a/boot/symbol.cc b/boot/symbol.cc index 9854acc..05eea31 100644 --- a/boot/symbol.cc +++ b/boot/symbol.cc @@ -284,7 +284,8 @@ namespace elna::boot static void builtin_integers(const std::shared_ptr& symbols, const std::array& properties, - const std::string& integer_name) + const std::string& integer_name, + std::vector>& alias_owners) { for (std::size_t i = 1; i < properties.size(); ++i) { @@ -293,6 +294,16 @@ namespace elna::boot const type variant_type = type(std::make_shared(type_name, properties[i])); symbols->enter(type_name, std::make_shared(variant_type)); + + // The unsuffixed integer type is an alias of the fixed-size type + // matching the machine word. + if (bit_size == properties.front().size * CHAR_BIT) + { + auto alias = std::make_shared(integer_name, variant_type); + + alias_owners.push_back(alias); + symbols->enter(integer_name, std::make_shared(type(alias))); + } } if (!symbols->contains(integer_name)) { @@ -302,12 +313,13 @@ namespace elna::boot } } - std::shared_ptr builtin_symbol_table(const target_info& target) + std::shared_ptr builtin_symbol_table(const target_info& target, + std::vector>& alias_owners) { auto result = std::make_shared(); - builtin_integers(result, target.int_properties, "Int"); - builtin_integers(result, target.word_properties, "Word"); + builtin_integers(result, target.int_properties, "Int", alias_owners); + builtin_integers(result, target.word_properties, "Word", alias_owners); result->enter("Char", std::make_shared(type(std::make_shared("Char", target.char_properties)))); @@ -494,7 +506,7 @@ namespace elna::boot { if (auto base = resolve_aliases(slice->base).get()) { - return is_primitive_type(resolve_aliases(base->unqualified), "Char"); + return is_primitive_type(resolve_aliases(base->unqualified), "Word8"); } } return false; -- cgit v1.2.3