Commit edd12069 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Avoid segfault when processing component types

parent 89db664e
...@@ -220,11 +220,11 @@ package body Buildsupport_Utils is ...@@ -220,11 +220,11 @@ package body Buildsupport_Utils is
function Get_Instance_Of (Device : Node_Id) return Name_Id is function Get_Instance_Of (Device : Node_Id) return Name_Id is
Instance_Of : Name_id := No_Name; Instance_Of : Name_id := No_Name;
begin begin
if Is_Defined_Property (Device, "taste_iv_properties::instance_of") if Is_Defined_Property (Device, "taste_iv_properties::is_instance_of")
then then
Instance_Of := Get_String_Property Instance_Of := Get_String_Property
(Device, Get_String_Name (Device, Get_String_Name
("taste_iv_properties::instance_of")); ("taste_iv_properties::is_instance_of"));
end if; end if;
return Instance_Of; return Instance_Of;
end Get_Instance_Of; end Get_Instance_Of;
......
...@@ -258,7 +258,16 @@ void GW_SDL_Interface(Interface * i) ...@@ -258,7 +258,16 @@ void GW_SDL_Interface(Interface * i)
void GW_SDL_Backend(FV * fv) void GW_SDL_Backend(FV * fv)
{ {
if (fv->system_ast->context->onlycv) return; if (fv->system_ast->context->onlycv) return;
if ((sdl == fv->language || opengeode == fv->language) && (false == fv->is_component_type)) { if ((sdl == fv->language || opengeode == fv->language)) {
printf("FV %s is in SDL\n", fv->name);
if (NULL == fv->instance_of) {
printf("Its instance_of is NULL\n");
}
else {
printf("It IS AN INSTANCE OF %s\n", fv->instance_of);
}
}
if ((sdl == fv->language || opengeode == fv->language) && (NULL == fv->instance_of)) {
Create_New_SDL_Structure(fv); Create_New_SDL_Structure(fv);
FOREACH(i, Interface, fv->interfaces, { FOREACH(i, Interface, fv->interfaces, {
GW_SDL_Interface(i); GW_SDL_Interface(i);
......
...@@ -327,7 +327,7 @@ void Function_Semantic_Check(FV * fv) ...@@ -327,7 +327,7 @@ void Function_Semantic_Check(FV * fv)
if (fv->is_component_type) { if (fv->is_component_type) {
if (sdl != fv->language) { if (sdl != fv->language) {
ERROR ERROR
("** Error: Is_Component_Type is True for \"%s\". This is allowed only for SDL functions.\n", ("[ERROR] Is_Component_Type is True for \"%s\". This is allowed only for SDL functions.\n",
fv->name); fv->name);
add_error(); add_error();
} }
...@@ -337,13 +337,15 @@ void Function_Semantic_Check(FV * fv) ...@@ -337,13 +337,15 @@ void Function_Semantic_Check(FV * fv)
FV *definition = FindFV (fv->instance_of); FV *definition = FindFV (fv->instance_of);
if (definition == NULL) { if (definition == NULL) {
ERROR ERROR
("** Error: Defining function \"%s\" for \"%s\" not found.\n", ("[ERROR] Component type \"%s\" (for instance \"%s\") not found.\n",
fv->instance_of, fv->name); fv->instance_of, fv->name);
add_error(); add_error();
return;
} }
else {
if (false == definition->is_component_type) { if (false == definition->is_component_type) {
ERROR ERROR
("** Error: Is_Component_Type is False for \"%s\". It should be True,\n", ("[ERROR] Is_Component_Type is False for \"%s\". It should be True,\n",
definition->name); definition->name);
ERROR ERROR
(" because function \"%s\" claims that it is an instance of \"%s\".\n", (" because function \"%s\" claims that it is an instance of \"%s\".\n",
...@@ -380,7 +382,7 @@ void Function_Semantic_Check(FV * fv) ...@@ -380,7 +382,7 @@ void Function_Semantic_Check(FV * fv)
definition->name, fv->name); definition->name, fv->name);
add_error(); add_error();
} }
}
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment