Commit ad6b5a38 authored by yoogx's avatar yoogx
Browse files

* Defend against ill-formatted alternatives (e.g. nothing to

          send)
parent c63b580c
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2012 ESA & ISAE. -- -- Copyright (C) 2008-2009 Telecom ParisTech, 2010-2013 ESA & ISAE. --
-- -- -- --
-- Ocarina is free software; you can redistribute it and/or modify -- -- Ocarina is free software; you can redistribute it and/or modify --
-- it under terms of the GNU General Public License as published by the -- -- it under terms of the GNU General Public License as published by the --
...@@ -510,7 +510,7 @@ package body Ocarina.Backends.PO_HI_Ada.Transport is ...@@ -510,7 +510,7 @@ package body Ocarina.Backends.PO_HI_Ada.Transport is
-- Statements -- Statements
-- The case statement: for each thread of the current -- The if/elsif statement: for each thread of the current
-- process, we generate a case statement alternative to -- process, we generate a case statement alternative to
-- call its specific sending routine. -- call its specific sending routine.
...@@ -558,26 +558,37 @@ package body Ocarina.Backends.PO_HI_Ada.Transport is ...@@ -558,26 +558,37 @@ package body Ocarina.Backends.PO_HI_Ada.Transport is
Else_Statements : constant List_Id := New_List (ADN.K_List_Id); Else_Statements : constant List_Id := New_List (ADN.K_List_Id);
begin begin
N := Make_Qualified_Expression if Present (ADN.First_Node (Alternatives)) then
(RE (RE_Error_Kind), N := Make_Qualified_Expression
Make_Record_Aggregate (RE (RE_Error_Kind),
(Make_List_Id Make_Record_Aggregate
(RE (RE_Error_Transport)))); (Make_List_Id
N := Make_Return_Statement (N); (RE (RE_Error_Transport))));
Append_Node_To_List (N, Else_Statements); N := Make_Return_Statement (N);
Append_Node_To_List (N, Else_Statements);
ADN.Set_First_Node (Elsif_Statements, ADN.Set_First_Node (Elsif_Statements,
ADN.Next_Node ADN.Next_Node
(ADN.First_Node (Alternatives))); (ADN.First_Node (Alternatives)));
N := Make_If_Statement N := Make_If_Statement
(Condition => ADN.Condition (ADN.First_Node (Alternatives)), (Condition => ADN.Condition
Then_Statements => ADN.Then_Statements (ADN.First_Node (Alternatives)),
(ADN.First_Node (Alternatives)), Then_Statements => ADN.Then_Statements
Elsif_Statements => Elsif_Statements, (ADN.First_Node (Alternatives)),
Else_Statements => Else_Statements); Elsif_Statements => Elsif_Statements,
Else_Statements => Else_Statements);
Append_Node_To_List (N, Statements); Append_Node_To_List (N, Statements);
else
N := Make_Qualified_Expression
(RE (RE_Error_Kind),
Make_Record_Aggregate
(Make_List_Id
(RE (RE_Error_Transport))));
N := Make_Return_Statement (N);
Append_Node_To_List (N, Statements);
end if;
end; end;
end if; end if;
......
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