aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2009-04-24 16:30:39 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2009-04-24 16:30:39 +0200
commit806b956fed0026c5431340ee15e770dd513684a8 (patch)
treeb67d4edfba3739f5b769dd091d525df2fac4d725
parent757240b39c1728f6ad8837e1f3cc69dd43cdb460 (diff)
downloadgcc-806b956fed0026c5431340ee15e770dd513684a8.zip
gcc-806b956fed0026c5431340ee15e770dd513684a8.tar.gz
gcc-806b956fed0026c5431340ee15e770dd513684a8.tar.bz2
Minor reformatting.
From-SVN: r146726
-rw-r--r--gcc/ada/sem.adb67
-rw-r--r--gcc/ada/sem_res.adb1
2 files changed, 45 insertions, 23 deletions
diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb
index d3a7c35..8563938 100644
--- a/gcc/ada/sem.adb
+++ b/gcc/ada/sem.adb
@@ -1542,10 +1542,11 @@ package body Sem is
null; -- Specs are OK
when N_Package_Body | N_Subprogram_Body =>
+
-- A body must be the main unit
pragma Assert (Acts_As_Spec (CU)
- or else CU = Cunit (Main_Unit));
+ or else CU = Cunit (Main_Unit));
null;
-- All other cases cannot happen
@@ -1570,8 +1571,8 @@ package body Sem is
pragma Assert (Item = Unit (CU));
declare
- Unit_Num : constant Unit_Number_Type :=
- Get_Cunit_Unit_Number (CU);
+ Unit_Num : constant Unit_Number_Type :=
+ Get_Cunit_Unit_Number (CU);
procedure Assert_Done (Withed_Unit : Node_Id);
-- Assert Withed_Unit is already Done, unless it's a body. It
@@ -1581,21 +1582,27 @@ package body Sem is
-- spec is also created). With clauses pointing to the
-- instantiation end up pointing to the instance body.
+ -----------------
+ -- Assert_Done --
+ -----------------
+
procedure Assert_Done (Withed_Unit : Node_Id) is
begin
if not Done (Get_Cunit_Unit_Number (Withed_Unit)) then
if not Nkind_In
- (Unit (Withed_Unit), N_Package_Body, N_Subprogram_Body)
+ (Unit (Withed_Unit), N_Package_Body,
+ N_Subprogram_Body)
then
-
Write_Unit_Name
(Unit_Name
- (Get_Cunit_Unit_Number
- (Withed_Unit)));
+ (Get_Cunit_Unit_Number
+ (Withed_Unit)));
Write_Str (" not yet walked!");
+
if Get_Cunit_Unit_Number (Withed_Unit) = Unit_Num then
Write_Str (" (self-ref)");
end if;
+
Write_Eol;
pragma Assert (False);
@@ -1604,7 +1611,8 @@ package body Sem is
end Assert_Done;
procedure Assert_Withed_Units_Done is
- new Walk_Withs (Assert_Done);
+ new Walk_Withs (Assert_Done);
+
begin
if Debug_Unit_Walk then
Write_Unit_Info (Unit_Num, Item);
@@ -1648,12 +1656,19 @@ package body Sem is
procedure Do_Withed_Unit (Withed_Unit : Node_Id);
-- Pass the buck to Do_Unit_And_Dependents
+ --------------------
+ -- Do_Withed_Unit --
+ --------------------
+
procedure Do_Withed_Unit (Withed_Unit : Node_Id) is
begin
Do_Unit_And_Dependents (Withed_Unit, Unit (Withed_Unit));
end Do_Withed_Unit;
procedure Do_Withed_Units is new Walk_Withs (Do_Withed_Unit);
+
+ -- Start of processing for Do_Unit_And_Dependents
+
begin
if Seen (Unit_Num) then
return;
@@ -1670,7 +1685,6 @@ package body Sem is
if Spec_Unit = CU then -- ???Why needed?
pragma Assert (Acts_As_Spec (CU));
null;
-
else
Do_Unit_And_Dependents (Spec_Unit, Unit (Spec_Unit));
end if;
@@ -1715,7 +1729,7 @@ package body Sem is
-- Local Declarations
- Cur : Elmt_Id := First_Elmt (Comp_Unit_List);
+ Cur : Elmt_Id;
-- Start of processing for Walk_Library_Items
@@ -1729,6 +1743,7 @@ package body Sem is
Do_Action (Empty, Standard_Package_Node);
+ Cur := First_Elmt (Comp_Unit_List);
while Present (Cur) loop
declare
CU : constant Node_Id := Node (Cur);
@@ -1820,32 +1835,34 @@ package body Sem is
pragma Assert (Nkind (Unit (CU)) /= N_Subunit);
procedure Walk_Immediate is new Walk_Withs_Immediate (Action);
+
begin
-- First walk the withs immediately on the library item
Walk_Immediate (CU, Include_Limited);
- -- For a body, we must also check for any subunits which belong to
- -- it and which have context clauses of their own, since these
- -- with'ed units are part of its own dependencies.
+ -- For a body, we must also check for any subunits which belong to it
+ -- and which have context clauses of their own, since these with'ed
+ -- units are part of its own dependencies.
if Nkind (Unit (CU)) in N_Unit_Body then
for S in Main_Unit .. Last_Unit loop
- -- We are only interested in subunits. For preproc. data and
- -- def. files, Cunit is Empty, so we need to test that first.
+ -- We are only interested in subunits. For preproc. data and def.
+ -- files, Cunit is Empty, so we need to test that first.
if Cunit (S) /= Empty
and then Nkind (Unit (Cunit (S))) = N_Subunit
then
declare
Pnode : Node_Id;
+
begin
Pnode := Library_Unit (Cunit (S));
- -- In -gnatc mode, the errors in the subunits will not
- -- have been recorded, but the analysis of the subunit
- -- may have failed, so just quit.
+ -- In -gnatc mode, the errors in the subunits will not have
+ -- been recorded, but the analysis of the subunit may have
+ -- failed, so just quit.
if No (Pnode) then
exit;
@@ -1876,8 +1893,10 @@ package body Sem is
procedure Walk_Withs_Immediate (CU : Node_Id; Include_Limited : Boolean) is
pragma Assert (Nkind (CU) = N_Compilation_Unit);
- Context_Item : Node_Id := First (Context_Items (CU));
+ Context_Item : Node_Id;
+
begin
+ Context_Item := First (Context_Items (CU));
while Present (Context_Item) loop
if Nkind (Context_Item) = N_With_Clause
and then (Include_Limited
@@ -1926,11 +1945,13 @@ package body Sem is
end if;
declare
- Context_Item : Node_Id := First (Context_Items (Cunit (Unit_Num)));
+ Context_Item : Node_Id;
+
begin
+ Context_Item := First (Context_Items (Cunit (Unit_Num)));
while Present (Context_Item)
and then (Nkind (Context_Item) /= N_With_Clause
- or else Limited_Present (Context_Item))
+ or else Limited_Present (Context_Item))
loop
Context_Item := Next (Context_Item);
end loop;
@@ -1947,10 +1968,12 @@ package body Sem is
pragma Assert (Present (Library_Unit (Context_Item)));
Write_Unit_Name
(Unit_Name
- (Get_Cunit_Unit_Number (Library_Unit (Context_Item))));
+ (Get_Cunit_Unit_Number (Library_Unit (Context_Item))));
+
if Implicit_With (Context_Item) then
Write_Str (" -- implicit");
end if;
+
Write_Eol;
end if;
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index a3976bb..9864e94 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -3037,7 +3037,6 @@ package body Sem_Res is
elsif Is_Entity_Name (Left_Opnd (N)) then
declare
Ent : constant Entity_Id := Entity (Left_Opnd (N));
-
begin
if Ekind (Ent) = E_Constant
and then Present (Constant_Value (Ent))