From: Arnaud Charlet Date: Fri, 8 Sep 2017 10:15:44 +0000 (+0200) Subject: [multiple changes] X-Git-Tag: upstream/12.2.0~37141 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ae5115dd461d00506776bc76bb8f03e8129ac683;p=platform%2Fupstream%2Fgcc.git [multiple changes] 2017-09-08 Gary Dismukes * par-ch4.adb: Reformatting of an error message. 2017-09-08 Javier Miranda * sem_ch3.adb (Resolve_Name): Under ASIS mode analyze overloaded identifiers to ensure their correct decoration of names on aspect expressions. 2017-09-08 Yannick Moy * exp_attr.adb (Expand_Loop_Entry_Attribute): Do not skip a loop coming from source which is rewritten into a loop. 2017-09-08 Ed Schonberg * freeze.adb (Wrap_Imported_Subprogram): Indicate that the wrapper has convention Ada, to prevent spurious warnings on unconstrained array parameters. 2017-09-08 Eric Botcazou * sem_prag.adb (Check_Variant): Use First_Non_Pragma/Next_Non_Pragma. (Analyze_Pragma) : Likewise. 2017-09-08 Eric Botcazou * sem_ch6.adb (Freeze_Expr_Types): Rename Spec_Id into Def_Id. From-SVN: r251884 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 7c9adb7..52e46c6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,33 @@ +2017-09-08 Gary Dismukes + + * par-ch4.adb: Reformatting of an error message. + +2017-09-08 Javier Miranda + + * sem_ch3.adb (Resolve_Name): Under ASIS mode analyze overloaded + identifiers to ensure their correct decoration of names on + aspect expressions. + +2017-09-08 Yannick Moy + + * exp_attr.adb (Expand_Loop_Entry_Attribute): Do + not skip a loop coming from source which is rewritten into a loop. + +2017-09-08 Ed Schonberg + + * freeze.adb (Wrap_Imported_Subprogram): Indicate that the + wrapper has convention Ada, to prevent spurious warnings on + unconstrained array parameters. + +2017-09-08 Eric Botcazou + + * sem_prag.adb (Check_Variant): Use First_Non_Pragma/Next_Non_Pragma. + (Analyze_Pragma) : Likewise. + +2017-09-08 Eric Botcazou + + * sem_ch6.adb (Freeze_Expr_Types): Rename Spec_Id into Def_Id. + 2017-09-08 Arnaud Charlet * exp_intr.adb (Append_Entity_Name): Move to ... diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb index bd354d5..b7b35eb 100644 --- a/gcc/ada/exp_attr.adb +++ b/gcc/ada/exp_attr.adb @@ -1086,7 +1086,8 @@ package body Exp_Attr is Loop_Stmt := N; while Present (Loop_Stmt) loop if Nkind (Loop_Stmt) = N_Loop_Statement - and then Comes_From_Source (Loop_Stmt) + and then Nkind (Original_Node (Loop_Stmt)) = N_Loop_Statement + and then Comes_From_Source (Original_Node (Loop_Stmt)) then exit; end if; diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 437951c..c4cc6a3 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -5122,12 +5122,13 @@ package body Freeze is Prag := Copy_Import_Pragma; - -- Fix up spec to be not imported any more + -- Fix up spec so it is no longer imported and has convention Ada Set_Has_Completion (E, False); Set_Import_Pragma (E, Empty); Set_Interface_Name (E, Empty); Set_Is_Imported (E, False); + Set_Convention (E, Convention_Ada); -- Grab the subprogram declaration and specification diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb index fd0373e..00c7e61 100644 --- a/gcc/ada/par-ch4.adb +++ b/gcc/ada/par-ch4.adb @@ -3319,7 +3319,7 @@ package body Ch4 is Set_Expression (Assoc_Node, P_Expression); if Ada_Version < Ada_2020 then - Error_Msg_SC ("Iterated component is an Ada 2020 extension"); + Error_Msg_SC ("iterated component is an Ada 2020 extension"); Error_Msg_SC ("\compile with -gnatX"); end if; diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 98cc3fa..ecfc49e 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -12704,7 +12704,16 @@ package body Sem_Ch13 is elsif Nkind (N) = N_Identifier and then Chars (N) /= Chars (E) then Find_Direct_Name (N); - if not ASIS_Mode then + -- In ASIS mode we must analyze overloaded identifiers to ensure + -- their correct decoration because expansion is disabled (and + -- the expansion of freeze nodes takes care of resolving aspect + -- expressions). + + if ASIS_Mode then + if Is_Overloaded (N) then + Analyze (Parent (N)); + end if; + else Set_Entity (N, Empty); end if; diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 3c6f363..f1d5102 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -267,8 +267,8 @@ package body Sem_Ch6 is LocX : constant Source_Ptr := Sloc (Expr); Spec : constant Node_Id := Specification (N); - procedure Freeze_Expr_Types (Spec_Id : Entity_Id); - -- N is an expression function that is a completion and Spec_Id its + procedure Freeze_Expr_Types (Def_Id : Entity_Id); + -- N is an expression function that is a completion and Def_Id its -- defining entity. Freeze before N all the types referenced by the -- expression of the function. @@ -276,7 +276,7 @@ package body Sem_Ch6 is -- Freeze_Expr_Types -- ----------------------- - procedure Freeze_Expr_Types (Spec_Id : Entity_Id) is + procedure Freeze_Expr_Types (Def_Id : Entity_Id) is function Cloned_Expression return Node_Id; -- Build a duplicate of the expression of the return statement that -- has no defining entities shared with the original expression. @@ -355,7 +355,7 @@ package body Sem_Ch6 is -- Skip Itypes created by the preanalysis if Is_Itype (Typ) - and then Scope_Within_Or_Same (Scope (Typ), Spec_Id) + and then Scope_Within_Or_Same (Scope (Typ), Def_Id) then return; end if; @@ -419,8 +419,8 @@ package body Sem_Ch6 is -- Local variables - Saved_First_Entity : constant Entity_Id := First_Entity (Spec_Id); - Saved_Last_Entity : constant Entity_Id := Last_Entity (Spec_Id); + Saved_First_Entity : constant Entity_Id := First_Entity (Def_Id); + Saved_Last_Entity : constant Entity_Id := Last_Entity (Def_Id); Dup_Expr : constant Node_Id := Cloned_Expression; -- Start of processing for Freeze_Expr_Types @@ -433,24 +433,24 @@ package body Sem_Ch6 is -- spurious errors on Ghost entities (since the expression is not -- fully analyzed). - Push_Scope (Spec_Id); - Install_Formals (Spec_Id); + Push_Scope (Def_Id); + Install_Formals (Def_Id); Ignore_Errors_Enable := Ignore_Errors_Enable + 1; - Preanalyze_Spec_Expression (Dup_Expr, Etype (Spec_Id)); + Preanalyze_Spec_Expression (Dup_Expr, Etype (Def_Id)); Ignore_Errors_Enable := Ignore_Errors_Enable - 1; End_Scope; - -- Restore certain attributes of Spec_Id since the preanalysis may + -- Restore certain attributes of Def_Id since the preanalysis may -- have introduced itypes to this scope, thus modifying attributes -- First_Entity and Last_Entity. - Set_First_Entity (Spec_Id, Saved_First_Entity); - Set_Last_Entity (Spec_Id, Saved_Last_Entity); + Set_First_Entity (Def_Id, Saved_First_Entity); + Set_Last_Entity (Def_Id, Saved_Last_Entity); - if Present (Last_Entity (Spec_Id)) then - Set_Next_Entity (Last_Entity (Spec_Id), Empty); + if Present (Last_Entity (Def_Id)) then + Set_Next_Entity (Last_Entity (Def_Id), Empty); end if; -- Freeze all types referenced in the expression diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index b013755a..e7a010d 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -6350,10 +6350,10 @@ package body Sem_Prag is Comp : Node_Id; begin - Comp := First (Component_Items (Clist)); + Comp := First_Non_Pragma (Component_Items (Clist)); while Present (Comp) loop Check_Component (Comp, UU_Typ, In_Variant_Part => True); - Next (Comp); + Next_Non_Pragma (Comp); end loop; end Check_Variant; @@ -23316,20 +23316,20 @@ package body Sem_Prag is -- Check components - Comp := First (Component_Items (Clist)); + Comp := First_Non_Pragma (Component_Items (Clist)); while Present (Comp) loop Check_Component (Comp, Typ); - Next (Comp); + Next_Non_Pragma (Comp); end loop; -- Check variant part Vpart := Variant_Part (Clist); - Variant := First (Variants (Vpart)); + Variant := First_Non_Pragma (Variants (Vpart)); while Present (Variant) loop Check_Variant (Variant, Typ); - Next (Variant); + Next_Non_Pragma (Variant); end loop; end if; diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index d8f9076..2fda6b9 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -9375,6 +9375,7 @@ package body Sem_Res is return; elsif Nkind (Parent (N)) in N_Op + and then Present (Etype (Parent (N))) and then Is_Fixed_Point_Type (Etype (Parent (N))) and then Etype (N) = Universal_Real and then Comes_From_Source (N)