From d0a666507a6f11b65170c257fd483613f462f3f2 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Wed, 15 Jul 2026 23:19:58 +0200 Subject: Use build3(COND_EXPR) for conditionals --- include/elna/boot/semantic.h | 15 +++++++++++++++ include/elna/gcc/elna-generic.h | 4 ++-- include/elna/gcc/elna-tree.h | 1 - 3 files changed, 17 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/elna/boot/semantic.h b/include/elna/boot/semantic.h index 82ef5f1..0f8f6c7 100644 --- a/include/elna/boot/semantic.h +++ b/include/elna/boot/semantic.h @@ -176,6 +176,21 @@ namespace elna::boot std::string what() const override; }; + /** + * Type passed to a trait like #min or #max does not support + * the trait. + */ + class unsupported_trait_type_error : public error + { + type actual; + std::string trait_name; + + public: + unsupported_trait_type_error(const identifier& trait, type actual); + + std::string what() const override; + }; + /** * Checks types. */ diff --git a/include/elna/gcc/elna-generic.h b/include/elna/gcc/elna-generic.h index 23e1738..e0f20f3 100644 --- a/include/elna/gcc/elna-generic.h +++ b/include/elna/gcc/elna-generic.h @@ -40,7 +40,8 @@ namespace elna::gcc void enter_scope(); tree leave_scope(); - void make_if_branch(boot::conditional_statements& branch, tree goto_endif); + tree make_if_branch(boot::conditional_statements& branch, tree next, + tree goto_append = NULL_TREE); tree build_arithmetic_operation(boot::binary_expression *expression, tree_code operator_code, tree left, tree right); @@ -56,7 +57,6 @@ namespace elna::gcc void build_assert_builtin(location_t call_location, const std::vector& arguments); bool expect_trait_type_only(boot::traits_expression *trait); - bool expect_trait_for_integral_type(boot::traits_expression *trait); void visit_statements(const std::vector& statements); bool assert_constant(location_t expression_location); diff --git a/include/elna/gcc/elna-tree.h b/include/elna/gcc/elna-tree.h index f1402a7..556d52b 100644 --- a/include/elna/gcc/elna-tree.h +++ b/include/elna/gcc/elna-tree.h @@ -82,7 +82,6 @@ namespace elna::gcc tree_code operator_code, tree left, tree right); tree build_field(location_t location, tree record_type, const std::string name, tree type); tree find_field_by_name(location_t expression_location, tree type, const std::string& field_name); - tree build_global_pointer_type(tree type); tree build_static_array_type(tree type, const std::uint64_t size); tree build_enumeration_type(const std::vector& members); tree build_label_decl(const char *name, location_t loc); -- cgit v1.2.3