Commit 27eaddda by Hristian Kirtchev Committed by Arnaud Charlet

exp_util.adb, [...]: Minor reformatting and code cleanups.

2017-04-27  Hristian Kirtchev  <kirtchev@adacore.com>

	* exp_util.adb, a-cfdlli.adb, a-cfdlli.ads, exp_ch9.adb, g-dyntab.adb,
	sem_dim.adb, a-cfinve.adb, a-cfinve.ads, a-cofove.adb, a-cofove.ads:
	Minor reformatting and code cleanups.

From-SVN: r247319
parent 6dd86c75
2017-04-27 Hristian Kirtchev <kirtchev@adacore.com>
* exp_util.adb, a-cfdlli.adb, a-cfdlli.ads, exp_ch9.adb, g-dyntab.adb,
sem_dim.adb, a-cfinve.adb, a-cfinve.ads, a-cofove.adb, a-cofove.ads:
Minor reformatting and code cleanups.
2017-04-27 Ed Schonberg <schonberg@adacore.com> 2017-04-27 Ed Schonberg <schonberg@adacore.com>
* freeze.adb (Build_Inherited_Condition_Pragmas): New procedure, * freeze.adb (Build_Inherited_Condition_Pragmas): New procedure,
......
...@@ -39,9 +39,7 @@ is ...@@ -39,9 +39,7 @@ is
New_Item : Element_Type; New_Item : Element_Type;
New_Node : out Count_Type); New_Node : out Count_Type);
procedure Free procedure Free (Container : in out List; X : Count_Type);
(Container : in out List;
X : Count_Type);
procedure Insert_Internal procedure Insert_Internal
(Container : in out List; (Container : in out List;
...@@ -109,10 +107,7 @@ is ...@@ -109,10 +107,7 @@ is
-- Append -- -- Append --
------------ ------------
procedure Append procedure Append (Container : in out List; New_Item : Element_Type) is
(Container : in out List;
New_Item : Element_Type)
is
begin begin
Insert (Container, No_Element, New_Item, 1); Insert (Container, No_Element, New_Item, 1);
end Append; end Append;
...@@ -164,14 +159,14 @@ is ...@@ -164,14 +159,14 @@ is
begin begin
if Container.Length = 0 then if Container.Length = 0 then
pragma Assert (Container.First = 0); pragma Assert (Container.First = 0);
pragma Assert (Container.Last = 0); pragma Assert (Container.Last = 0);
return; return;
end if; end if;
pragma Assert (Container.First >= 1); pragma Assert (Container.First >= 1);
pragma Assert (Container.Last >= 1); pragma Assert (Container.Last >= 1);
pragma Assert (N (Container.First).Prev = 0); pragma Assert (N (Container.First).Prev = 0);
pragma Assert (N (Container.Last).Next = 0); pragma Assert (N (Container.Last).Next = 0);
while Container.Length > 1 loop while Container.Length > 1 loop
X := Container.First; X := Container.First;
...@@ -275,9 +270,9 @@ is ...@@ -275,9 +270,9 @@ is
pragma Assert (Vet (Container, Position), "bad cursor in Delete"); pragma Assert (Vet (Container, Position), "bad cursor in Delete");
pragma Assert (Container.First >= 1); pragma Assert (Container.First >= 1);
pragma Assert (Container.Last >= 1); pragma Assert (Container.Last >= 1);
pragma Assert (N (Container.First).Prev = 0); pragma Assert (N (Container.First).Prev = 0);
pragma Assert (N (Container.Last).Next = 0); pragma Assert (N (Container.Last).Next = 0);
if Position.Node = Container.First then if Position.Node = Container.First then
Delete_First (Container, Count); Delete_First (Container, Count);
...@@ -430,9 +425,7 @@ is ...@@ -430,9 +425,7 @@ is
From := Container.First; From := Container.First;
end if; end if;
if Position.Node /= 0 and then if Position.Node /= 0 and then not Has_Element (Container, Position) then
not Has_Element (Container, Position)
then
raise Constraint_Error with "Position cursor has no element"; raise Constraint_Error with "Position cursor has no element";
end if; end if;
...@@ -496,33 +489,17 @@ is ...@@ -496,33 +489,17 @@ is
Left : M.Sequence; Left : M.Sequence;
Right : M.Sequence) return Boolean Right : M.Sequence) return Boolean
is is
begin Elem : Element_Type;
for I in 1 .. M.Length (Container) loop
declare
Found : Boolean := False;
J : Count_Type := 0;
begin
while not Found and J < M.Length (Left) loop
J := J + 1;
if Element (Container, I) = Element (Left, J) then
Found := True;
end if;
end loop;
J := 0;
while not Found and J < M.Length (Right) loop begin
J := J + 1; for Index in 1 .. M.Length (Container) loop
if Element (Container, I) = Element (Right, J) then Elem := Element (Container, Index);
Found := True;
end if;
end loop;
if not Found then if not M.Contains (Left, 1, M.Length (Left), Elem)
return False; and then not M.Contains (Right, 1, M.Length (Right), Elem)
end if; then
end; return False;
end if;
end loop; end loop;
return True; return True;
...@@ -579,8 +556,7 @@ is ...@@ -579,8 +556,7 @@ is
end if; end if;
for I in 1 .. L loop for I in 1 .. L loop
if Element (Left, I) /= Element (Right, L - I + 1) if Element (Left, I) /= Element (Right, L - I + 1) then
then
return False; return False;
end if; end if;
end loop; end loop;
...@@ -638,7 +614,7 @@ is ...@@ -638,7 +614,7 @@ is
end Model; end Model;
----------------------- -----------------------
-- Mapping_preserved -- -- Mapping_Preserved --
----------------------- -----------------------
function Mapping_Preserved function Mapping_Preserved
...@@ -748,7 +724,8 @@ is ...@@ -748,7 +724,8 @@ is
for C of Right loop for C of Right loop
if not P.Has_Key (Left, C) if not P.Has_Key (Left, C)
or else (C /= X and C /= Y or else (C /= X
and C /= Y
and P.Get (Left, C) /= P.Get (Right, C)) and P.Get (Left, C) /= P.Get (Right, C))
then then
return False; return False;
...@@ -933,8 +910,7 @@ is ...@@ -933,8 +910,7 @@ is
begin begin
if Target'Address = Source'Address then if Target'Address = Source'Address then
raise Program_Error with raise Program_Error with "Target and Source denote same container";
"Target and Source denote same container";
end if; end if;
LI := First (Target); LI := First (Target);
...@@ -1540,8 +1516,7 @@ is ...@@ -1540,8 +1516,7 @@ is
begin begin
if Target'Address = Source'Address then if Target'Address = Source'Address then
raise Program_Error with raise Program_Error with "Target and Source denote same container";
"Target and Source denote same container";
end if; end if;
if Before.Node /= 0 then if Before.Node /= 0 then
...@@ -1549,7 +1524,7 @@ is ...@@ -1549,7 +1524,7 @@ is
end if; end if;
pragma Assert (SN (Source.First).Prev = 0); pragma Assert (SN (Source.First).Prev = 0);
pragma Assert (SN (Source.Last).Next = 0); pragma Assert (SN (Source.Last).Next = 0);
if Target.Length > Count_Type'Base'Last - Source.Length then if Target.Length > Count_Type'Base'Last - Source.Length then
raise Constraint_Error with "new length exceeds maximum"; raise Constraint_Error with "new length exceeds maximum";
...@@ -1576,8 +1551,7 @@ is ...@@ -1576,8 +1551,7 @@ is
begin begin
if Target'Address = Source'Address then if Target'Address = Source'Address then
raise Program_Error with raise Program_Error with "Target and Source denote same container";
"Target and Source denote same container";
end if; end if;
if Position.Node = 0 then if Position.Node = 0 then
...@@ -1820,15 +1794,11 @@ is ...@@ -1820,15 +1794,11 @@ is
return False; return False;
end if; end if;
if N (Position.Node).Prev = 0 if N (Position.Node).Prev = 0 and then Position.Node /= L.First then
and then Position.Node /= L.First
then
return False; return False;
end if; end if;
if N (Position.Node).Next = 0 if N (Position.Node).Next = 0 and then Position.Node /= L.Last then
and then Position.Node /= L.Last
then
return False; return False;
end if; end if;
......
...@@ -7509,21 +7509,16 @@ package body Exp_Ch9 is ...@@ -7509,21 +7509,16 @@ package body Exp_Ch9 is
Cancel_Param := Make_Defining_Identifier (Loc, Name_uC); Cancel_Param := Make_Defining_Identifier (Loc, Name_uC);
-- Insert declaration of C in declarations of existing block -- Insert the declaration of C in the declarations of the existing
-- block. The variable is initialized to something (True or False,
-- does not matter) to prevent CodePeer from complaining about a
-- possible read of an uninitialized variable.
Prepend_To (Decls, Prepend_To (Decls,
Make_Object_Declaration (Loc, Make_Object_Declaration (Loc,
Defining_Identifier => Cancel_Param, Defining_Identifier => Cancel_Param,
Object_Definition => Object_Definition => New_Occurrence_Of (Standard_Boolean, Loc),
New_Occurrence_Of (Standard_Boolean, Loc), Expression => New_Occurrence_Of (Standard_False, Loc),
Expression =>
New_Occurrence_Of (Standard_False, Loc),
-- True would work equally well here. This initialization
-- should be dead, but only because of things (e.g.,
-- abortion deferral) that CodePeer doesn't know about.
-- We want to avoid CodePeer complaints about a possible read
-- of an uninitialized variable when this variable is read,
-- so we initialize it here.
Has_Init_Expression => True)); Has_Init_Expression => True));
-- Remove and save the call to Call_Simple -- Remove and save the call to Call_Simple
......
...@@ -1114,13 +1114,11 @@ package body Exp_Util is ...@@ -1114,13 +1114,11 @@ package body Exp_Util is
if Present (New_E) then if Present (New_E) then
Rewrite (N, New_Occurrence_Of (New_E, Sloc (N))); Rewrite (N, New_Occurrence_Of (New_E, Sloc (N)));
-- If the entity is an overridden primitive and we are not -- If the entity is an overridden primitive and we are not in
-- in proof mode, we must build a wrapper for the current -- GNATprove mode, we must build a wrapper for the current
-- inherited operation. -- inherited operation.
if Is_Subprogram (New_E) if Is_Subprogram (New_E) and then not GNATprove_Mode then
and then not GNATprove_Mode
then
Needs_Wrapper := True; Needs_Wrapper := True;
end if; end if;
end if; end if;
......
...@@ -280,7 +280,7 @@ package body GNAT.Dynamic_Tables is ...@@ -280,7 +280,7 @@ package body GNAT.Dynamic_Tables is
Old_Table : Old_Alloc_Ptr := To_Old_Alloc_Ptr (T.Table); Old_Table : Old_Alloc_Ptr := To_Old_Alloc_Ptr (T.Table);
New_Table : constant Alloc_Ptr := New_Table : constant Alloc_Ptr :=
new Alloc_Type'(Old_Table (Alloc_Type'Range)); new Alloc_Type'(Old_Table (Alloc_Type'Range));
begin begin
T.P.Last_Allocated := T.P.Last; T.P.Last_Allocated := T.P.Last;
Free (Old_Table); Free (Old_Table);
......
...@@ -2154,9 +2154,9 @@ package body Sem_Dim is ...@@ -2154,9 +2154,9 @@ package body Sem_Dim is
if Dim_Of_Expr /= Dim_Of_Etyp then if Dim_Of_Expr /= Dim_Of_Etyp then
-- Numeric literal case. Issue a warning if the object type is not -- Numeric literal case. Issue a warning if the object type is
-- dimensionless to indicate the literal is treated as if its -- not dimensionless to indicate the literal is treated as if
-- dimension matches the type dimension. -- its dimension matches the type dimension.
if Nkind_In (Original_Node (Expr), N_Real_Literal, if Nkind_In (Original_Node (Expr), N_Real_Literal,
N_Integer_Literal) N_Integer_Literal)
...@@ -2171,8 +2171,8 @@ package body Sem_Dim is ...@@ -2171,8 +2171,8 @@ package body Sem_Dim is
Set_Dimensions (Id, Dim_Of_Expr); Set_Dimensions (Id, Dim_Of_Expr);
-- Expression may have been constant-folded. If nominal type -- Expression may have been constant-folded. If nominal type has
-- has dimensions, verify that expression has same type. -- dimensions, verify that expression has same type.
elsif Exists (Dim_Of_Etyp) and then Etype (Expr) = Etyp then elsif Exists (Dim_Of_Etyp) and then Etype (Expr) = Etyp then
null; null;
...@@ -2184,8 +2184,8 @@ package body Sem_Dim is ...@@ -2184,8 +2184,8 @@ package body Sem_Dim is
end if; end if;
end if; end if;
-- Remove dimensions in expression after checking consistency -- Remove dimensions in expression after checking consistency with
-- with given type. -- given type.
Remove_Dimensions (Expr); Remove_Dimensions (Expr);
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