Skip to content

Commit 0d40239

Browse files
committed
Add support for subprogram_body_stubs
The gnat front end ensures that the subunit corresponding to a body stub exists and checks it semantically.
1 parent a1cbc0f commit 0d40239

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

gnat2goto/driver/tree_walk.adb

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@ package body Tree_Walk is
252252
procedure Do_Subprogram_Body (N : Node_Id)
253253
with Pre => Nkind (N) = N_Subprogram_Body;
254254

255+
procedure Do_Subprogram_Body_Stub (N : Node_Id)
256+
with Pre => Nkind (N) in N_Subprogram_Body_Stub;
257+
255258
function Do_Subprogram_Or_Block (N : Node_Id) return Irep
256259
with Pre => Nkind (N) in N_Subprogram_Body |
257260
N_Task_Body |
@@ -4134,7 +4137,21 @@ package body Tree_Walk is
41344137
Global_Symbol_Table.Replace (Proc_Name, Proc_Symbol);
41354138
end Do_Subprogram_Body;
41364139

4137-
-------------------------------
4140+
-----------------------------
4141+
-- Do_Subprogram_Body_Stub --
4142+
-----------------------------
4143+
4144+
procedure Do_Subprogram_Body_Stub (N : Node_Id) is
4145+
begin
4146+
-- The Gnat compilation model requires that a file containing the
4147+
-- which is the separate subprogram body is present otherwise
4148+
-- a compilation error is generated.
4149+
-- Therefore, the subunit will always be present when gnat2goto
4150+
-- encounters a Subprogram_Body_Stub.
4151+
Do_Subprogram_Body (Proper_Body (Unit ((Library_Unit (N)))));
4152+
end Do_Subprogram_Body_Stub;
4153+
4154+
-------------------------------
41384155
-- Do_Subprogram_Declaration --
41394156
-------------------------------
41404157

@@ -4762,8 +4779,9 @@ package body Tree_Walk is
47624779
-- body_stub --
47634780

47644781
when N_Subprogram_Body_Stub =>
4765-
Report_Unhandled_Node_Empty (N, "Process_Declaration",
4766-
"Subprogram body stub declaration");
4782+
-- Report_Unhandled_Node_Empty (N, "Process_Declaration",
4783+
-- "Subprogram body stub declaration");
4784+
Do_Subprogram_Body_Stub (N);
47674785

47684786
when N_Package_Body_Stub =>
47694787
Report_Unhandled_Node_Empty (N, "Process_Declaration",

0 commit comments

Comments
 (0)