diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-01-12 14:26:34 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-01-12 14:26:34 +0100 |
commit | 10c2c151f1204439e8b2698bf3369b8d2c29efbf (patch) | |
tree | 80e49955bfd3f2d49c89a57866549b8b830d0bb6 /gcc/ada/exp_ch6.adb | |
parent | 84e13614352202b592fd28fc12c18c07b5ae5d53 (diff) | |
download | gcc-10c2c151f1204439e8b2698bf3369b8d2c29efbf.zip gcc-10c2c151f1204439e8b2698bf3369b8d2c29efbf.tar.gz gcc-10c2c151f1204439e8b2698bf3369b8d2c29efbf.tar.bz2 |
[multiple changes]
2017-01-12 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch6.adb: Minor reformatting.
* spark_xrefs.ads: minor cleanup of comments for SPARK xrefs
2017-01-12 Bob Duff <duff@adacore.com>
* binde.adb (Forced): New reason for a dependence.
(Force_Elab_Order): Implementation of the new switch.
* binde.ads: Minor comment fixes.
* bindusg.adb: Add -f switch. Apparently, there was an -f switch
long ago that is no longer supported; removed comment about that.
* opt.ads (Force_Elab_Order_File): Name of file specified for
-f switch.
* switch-b.adb: Parse -f switch.
From-SVN: r244355
Diffstat (limited to 'gcc/ada/exp_ch6.adb')
-rw-r--r-- | gcc/ada/exp_ch6.adb | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 9b740ca..145ae93 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -2265,9 +2265,8 @@ package body Exp_Ch6 is -- extra formal. procedure Check_View_Conversion (Formal : Entity_Id; Actual : Node_Id); - -- Adds Invariant checks for every intermediate type between - -- the range of a view converted argument to its ancestor (from - -- parent to child). + -- Adds invariant checks for every intermediate type between the range + -- of a view converted argument to its ancestor (from parent to child). function Inherited_From_Formal (S : Entity_Id) return Entity_Id; -- Within an instance, a type derived from an untagged formal derived @@ -2361,31 +2360,35 @@ package body Exp_Ch6 is procedure Check_View_Conversion (Formal : Entity_Id; Actual : Node_Id) is Arg : Entity_Id; - Curr_Typ : Entity_Id := Empty; + Curr_Typ : Entity_Id; Inv_Checks : List_Id; Par_Typ : Entity_Id; begin Inv_Checks := No_List; - -- Extract actual object for type conversions + -- Extract the argument from a potentially nested set of view + -- conversions. Arg := Actual; while Nkind (Arg) = N_Type_Conversion loop Arg := Expression (Arg); end loop; - -- Move up the derivation chain starting with the type of the - -- the formal parameter down to the type of the actual object. + -- Move up the derivation chain starting with the type of the formal + -- parameter down to the type of the actual object. - Par_Typ := Etype (Arg); + Curr_Typ := Empty; + Par_Typ := Etype (Arg); while Par_Typ /= Etype (Formal) and Par_Typ /= Curr_Typ loop Curr_Typ := Par_Typ; + if Has_Invariants (Curr_Typ) and then Present (Invariant_Procedure (Curr_Typ)) then -- Verify the invariate of the current type. Generate: - -- Invariant_Check_Curr_Typ (Curr_Typ (Arg)); + + -- <Curr_Typ>Invariant (Curr_Typ (Arg)); Prepend_New_To (Inv_Checks, Make_Procedure_Call_Statement (Loc, @@ -3292,7 +3295,7 @@ package body Exp_Ch6 is -- Invariant checks are performed for every intermediate type between -- the range of a view converted argument to its ancestor (from -- parent to child) if it is passed as an "out" or "in out" parameter - -- after executing the call (RM 7.3.2 (11-14)). + -- after executing the call (RM 7.3.2 (12/3, 13/3, 14/3)). if Ekind (Formal) /= E_In_Parameter and then Nkind (Actual) = N_Type_Conversion |