Skip to content

Commit a8b77a2

Browse files
Petr BauchPetr Bauch
authored andcommitted
Fix based on comments
1 parent 9e43d4e commit a8b77a2

File tree

1 file changed

+21
-25
lines changed

1 file changed

+21
-25
lines changed

gnat2goto/driver/tree_walk.adb

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ package body Tree_Walk is
388388
procedure Process_Declarations (L : List_Id; Block : Irep);
389389
-- Processes the declarations and is used for both a package specification
390390
-- where only basic declarations are allowed (no subprogram bodies etc.)
391-
-- and declarative parts where such declaratios are allowed.
391+
-- and declarative parts where subprogram bodies etc. may be declared.
392392
-- The Gnat front end will check that only allowed declarations are used
393393
-- where only basic declarations permitted.
394394
-- Process_Declarations is a procedure rather than a function like its
@@ -1570,11 +1570,6 @@ package body Tree_Walk is
15701570
end Create_Dummy_Irep;
15711571

15721572
function Do_Expression (N : Node_Id) return Irep is
1573-
procedure Warn_Unhandled_Expression (M : String);
1574-
procedure Warn_Unhandled_Expression (M : String) is
1575-
begin
1576-
Put_Line (Standard_Error, "Warning: " & M & "expressions unhandled");
1577-
end Warn_Unhandled_Expression;
15781573
begin
15791574
Declare_Itype (Etype (N));
15801575
case Nkind (N) is
@@ -1590,14 +1585,14 @@ package body Tree_Walk is
15901585
when Attribute_Access => return Do_Address_Of (N);
15911586
when Attribute_Length => return Do_Array_Length (N);
15921587
when Attribute_Range =>
1593-
Warn_Unhandled_Expression ("Range attribute");
1594-
return Create_Dummy_Irep;
1588+
return Report_Unhandled_Node_Irep (N, "Do_Expression",
1589+
"Range attribute");
15951590
when Attribute_First =>
1596-
Warn_Unhandled_Expression ("First attribute");
1597-
return Create_Dummy_Irep;
1591+
return Report_Unhandled_Node_Irep (N, "Do_Expression",
1592+
"First attribute");
15981593
when Attribute_Last =>
1599-
Warn_Unhandled_Expression ("Last attribute");
1600-
return Create_Dummy_Irep;
1594+
return Report_Unhandled_Node_Irep (N, "Do_Expression",
1595+
"Last attribute");
16011596
when others =>
16021597
return Report_Unhandled_Node_Irep (N, "Do_Expression",
16031598
"Unknown attribute");
@@ -1608,20 +1603,20 @@ package body Tree_Walk is
16081603
when N_Indexed_Component => return Do_Indexed_Component (N);
16091604
when N_Slice => return Do_Slice (N);
16101605
when N_In =>
1611-
Warn_Unhandled_Expression ("In");
1612-
return Create_Dummy_Irep;
1606+
return Report_Unhandled_Node_Irep (N, "Do_Expression",
1607+
"In");
16131608
when N_Real_Literal => return Do_Real_Constant (N);
16141609
when N_If_Expression => return Do_If_Expression (N);
16151610
when N_And_Then => return Do_And_Then (N);
16161611
when N_Or_Else =>
1617-
Warn_Unhandled_Expression ("Or else");
1618-
return Create_Dummy_Irep;
1612+
return Report_Unhandled_Node_Irep (N, "Do_Expression",
1613+
"Or else");
16191614
when N_Qualified_Expression =>
1620-
Warn_Unhandled_Expression ("Qualified");
1621-
return Create_Dummy_Irep;
1615+
return Report_Unhandled_Node_Irep (N, "Do_Expression",
1616+
"Qualified");
16221617
when N_Quantified_Expression =>
1623-
Warn_Unhandled_Expression ("Quantified");
1624-
return Create_Dummy_Irep;
1618+
return Report_Unhandled_Node_Irep (N, "Do_Expression",
1619+
"Quantified");
16251620
when others =>
16261621
return Report_Unhandled_Node_Irep (N, "Do_Expression",
16271622
"Unknown expression kind");
@@ -4000,8 +3995,8 @@ package body Tree_Walk is
40003995
-- populate the symbol table instead.
40013996
Register_Subprogram_Specification (Specification (N));
40023997
end if;
4003-
-- Todo aspect_specification
4004-
-- Now the subprogram should registered in the stmbol table
3998+
-- Todo aspect_specification, i.e. pre/post-conditions
3999+
-- Now the subprogram should registered in the symbol table
40054000
-- whether a separate declaration was provided or not.
40064001
if not Global_Symbol_Table.Contains (Proc_Name) then
40074002
Report_Unhandled_Node_Empty (N, "Do_Subprogram_Body",
@@ -4312,10 +4307,11 @@ package body Tree_Walk is
43124307
if Defining_Entity (N) = Stand.Standard_Standard or else
43134308
Unit_Name = "system%s"
43144309
then
4315-
null;
4316-
-- At the moment Standard or System are not processed - to be done
4310+
-- At the moment Standard or System are not processed: TODO
4311+
Put_Line (Standard_Error,
4312+
"At the moment Standard or System library units are not processed.");
43174313
else
4318-
4314+
-- Withed library unit that has no separate declaration
43194315
case Nkind (N) is
43204316
when N_Subprogram_Body =>
43214317
if Acts_As_Spec (N) then

0 commit comments

Comments
 (0)