From 33ae72a3c73f6219be86715e8da71ed345f6077c Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Fri, 14 Aug 2026 23:14:38 +0200 Subject: Map Int and Word to hardware word sizes --- include/elna/boot/dependency.h | 6 +++--- include/elna/boot/driver.h | 4 ++-- include/elna/boot/evaluator.h | 2 +- include/elna/boot/materialization.h | 4 ++-- include/elna/boot/name_analysis.h | 10 +++++----- include/elna/boot/result.h | 16 ++++++++-------- include/elna/boot/type_check.h | 18 ++++++------------ include/elna/boot/validation.h | 4 ++-- include/elna/gcc/elna-diagnostic.h | 2 +- 9 files changed, 30 insertions(+), 36 deletions(-) (limited to 'include') diff --git a/include/elna/boot/dependency.h b/include/elna/boot/dependency.h index 854c661..75bbed3 100644 --- a/include/elna/boot/dependency.h +++ b/include/elna/boot/dependency.h @@ -26,9 +26,9 @@ along with GCC; see the file COPYING3. If not see namespace elna::boot { - class dependency : public error_container + class dependency : public diagnostic_container { - error_list m_errors; + diagnostic_list m_errors; public: std::unique_ptr tree; @@ -39,7 +39,7 @@ namespace elna::boot dependency read_source(std::istream& entry_point, const target_info& target); std::filesystem::path build_path(const std::vector& segments); - error_list analyze_semantics(std::unique_ptr& tree, symbol_bag& bag, + diagnostic_list analyze_semantics(std::unique_ptr& tree, symbol_bag& bag, const target_info& target); template diff --git a/include/elna/boot/driver.h b/include/elna/boot/driver.h index 2503e39..9076e23 100644 --- a/include/elna/boot/driver.h +++ b/include/elna/boot/driver.h @@ -25,7 +25,7 @@ namespace elna::boot { source_position make_position(const yy::location& location); - class syntax_error final : public error + class syntax_error final : public diagnostic { std::string message; @@ -35,7 +35,7 @@ namespace elna::boot std::string what() const override; }; - class driver final : public error_container + class driver final : public diagnostic_container { public: std::unique_ptr tree; diff --git a/include/elna/boot/evaluator.h b/include/elna/boot/evaluator.h index 02db6ab..dd70483 100644 --- a/include/elna/boot/evaluator.h +++ b/include/elna/boot/evaluator.h @@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see namespace elna::boot { - class non_constant_expression_error final : public error + class non_constant_expression_error final : public diagnostic { public: struct initializer diff --git a/include/elna/boot/materialization.h b/include/elna/boot/materialization.h index 21a217d..2c571c5 100644 --- a/include/elna/boot/materialization.h +++ b/include/elna/boot/materialization.h @@ -21,7 +21,7 @@ along with GCC; see the file COPYING3. If not see namespace elna::boot { - class materialization_error final : public error + class materialization_error final : public diagnostic { public: materialization_error(const source_position position); @@ -29,7 +29,7 @@ namespace elna::boot std::string what() const override; }; - class materialization_visitor final : public walking_visitor, public error_container + class materialization_visitor final : public walking_visitor, public diagnostic_container { const target_info& target; diff --git a/include/elna/boot/name_analysis.h b/include/elna/boot/name_analysis.h index a9e7f24..736874a 100644 --- a/include/elna/boot/name_analysis.h +++ b/include/elna/boot/name_analysis.h @@ -33,7 +33,7 @@ namespace elna::boot * Error declaring or using a symbol (undeclared, redefinition, * local export). */ - class declaration_error final : public error + class declaration_error final : public diagnostic { public: enum class kind @@ -63,7 +63,7 @@ namespace elna::boot * \c const qualifier used incorrectly — wrong position or * duplicate. */ - class const_qualifier_error final : public error + class const_qualifier_error final : public diagnostic { public: enum class kind @@ -89,7 +89,7 @@ namespace elna::boot /** * Error accessing or defining a member of a record or enumeration. */ - class member_error final : public error + class member_error final : public diagnostic { public: enum class kind { not_found, field_on_type }; @@ -123,7 +123,7 @@ namespace elna::boot /** * Performs name analysis. */ - class name_analysis_visitor final : public walking_visitor, public error_container + class name_analysis_visitor final : public walking_visitor, public diagnostic_container { type current_type; symbol_bag bag; @@ -183,7 +183,7 @@ namespace elna::boot /** * Collects global declarations without resolving any symbols. */ - class declaration_visitor final : public empty_visitor, public error_container + class declaration_visitor final : public empty_visitor, public diagnostic_container { public: forward_table unresolved; diff --git a/include/elna/boot/result.h b/include/elna/boot/result.h index bf2149a..23505d0 100644 --- a/include/elna/boot/result.h +++ b/include/elna/boot/result.h @@ -81,13 +81,13 @@ namespace elna::boot /** * A compilation error consists of an error message and position. */ - class error + class diagnostic { protected: - error(const source_position position); + diagnostic(const source_position position); public: - virtual ~error() = default; + virtual ~diagnostic() = default; /// Error position. const source_position position; @@ -106,17 +106,17 @@ namespace elna::boot } }; - using error_list = std::deque>; + using diagnostic_list = std::deque>; - class error_container + class diagnostic_container { protected: - error_list m_errors; + diagnostic_list m_errors; - error_container() = default; + diagnostic_container() = default; public: - error_list& errors(); + diagnostic_list& errors(); template void add_error(Args&&... arguments) diff --git a/include/elna/boot/type_check.h b/include/elna/boot/type_check.h index 52eec61..7a8eece 100644 --- a/include/elna/boot/type_check.h +++ b/include/elna/boot/type_check.h @@ -30,7 +30,7 @@ namespace elna::boot /** * Expected type does not match the actual type of an expression. */ - class type_mismatch_error final : public error + class type_mismatch_error final : public diagnostic { public: struct expected_type @@ -54,10 +54,6 @@ namespace elna::boot { type target; }; - struct integer_literal_overflow - { - integer_literal overflow; - }; struct constant_assignment { }; @@ -67,7 +63,6 @@ namespace elna::boot unary, binary, invalid_cast, - integer_literal_overflow, constant_assignment >; @@ -81,7 +76,7 @@ namespace elna::boot payload_type payload; }; - class type_requirement_error : public error + class type_requirement_error : public diagnostic { public: enum class kind @@ -107,7 +102,7 @@ namespace elna::boot /** * Cyclic type declaration. */ - class cyclic_declaration_error final : public error + class cyclic_declaration_error final : public diagnostic { std::vector cycle; @@ -121,7 +116,7 @@ namespace elna::boot * Argument count in a procedure call or array constructor doesn't match * the expected number of parameters or elements. */ - class argument_count_error final : public error + class argument_count_error final : public diagnostic { public: enum class kind @@ -146,7 +141,7 @@ namespace elna::boot /** * A trait invocation is invalid. */ - class trait_error final : public error + class trait_error final : public diagnostic { public: struct offset_not_field_name @@ -208,7 +203,7 @@ namespace elna::boot * procedure argument counts, record field validity, * and type declaration well-formedness. */ - class type_analysis_visitor final : public walking_visitor, public error_container + class type_analysis_visitor final : public walking_visitor, public diagnostic_container { symbol_bag bag; std::shared_ptr current_procedure; @@ -249,6 +244,5 @@ namespace elna::boot void visit(cast_expression *expression) override; void visit(unary_expression *expression) override; void visit(binary_expression *expression) override; - void visit(literal *expression) override; }; } diff --git a/include/elna/boot/validation.h b/include/elna/boot/validation.h index 65972b7..2b1de95 100644 --- a/include/elna/boot/validation.h +++ b/include/elna/boot/validation.h @@ -27,7 +27,7 @@ namespace elna::boot /** * Validation error. */ - class validation_error final : public error + class validation_error final : public diagnostic { public: validation_error(const source_position position, source_position first); @@ -43,7 +43,7 @@ namespace elna::boot * Validates: * - case label uniqueness */ - class validation_visitor final : public empty_visitor, public error_container + class validation_visitor final : public empty_visitor, public diagnostic_container { symbol_bag& bag; evaluator constant_evaluator; diff --git a/include/elna/gcc/elna-diagnostic.h b/include/elna/gcc/elna-diagnostic.h index 3e0dd51..10d5b44 100644 --- a/include/elna/gcc/elna-diagnostic.h +++ b/include/elna/gcc/elna-diagnostic.h @@ -43,5 +43,5 @@ namespace elna::gcc location_t get_location(const boot::source_position *position); location_t make_range(const boot::source_position& position); - void report_errors(const std::deque>& errors); + void report_errors(const std::deque>& errors); } -- cgit v1.2.3