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

@ -19,6 +19,9 @@ along with GCC; see the file COPYING3. If not see
#include "system.h"
#include "coretypes.h"
#include "target.h"
#include "function.h"
#include "tree.h"
#include "elna/gcc/elna1.h"
#include "diagnostic.h"
#include "opts.h"
#include "debug.h"
@ -26,25 +29,14 @@ along with GCC; see the file COPYING3. If not see
#include "langhooks-def.h"
#include <fstream>
#include <elna/boot/driver.h>
#include "elna/boot/driver.h"
#include "elna/gcc/elna-tree.h"
#include "elna/gcc/elna-generic.h"
#include "elna/gcc/elna-diagnostic.h"
#include "elna/gcc/elna-builtins.h"
#include "parser.hh"
/* Language-dependent contents of a type. */
struct GTY (()) lang_type
{
char dummy;
};
/* Language-dependent contents of a decl. */
struct GTY (()) lang_decl
{
char dummy;
};
tree elna_global_trees[ELNA_TI_MAX];
/* The resulting tree type. */
@ -56,18 +48,13 @@ union GTY ((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
union tree_node GTY ((tag ("0"), desc ("tree_node_structure (&%h)"))) generic;
};
/* We don't use language_function. */
struct GTY (()) language_function
{
int dummy;
};
/* Language hooks. */
static bool elna_langhook_init(void)
{
build_common_tree_nodes(false);
elna::gcc::init_ttree();
build_common_builtin_nodes();
return true;
@ -98,7 +85,7 @@ static void elna_parse_file(const char *filename)
}
else
{
elna::gcc::generic_visitor generic_visitor{ elna::gcc::builtin_symbol_table() };
elna::gcc::generic_visitor generic_visitor{ std::make_shared<elna::boot::symbol_table<tree>>() };
generic_visitor.visit(driver.tree.get());
}
@ -185,7 +172,26 @@ static bool global_bindings_p(void)
return current_function_decl == NULL_TREE;
}
static tree pushdecl(tree decl)
tree getdecls(void)
{
if (current_function_decl != NULL_TREE)
{
return f_binding_level->names;
}
return NULL_TREE;
}
tree pushdecl(tree decl)
{
if (current_function_decl != NULL_TREE)
{
TREE_CHAIN(decl) = f_binding_level->names;
f_binding_level->names = decl;
}
return decl;
}
static tree elna_langhook_builtin_function(tree decl)
{
return decl;
}
@ -203,10 +209,7 @@ static tree pushdecl(tree decl)
#define LANG_HOOKS_TYPE_FOR_MODE elna_langhook_type_for_mode
#undef LANG_HOOKS_BUILTIN_FUNCTION
#define LANG_HOOKS_BUILTIN_FUNCTION pushdecl
#undef LANG_HOOKS_GETDECLS
#define LANG_HOOKS_GETDECLS hook_tree_void_null
#define LANG_HOOKS_BUILTIN_FUNCTION elna_langhook_builtin_function
#undef LANG_HOOKS_IDENTIFIER_SIZE
#define LANG_HOOKS_IDENTIFIER_SIZE sizeof(struct tree_identifier)