aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch4.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2004-02-09 15:56:05 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2004-02-09 15:56:05 +0100
commit2e0717349d7cb5660d38c281ab6c65d5e01fa8fc (patch)
tree9d8577ad0140661a3b83d8e92d9d61821ae41213 /gcc/ada/exp_ch4.adb
parent77077b39cb4b8bf659af916a7a055413afb41e9e (diff)
downloadgcc-2e0717349d7cb5660d38c281ab6c65d5e01fa8fc.zip
gcc-2e0717349d7cb5660d38c281ab6c65d5e01fa8fc.tar.gz
gcc-2e0717349d7cb5660d38c281ab6c65d5e01fa8fc.tar.bz2
[multiple changes]
2004-02-09 Ed Schonberg <schonberg@gnat.com> * exp_ch4.adb (Expand_N_Op_Eq): When looking for the primitive equality for a tagged type, verify that both formals have the same type. * exp_ch6.adb (Add_Call_By_Copy_Code): Initialize properly the temporary when the formal is an in-parameter and the actual a possibly unaligned slice. * exp_ch9.adb (Expand_Entry_Barrier): Resolve barrier expression even when expansion is disabled, to ensure proper name capture with overloaded literals. Condition can be of any boolean type, resolve accordingly. * sem_ch8.adb (Analyze_Subprogram_Renaming): Emit warning if the renaming is for a formal subprogram with a default operator name, and there is a usable operator that is visible at the point of instantiation. 2004-02-09 Robert Dewar <dewar@gnat.com> * ali.adb (Scan_Ali) Add Ignore_Errors argument. This is a major rewrite to ignore errors in ali files, intended to allow tools downward compatibility with new versions of ali files. * ali.ads: Add new parameter Ignore_Errors * bcheck.adb (Check_Consistent_Restrictions): Fix error of sometimes duplicating the error message giving the file with restrictions. * debug.adb: Add debug flag I for gnatbind * errout.adb (Set_Msg_Insertion_Node): Suppress extra quotes around operators for the case where the operator is a defining operator. * exp_ch3.adb: Minor reformatting (new function spec format). * exp_ch4.adb: Add comment for previous change, and make minor adjustment to loop to always check for improper loop termination. Minor reformatting throughout (new function spec format). * gnatbind.adb: Implement -di debug flag for gnatbind * gnatlink.adb: Call Scan_ALI with Ignore_Errors set to True * gnatls.adb: Call Scan_ALI with Ignore_Errors set to True * lib-load.adb: Fix bad assertion. Found by testing and code reading. Minor reformatting. * lib-load.ads: Minor reformatting. * lib-writ.adb: There is only one R line now. * lib-writ.ads: Add documentation on making downward compatible changes to ali files so old tools work with new ali files. There is only one R line now. Add documentation on format incompatibilities (with special GPS note) * namet.ads, namet.adb: (Is_Operator_Name): New procedure * par-load.adb: Minor reformatting * sem_ch8.adb: Fix to error message from last update Minor reformatting and restructuring of code from last update * par-prag.adb, snames.adb, snames.ads, snames.h, sem_prag.adb: Implement pragma Profile. * stylesw.adb: Implement -gnatyN switch to turn off all style check options. * usage.adb: Add line for -gnatyN switch * vms_data.ads: Add entry STYLE_CHECKS=NONE for -gnatyN From-SVN: r77537
Diffstat (limited to 'gcc/ada/exp_ch4.adb')
-rw-r--r--gcc/ada/exp_ch4.adb103
1 files changed, 49 insertions, 54 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 1f2640d..b176417 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -98,8 +98,7 @@ package body Exp_Ch4 is
A_Typ : Entity_Id;
Lhs : Node_Id;
Rhs : Node_Id;
- Bodies : List_Id)
- return Node_Id;
+ Bodies : List_Id) return Node_Id;
-- Expand an array equality into a call to a function implementing this
-- equality, and a call to it. Loc is the location for the generated
-- nodes. Typ is the type of the array, and Lhs, Rhs are the array
@@ -119,8 +118,7 @@ package body Exp_Ch4 is
Typ : Entity_Id;
Lhs : Node_Id;
Rhs : Node_Id;
- Bodies : List_Id)
- return Node_Id;
+ Bodies : List_Id) return Node_Id;
-- Local recursive function used to expand equality for nested
-- composite types. Used by Expand_Record/Array_Equality, Bodies
-- is a list on which to attach bodies of local functions that are
@@ -150,8 +148,7 @@ package body Exp_Ch4 is
function Get_Allocator_Final_List
(N : Node_Id;
T : Entity_Id;
- PtrT : Entity_Id)
- return Entity_Id;
+ PtrT : Entity_Id) return Entity_Id;
-- If the designated type is controlled, build final_list expression
-- for created object. If context is an access parameter, create a
-- local access type to have a usable finalization list.
@@ -161,9 +158,8 @@ package body Exp_Ch4 is
-- from Checked_Pool, expands a call to the primitive 'dereference'.
function Make_Array_Comparison_Op
- (Typ : Entity_Id;
- Nod : Node_Id)
- return Node_Id;
+ (Typ : Entity_Id;
+ Nod : Node_Id) return Node_Id;
-- Comparisons between arrays are expanded in line. This function
-- produces the body of the implementation of (a > b), where a and b
-- are one-dimensional arrays of some discrete type. The original
@@ -171,9 +167,8 @@ package body Exp_Ch4 is
-- Nod provides the Sloc value for the generated code.
function Make_Boolean_Array_Op
- (Typ : Entity_Id;
- N : Node_Id)
- return Node_Id;
+ (Typ : Entity_Id;
+ N : Node_Id) return Node_Id;
-- Boolean operations on boolean arrays are expanded in line. This
-- function produce the body for the node N, which is (a and b),
-- (a or b), or (a xor b). It is used only the normal case and not
@@ -193,10 +188,9 @@ package body Exp_Ch4 is
-- Deals with a second operand being (or not) a class-wide type.
function Safe_In_Place_Array_Op
- (Lhs : Node_Id;
- Op1 : Node_Id;
- Op2 : Node_Id)
- return Boolean;
+ (Lhs : Node_Id;
+ Op1 : Node_Id;
+ Op2 : Node_Id) return Boolean;
-- In the context of an assignment, where the right-hand side is a
-- boolean operation on arrays, check whether operation can be performed
-- in place.
@@ -913,8 +907,7 @@ package body Exp_Ch4 is
A_Typ : Entity_Id;
Lhs : Node_Id;
Rhs : Node_Id;
- Bodies : List_Id)
- return Node_Id
+ Bodies : List_Id) return Node_Id
is
Loc : constant Source_Ptr := Sloc (Nod);
Decls : constant List_Id := New_List;
@@ -932,8 +925,7 @@ package body Exp_Ch4 is
function Arr_Attr
(Arr : Entity_Id;
Nam : Name_Id;
- Num : Int)
- return Node_Id;
+ Num : Int) return Node_Id;
-- This builds the attribute reference Arr'Nam (Expr).
function Component_Equality (Typ : Entity_Id) return Node_Id;
@@ -942,8 +934,7 @@ package body Exp_Ch4 is
function Handle_One_Dimension
(N : Int;
- Index : Node_Id)
- return Node_Id;
+ Index : Node_Id) return Node_Id;
-- This procedure returns a declare block:
--
-- declare
@@ -990,8 +981,7 @@ package body Exp_Ch4 is
function Arr_Attr
(Arr : Entity_Id;
Nam : Name_Id;
- Num : Int)
- return Node_Id
+ Num : Int) return Node_Id
is
begin
return
@@ -1039,8 +1029,7 @@ package body Exp_Ch4 is
function Handle_One_Dimension
(N : Int;
- Index : Node_Id)
- return Node_Id
+ Index : Node_Id) return Node_Id
is
An : constant Entity_Id := Make_Defining_Identifier (Loc,
Chars => New_Internal_Name ('A'));
@@ -1337,8 +1326,7 @@ package body Exp_Ch4 is
Typ : Entity_Id;
Lhs : Node_Id;
Rhs : Node_Id;
- Bodies : List_Id)
- return Node_Id
+ Bodies : List_Id) return Node_Id
is
Loc : constant Source_Ptr := Sloc (Nod);
Full_Type : Entity_Id;
@@ -2841,10 +2829,9 @@ package body Exp_Ch4 is
Check_Subscripts : declare
function Construct_Attribute_Reference
- (E : Node_Id;
- Nam : Name_Id;
- Dim : Nat)
- return Node_Id;
+ (E : Node_Id;
+ Nam : Name_Id;
+ Dim : Nat) return Node_Id;
-- Build attribute reference E'Nam(Dim)
-----------------------------------
@@ -2852,10 +2839,9 @@ package body Exp_Ch4 is
-----------------------------------
function Construct_Attribute_Reference
- (E : Node_Id;
- Nam : Name_Id;
- Dim : Nat)
- return Node_Id
+ (E : Node_Id;
+ Nam : Name_Id;
+ Dim : Nat) return Node_Id
is
begin
return
@@ -3710,13 +3696,23 @@ package body Exp_Ch4 is
and then Is_Derived_Type (A_Typ)
and then No (Full_View (A_Typ))
then
+ -- Search for equality operation, checking that the
+ -- operands have the same type. Note that we must find
+ -- a matching entry, or something is very wrong!
+
Prim := First_Elmt (Collect_Primitive_Operations (A_Typ));
- while Chars (Node (Prim)) /= Name_Op_Eq loop
+ while Present (Prim) loop
+ exit when Chars (Node (Prim)) = Name_Op_Eq
+ and then Etype (First_Formal (Node (Prim))) =
+ Etype (Next_Formal (First_Formal (Node (Prim))))
+ and then
+ Base_Type (Etype (Node (Prim))) = Standard_Boolean;
+
Next_Elmt (Prim);
- pragma Assert (Present (Prim));
end loop;
+ pragma Assert (Present (Prim));
Op_Name := Node (Prim);
-- Find the type's predefined equality or an overriding
@@ -3741,9 +3737,9 @@ package body Exp_Ch4 is
Base_Type (Etype (Node (Prim))) = Standard_Boolean;
Next_Elmt (Prim);
- pragma Assert (Present (Prim));
end loop;
+ pragma Assert (Present (Prim));
Op_Name := Node (Prim);
end if;
@@ -6340,8 +6336,7 @@ package body Exp_Ch4 is
Typ : Entity_Id;
Lhs : Node_Id;
Rhs : Node_Id;
- Bodies : List_Id)
- return Node_Id
+ Bodies : List_Id) return Node_Id
is
Loc : constant Source_Ptr := Sloc (Nod);
@@ -6496,8 +6491,7 @@ package body Exp_Ch4 is
function Get_Allocator_Final_List
(N : Node_Id;
T : Entity_Id;
- PtrT : Entity_Id)
- return Entity_Id
+ PtrT : Entity_Id) return Entity_Id
is
Loc : constant Source_Ptr := Sloc (N);
Acc : Entity_Id;
@@ -6540,7 +6534,11 @@ package body Exp_Ch4 is
Pool : constant Entity_Id := Associated_Storage_Pool (Typ);
function Is_Checked_Storage_Pool (P : Entity_Id) return Boolean;
- -- return true if type of P is derived from Checked_Pool;
+ -- Return true if type of P is derived from Checked_Pool;
+
+ -----------------------------
+ -- Is_Checked_Storage_Pool --
+ -----------------------------
function Is_Checked_Storage_Pool (P : Entity_Id) return Boolean is
T : Entity_Id;
@@ -6662,9 +6660,8 @@ package body Exp_Ch4 is
-- instantiated function itself.
function Make_Array_Comparison_Op
- (Typ : Entity_Id;
- Nod : Node_Id)
- return Node_Id
+ (Typ : Entity_Id;
+ Nod : Node_Id) return Node_Id
is
Loc : constant Source_Ptr := Sloc (Nod);
@@ -6897,9 +6894,8 @@ package body Exp_Ch4 is
-- Here typ is the boolean array type
function Make_Boolean_Array_Op
- (Typ : Entity_Id;
- N : Node_Id)
- return Node_Id
+ (Typ : Entity_Id;
+ N : Node_Id) return Node_Id
is
Loc : constant Source_Ptr := Sloc (N);
@@ -7069,10 +7065,9 @@ package body Exp_Ch4 is
----------------------------
function Safe_In_Place_Array_Op
- (Lhs : Node_Id;
- Op1 : Node_Id;
- Op2 : Node_Id)
- return Boolean
+ (Lhs : Node_Id;
+ Op1 : Node_Id;
+ Op2 : Node_Id) return Boolean
is
Target : Entity_Id;