mirror of git://gcc.gnu.org/git/gcc.git
[multiple changes]
2013-10-14 Robert Dewar <dewar@adacore.com> * freeze.adb (Freeze_Record): Don't give warning about packed and foreign convention. 2013-10-14 Ed Schonberg <schonberg@adacore.com> * sem_aux.adb, sem_aux.ads (Package_Specification): New function, to replace the less efficient idiom Specification. (Unit_Declaration_Node (Pack_Id)), which handles library units and child units. * sem_ch3.adb, sem_ch10.adb, sem_prag.adb, sem_ch12.adb, sem_ch6.adb, exp_disp.adb, sem_cat.adb, exp_dist.adb: Use Package_Specification. 2013-10-14 Hristian Kirtchev <kirtchev@adacore.com> * exp_attr.adb (Expand_Update_Attribute): Update the call to Process_Range_Update. (Process_Range_Update): Add new formal parameter Typ and associated comment on usage. Add local constant Index_Typ. Add a type conversion as part of the indexed component to ensure that the loop variable corresponds to the index type. From-SVN: r203556
This commit is contained in:
parent
515490e000
commit
d12b19faee
|
|
@ -1,3 +1,26 @@
|
||||||
|
2013-10-14 Robert Dewar <dewar@adacore.com>
|
||||||
|
|
||||||
|
* freeze.adb (Freeze_Record): Don't give warning about packed
|
||||||
|
and foreign convention.
|
||||||
|
|
||||||
|
2013-10-14 Ed Schonberg <schonberg@adacore.com>
|
||||||
|
|
||||||
|
* sem_aux.adb, sem_aux.ads (Package_Specification): New function, to
|
||||||
|
replace the less efficient idiom Specification.
|
||||||
|
(Unit_Declaration_Node (Pack_Id)), which handles library units and
|
||||||
|
child units.
|
||||||
|
* sem_ch3.adb, sem_ch10.adb, sem_prag.adb, sem_ch12.adb, sem_ch6.adb,
|
||||||
|
exp_disp.adb, sem_cat.adb, exp_dist.adb: Use Package_Specification.
|
||||||
|
|
||||||
|
2013-10-14 Hristian Kirtchev <kirtchev@adacore.com>
|
||||||
|
|
||||||
|
* exp_attr.adb (Expand_Update_Attribute): Update the call to
|
||||||
|
Process_Range_Update.
|
||||||
|
(Process_Range_Update): Add new formal parameter Typ and associated
|
||||||
|
comment on usage. Add local constant Index_Typ. Add a type conversion
|
||||||
|
as part of the indexed component to ensure that the loop variable
|
||||||
|
corresponds to the index type.
|
||||||
|
|
||||||
2013-10-14 Tristan Gingold <gingold@adacore.com>
|
2013-10-14 Tristan Gingold <gingold@adacore.com>
|
||||||
|
|
||||||
* a-exexpr-gcc.adb: Adjust comment.
|
* a-exexpr-gcc.adb: Adjust comment.
|
||||||
|
|
|
||||||
|
|
@ -6609,12 +6609,14 @@ package body Exp_Attr is
|
||||||
procedure Process_Range_Update
|
procedure Process_Range_Update
|
||||||
(Temp : Entity_Id;
|
(Temp : Entity_Id;
|
||||||
Comp : Node_Id;
|
Comp : Node_Id;
|
||||||
Expr : Node_Id);
|
Expr : Node_Id;
|
||||||
|
Typ : Entity_Id);
|
||||||
-- Generate the statements necessary to update a slice of the prefix.
|
-- Generate the statements necessary to update a slice of the prefix.
|
||||||
-- The code is inserted before the attribute N. Temp denotes the entity
|
-- The code is inserted before the attribute N. Temp denotes the entity
|
||||||
-- of the anonymous object created to reflect the changes in values.
|
-- of the anonymous object created to reflect the changes in values.
|
||||||
-- Comp is range of the slice to be updated. Expr is an expression
|
-- Comp is range of the slice to be updated. Expr is an expression
|
||||||
-- yielding the new value of Comp.
|
-- yielding the new value of Comp. Typ is the type of the prefix of
|
||||||
|
-- attribute Update.
|
||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
-- Process_Component_Or_Element_Update --
|
-- Process_Component_Or_Element_Update --
|
||||||
|
|
@ -6688,10 +6690,12 @@ package body Exp_Attr is
|
||||||
procedure Process_Range_Update
|
procedure Process_Range_Update
|
||||||
(Temp : Entity_Id;
|
(Temp : Entity_Id;
|
||||||
Comp : Node_Id;
|
Comp : Node_Id;
|
||||||
Expr : Node_Id)
|
Expr : Node_Id;
|
||||||
|
Typ : Entity_Id)
|
||||||
is
|
is
|
||||||
Loc : constant Source_Ptr := Sloc (Comp);
|
Index_Typ : constant Entity_Id := Etype (First_Index (Typ));
|
||||||
Index : Entity_Id;
|
Loc : constant Source_Ptr := Sloc (Comp);
|
||||||
|
Index : Entity_Id;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
-- A range update appears as
|
-- A range update appears as
|
||||||
|
|
@ -6703,7 +6707,7 @@ package body Exp_Attr is
|
||||||
-- value of Expr:
|
-- value of Expr:
|
||||||
|
|
||||||
-- for Index in Low .. High loop
|
-- for Index in Low .. High loop
|
||||||
-- Temp (Index) := Expr;
|
-- Temp (<Index_Typ> (Index)) := Expr;
|
||||||
-- end loop;
|
-- end loop;
|
||||||
|
|
||||||
Index := Make_Temporary (Loc, 'I');
|
Index := Make_Temporary (Loc, 'I');
|
||||||
|
|
@ -6722,7 +6726,8 @@ package body Exp_Attr is
|
||||||
Name =>
|
Name =>
|
||||||
Make_Indexed_Component (Loc,
|
Make_Indexed_Component (Loc,
|
||||||
Prefix => New_Reference_To (Temp, Loc),
|
Prefix => New_Reference_To (Temp, Loc),
|
||||||
Expressions => New_List (New_Reference_To (Index, Loc))),
|
Expressions => New_List (
|
||||||
|
Convert_To (Index_Typ, New_Reference_To (Index, Loc)))),
|
||||||
Expression => Relocate_Node (Expr))),
|
Expression => Relocate_Node (Expr))),
|
||||||
|
|
||||||
End_Label => Empty));
|
End_Label => Empty));
|
||||||
|
|
@ -6730,10 +6735,10 @@ package body Exp_Attr is
|
||||||
|
|
||||||
-- Local variables
|
-- Local variables
|
||||||
|
|
||||||
Aggr : constant Node_Id := First (Expressions (N));
|
Aggr : constant Node_Id := First (Expressions (N));
|
||||||
Loc : constant Source_Ptr := Sloc (N);
|
Loc : constant Source_Ptr := Sloc (N);
|
||||||
Pref : constant Node_Id := Prefix (N);
|
Pref : constant Node_Id := Prefix (N);
|
||||||
Typ : constant Entity_Id := Etype (Pref);
|
Typ : constant Entity_Id := Etype (Pref);
|
||||||
Assoc : Node_Id;
|
Assoc : Node_Id;
|
||||||
Comp : Node_Id;
|
Comp : Node_Id;
|
||||||
Expr : Node_Id;
|
Expr : Node_Id;
|
||||||
|
|
@ -6763,7 +6768,7 @@ package body Exp_Attr is
|
||||||
Expr := Expression (Assoc);
|
Expr := Expression (Assoc);
|
||||||
while Present (Comp) loop
|
while Present (Comp) loop
|
||||||
if Nkind (Comp) = N_Range then
|
if Nkind (Comp) = N_Range then
|
||||||
Process_Range_Update (Temp, Comp, Expr);
|
Process_Range_Update (Temp, Comp, Expr, Typ);
|
||||||
else
|
else
|
||||||
Process_Component_Or_Element_Update (Temp, Comp, Expr, Typ);
|
Process_Component_Or_Element_Update (Temp, Comp, Expr, Typ);
|
||||||
end if;
|
end if;
|
||||||
|
|
|
||||||
|
|
@ -7645,7 +7645,7 @@ package body Exp_Disp is
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
return List_Containing (Parent (Typ)) =
|
return List_Containing (Parent (Typ)) =
|
||||||
Visible_Declarations (Specification (Unit_Declaration_Node (Scop)));
|
Visible_Declarations (Package_Specification (Scop));
|
||||||
end Original_View_In_Visible_Part;
|
end Original_View_In_Visible_Part;
|
||||||
|
|
||||||
------------------
|
------------------
|
||||||
|
|
@ -8446,8 +8446,7 @@ package body Exp_Disp is
|
||||||
and then In_Private_Part (Current_Scope)
|
and then In_Private_Part (Current_Scope)
|
||||||
and then
|
and then
|
||||||
List_Containing (Parent (Prim)) =
|
List_Containing (Parent (Prim)) =
|
||||||
Private_Declarations
|
Private_Declarations (Package_Specification (Current_Scope))
|
||||||
(Specification (Unit_Declaration_Node (Current_Scope)))
|
|
||||||
and then Original_View_In_Visible_Part (Typ)
|
and then Original_View_In_Visible_Part (Typ)
|
||||||
then
|
then
|
||||||
-- We exclude Input and Output stream operations because
|
-- We exclude Input and Output stream operations because
|
||||||
|
|
|
||||||
|
|
@ -2874,8 +2874,7 @@ package body Exp_Dist is
|
||||||
|
|
||||||
if RCI_Locator = Empty then
|
if RCI_Locator = Empty then
|
||||||
RCI_Locator_Decl :=
|
RCI_Locator_Decl :=
|
||||||
RCI_Package_Locator
|
RCI_Package_Locator (Loc, Package_Specification (RCI_Package));
|
||||||
(Loc, Specification (Unit_Declaration_Node (RCI_Package)));
|
|
||||||
Prepend_To (Current_Sem_Unit_Declarations, RCI_Locator_Decl);
|
Prepend_To (Current_Sem_Unit_Declarations, RCI_Locator_Decl);
|
||||||
Analyze (RCI_Locator_Decl);
|
Analyze (RCI_Locator_Decl);
|
||||||
RCI_Locator := Defining_Unit_Name (RCI_Locator_Decl);
|
RCI_Locator := Defining_Unit_Name (RCI_Locator_Decl);
|
||||||
|
|
|
||||||
|
|
@ -2741,6 +2741,11 @@ package body Freeze is
|
||||||
|
|
||||||
if Has_Foreign_Convention (Etype (Comp))
|
if Has_Foreign_Convention (Etype (Comp))
|
||||||
and then Has_Pragma_Pack (Rec)
|
and then Has_Pragma_Pack (Rec)
|
||||||
|
|
||||||
|
-- Don't warn for aliased components, since override
|
||||||
|
-- cannot happen in that case.
|
||||||
|
|
||||||
|
and then not Is_Aliased (Comp)
|
||||||
then
|
then
|
||||||
declare
|
declare
|
||||||
CN : constant Name_Id :=
|
CN : constant Name_Id :=
|
||||||
|
|
|
||||||
|
|
@ -1151,6 +1151,27 @@ package body Sem_Aux is
|
||||||
and then Has_Discriminants (Typ));
|
and then Has_Discriminants (Typ));
|
||||||
end Object_Type_Has_Constrained_Partial_View;
|
end Object_Type_Has_Constrained_Partial_View;
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
-- Package_Specification --
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
function Package_Specification (Pack_Id : Entity_Id) return Node_Id is
|
||||||
|
N : Node_Id;
|
||||||
|
|
||||||
|
begin
|
||||||
|
N := Parent (Pack_Id);
|
||||||
|
|
||||||
|
while Nkind (N) /= N_Package_Specification loop
|
||||||
|
N := Parent (N);
|
||||||
|
|
||||||
|
if No (N) then
|
||||||
|
raise Program_Error;
|
||||||
|
end if;
|
||||||
|
end loop;
|
||||||
|
|
||||||
|
return N;
|
||||||
|
end Package_Specification;
|
||||||
|
|
||||||
---------------
|
---------------
|
||||||
-- Tree_Read --
|
-- Tree_Read --
|
||||||
---------------
|
---------------
|
||||||
|
|
|
||||||
|
|
@ -348,4 +348,8 @@ package Sem_Aux is
|
||||||
-- it returns the subprogram, task or protected body node for it. The unit
|
-- it returns the subprogram, task or protected body node for it. The unit
|
||||||
-- may be a child unit with any number of ancestors.
|
-- may be a child unit with any number of ancestors.
|
||||||
|
|
||||||
|
function Package_Specification (Pack_Id : Entity_Id) return Node_Id;
|
||||||
|
-- Given an entity for a package or generic package, return corresponding
|
||||||
|
-- package specification. Simplifies handling of child units, and better
|
||||||
|
-- than the old idiom: Specification (Unit_Declaration_Node (Pack_Id).
|
||||||
end Sem_Aux;
|
end Sem_Aux;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
-- --
|
-- --
|
||||||
-- B o d y --
|
-- B o d y --
|
||||||
-- --
|
-- --
|
||||||
-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
|
-- Copyright (C) 1992-2013, Free Software Foundation, Inc. --
|
||||||
-- --
|
-- --
|
||||||
-- GNAT is free software; you can redistribute it and/or modify it under --
|
-- GNAT is free software; you can redistribute it and/or modify it under --
|
||||||
-- terms of the GNU General Public License as published by the Free Soft- --
|
-- terms of the GNU General Public License as published by the Free Soft- --
|
||||||
|
|
@ -561,8 +561,7 @@ package body Sem_Cat is
|
||||||
and then Is_Package_Or_Generic_Package (Unit_Entity)
|
and then Is_Package_Or_Generic_Package (Unit_Entity)
|
||||||
and then Unit_Kind /= N_Package_Body
|
and then Unit_Kind /= N_Package_Body
|
||||||
and then List_Containing (N) =
|
and then List_Containing (N) =
|
||||||
Visible_Declarations
|
Visible_Declarations (Package_Specification (Unit_Entity))
|
||||||
(Specification (Unit_Declaration_Node (Unit_Entity)))
|
|
||||||
and then not In_Package_Body (Unit_Entity)
|
and then not In_Package_Body (Unit_Entity)
|
||||||
and then not In_Instance;
|
and then not In_Instance;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4028,7 +4028,7 @@ package body Sem_Ch10 is
|
||||||
Is_Private_Descendant (P_Name)
|
Is_Private_Descendant (P_Name)
|
||||||
or else Private_Present (Parent (Lib_Unit)));
|
or else Private_Present (Parent (Lib_Unit)));
|
||||||
|
|
||||||
P_Spec := Specification (Unit_Declaration_Node (P_Name));
|
P_Spec := Package_Specification (P_Name);
|
||||||
Push_Scope (P_Name);
|
Push_Scope (P_Name);
|
||||||
|
|
||||||
-- Save current visibility of unit
|
-- Save current visibility of unit
|
||||||
|
|
|
||||||
|
|
@ -5664,8 +5664,7 @@ package body Sem_Ch12 is
|
||||||
(Related_Instance (Instance))));
|
(Related_Instance (Instance))));
|
||||||
else
|
else
|
||||||
Gen_Id :=
|
Gen_Id :=
|
||||||
Generic_Parent
|
Generic_Parent (Package_Specification (Instance));
|
||||||
(Specification (Unit_Declaration_Node (Instance)));
|
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
Parent_Scope := Scope (Gen_Id);
|
Parent_Scope := Scope (Gen_Id);
|
||||||
|
|
@ -8365,7 +8364,7 @@ package body Sem_Ch12 is
|
||||||
-- of its generic parent.
|
-- of its generic parent.
|
||||||
|
|
||||||
if Is_Generic_Instance (Par) then
|
if Is_Generic_Instance (Par) then
|
||||||
Gen := Generic_Parent (Specification (Unit_Declaration_Node (Par)));
|
Gen := Generic_Parent (Package_Specification (Par));
|
||||||
Gen_E := First_Entity (Gen);
|
Gen_E := First_Entity (Gen);
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
|
|
@ -8449,8 +8448,7 @@ package body Sem_Ch12 is
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
procedure Install_Spec (Par : Entity_Id) is
|
procedure Install_Spec (Par : Entity_Id) is
|
||||||
Spec : constant Node_Id :=
|
Spec : constant Node_Id := Package_Specification (Par);
|
||||||
Specification (Unit_Declaration_Node (Par));
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
-- If this parent of the child instance is a top-level unit,
|
-- If this parent of the child instance is a top-level unit,
|
||||||
|
|
@ -8519,8 +8517,7 @@ package body Sem_Ch12 is
|
||||||
|
|
||||||
First_Par := Inst_Par;
|
First_Par := Inst_Par;
|
||||||
|
|
||||||
Gen_Par :=
|
Gen_Par := Generic_Parent (Package_Specification (Inst_Par));
|
||||||
Generic_Parent (Specification (Unit_Declaration_Node (Inst_Par)));
|
|
||||||
|
|
||||||
First_Gen := Gen_Par;
|
First_Gen := Gen_Par;
|
||||||
|
|
||||||
|
|
@ -8538,9 +8535,7 @@ package body Sem_Ch12 is
|
||||||
Inst_Par := Renamed_Entity (Inst_Par);
|
Inst_Par := Renamed_Entity (Inst_Par);
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
Gen_Par :=
|
Gen_Par := Generic_Parent (Package_Specification (Inst_Par));
|
||||||
Generic_Parent
|
|
||||||
(Specification (Unit_Declaration_Node (Inst_Par)));
|
|
||||||
|
|
||||||
if Present (Gen_Par) then
|
if Present (Gen_Par) then
|
||||||
Prepend_Elmt (Inst_Par, Ancestors);
|
Prepend_Elmt (Inst_Par, Ancestors);
|
||||||
|
|
@ -9009,7 +9004,7 @@ package body Sem_Ch12 is
|
||||||
end if;
|
end if;
|
||||||
|
|
||||||
if Nkind (Parent (Actual_Pack)) = N_Defining_Program_Unit_Name then
|
if Nkind (Parent (Actual_Pack)) = N_Defining_Program_Unit_Name then
|
||||||
Parent_Spec := Specification (Unit_Declaration_Node (Actual_Pack));
|
Parent_Spec := Package_Specification (Actual_Pack);
|
||||||
else
|
else
|
||||||
Parent_Spec := Parent (Actual_Pack);
|
Parent_Spec := Parent (Actual_Pack);
|
||||||
end if;
|
end if;
|
||||||
|
|
@ -12571,8 +12566,7 @@ package body Sem_Ch12 is
|
||||||
elsif S = Current_Scope and then Is_Generic_Instance (S) then
|
elsif S = Current_Scope and then Is_Generic_Instance (S) then
|
||||||
declare
|
declare
|
||||||
Par : constant Entity_Id :=
|
Par : constant Entity_Id :=
|
||||||
Generic_Parent
|
Generic_Parent (Package_Specification (S));
|
||||||
(Specification (Unit_Declaration_Node (S)));
|
|
||||||
begin
|
begin
|
||||||
if Present (Par)
|
if Present (Par)
|
||||||
and then P = Scope (Par)
|
and then P = Scope (Par)
|
||||||
|
|
|
||||||
|
|
@ -10919,8 +10919,7 @@ package body Sem_Ch3 is
|
||||||
elsif Ekind (Current_Scope) = E_Package
|
elsif Ekind (Current_Scope) = E_Package
|
||||||
and then
|
and then
|
||||||
List_Containing (Parent (Prev)) /=
|
List_Containing (Parent (Prev)) /=
|
||||||
Visible_Declarations
|
Visible_Declarations (Package_Specification (Current_Scope))
|
||||||
(Specification (Unit_Declaration_Node (Current_Scope)))
|
|
||||||
then
|
then
|
||||||
Error_Msg_N
|
Error_Msg_N
|
||||||
("deferred constant must be declared in visible part",
|
("deferred constant must be declared in visible part",
|
||||||
|
|
|
||||||
|
|
@ -10318,8 +10318,7 @@ package body Sem_Ch6 is
|
||||||
and then In_Private_Part (Current_Scope)
|
and then In_Private_Part (Current_Scope)
|
||||||
then
|
then
|
||||||
Priv_Decls :=
|
Priv_Decls :=
|
||||||
Private_Declarations
|
Private_Declarations (Package_Specification (Current_Scope));
|
||||||
(Specification (Unit_Declaration_Node (Current_Scope)));
|
|
||||||
|
|
||||||
return In_Package_Body (Current_Scope)
|
return In_Package_Body (Current_Scope)
|
||||||
or else
|
or else
|
||||||
|
|
|
||||||
|
|
@ -21725,7 +21725,7 @@ package body Sem_Prag is
|
||||||
|
|
||||||
-- Local variables
|
-- Local variables
|
||||||
|
|
||||||
Pack_Spec : constant Node_Id := Parent (Spec_Id);
|
Pack_Spec : constant Node_Id := Package_Specification (Spec_Id);
|
||||||
|
|
||||||
-- Start of processing for Collect_Hidden_States
|
-- Start of processing for Collect_Hidden_States
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue