Fix diagnostic for primitive types

This commit is contained in:
2025-02-11 01:37:55 +01:00
parent 4bf88a92e8
commit 33aca4cc07
19 changed files with 473 additions and 626 deletions

View File

@ -0,0 +1,13 @@
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tree.h"
#include "tree-iterator.h"
namespace elna
{
namespace gcc
{
void init_ttree();
}
}

View File

@ -46,6 +46,8 @@ namespace gcc
void enter_scope();
tree_symbol_mapping leave_scope();
tree lookup(const std::string& name);
void make_if_branch(boot::conditional_statements& branch, tree goto_endif);
bool is_numeric_type(tree type);

View File

@ -24,6 +24,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "tree.h"
#include "tree-iterator.h"
#include "stringpool.h"
#include "elna/boot/ast.h"
#include "elna/boot/symbol.h"
@ -96,8 +97,6 @@ namespace gcc
tree chain_defer();
};
std::shared_ptr<boot::symbol_table<tree>> builtin_symbol_table();
tree do_pointer_arithmetic(boot::binary_operator binary_operator, tree left, tree right);
tree build_binary_operation(bool condition, boot::binary_expression *expression,
tree_code operator_code, tree left, tree right, tree target_type);

47
include/elna/gcc/elna1.h Normal file
View File

@ -0,0 +1,47 @@
enum elna_tree_index
{
ELNA_TI_INT_TYPE,
ELNA_TI_WORD_TYPE,
ELNA_TI_CHAR_TYPE,
ELNA_TI_BOOL_TYPE,
ELNA_TI_BYTE_TYPE,
ELNA_TI_FLOAT_TYPE,
ELNA_TI_STRING_TYPE,
ELNA_TI_MAX
};
extern GTY(()) tree elna_global_trees[ELNA_TI_MAX];
#define elna_int_type_node elna_global_trees[ELNA_TI_INT_TYPE]
#define elna_word_type_node elna_global_trees[ELNA_TI_WORD_TYPE]
#define elna_char_type_node elna_global_trees[ELNA_TI_CHAR_TYPE]
#define elna_bool_type_node elna_global_trees[ELNA_TI_BOOL_TYPE]
#define elna_byte_type_node elna_global_trees[ELNA_TI_BYTE_TYPE]
#define elna_float_type_node elna_global_trees[ELNA_TI_FLOAT_TYPE]
#define elna_string_type_node elna_global_trees[ELNA_TI_STRING_TYPE]
/* Language-dependent contents of a type. */
struct GTY (()) lang_type
{
};
/* Language-dependent contents of a decl. */
struct GTY (()) lang_decl
{
};
struct GTY (()) binding_level
{
// A chain of all declarations in this binding level.
tree names;
};
struct GTY (()) language_function
{
struct binding_level *binding_level;
};
#define f_binding_level DECL_STRUCT_FUNCTION(current_function_decl)->language->binding_level
extern tree pushdecl(tree);
extern tree getdecls(void);