[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Fri, 8 Sep 2017 10:15:44 +0000 (12:15 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 8 Sep 2017 10:15:44 +0000 (12:15 +0200)
2017-09-08  Gary Dismukes  <dismukes@adacore.com>

* par-ch4.adb: Reformatting of an error message.

2017-09-08  Javier Miranda  <miranda@adacore.com>

* 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  <moy@adacore.com>

* 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  <schonberg@adacore.com>

* 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  <ebotcazou@adacore.com>

* sem_prag.adb (Check_Variant): Use First_Non_Pragma/Next_Non_Pragma.
(Analyze_Pragma) <Pragma_Unchecked_Union>: Likewise.

2017-09-08  Eric Botcazou  <ebotcazou@adacore.com>

* sem_ch6.adb (Freeze_Expr_Types): Rename Spec_Id into Def_Id.

From-SVN: r251884

gcc/ada/ChangeLog
gcc/ada/exp_attr.adb
gcc/ada/freeze.adb
gcc/ada/par-ch4.adb
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_prag.adb
gcc/ada/sem_res.adb

index 7c9adb7..52e46c6 100644 (file)
@@ -1,3 +1,33 @@
+2017-09-08  Gary Dismukes  <dismukes@adacore.com>
+
+       * par-ch4.adb: Reformatting of an error message.
+
+2017-09-08  Javier Miranda  <miranda@adacore.com>
+
+       * 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  <moy@adacore.com>
+
+       * 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  <schonberg@adacore.com>
+
+       * 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  <ebotcazou@adacore.com>
+
+       * sem_prag.adb (Check_Variant): Use First_Non_Pragma/Next_Non_Pragma.
+       (Analyze_Pragma) <Pragma_Unchecked_Union>: Likewise.
+
+2017-09-08  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * sem_ch6.adb (Freeze_Expr_Types): Rename Spec_Id into Def_Id.
+
 2017-09-08  Arnaud Charlet  <charlet@adacore.com>
 
        * exp_intr.adb (Append_Entity_Name): Move to ...
index bd354d5..b7b35eb 100644 (file)
@@ -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;
index 437951c..c4cc6a3 100644 (file)
@@ -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
 
index fd0373e..00c7e61 100644 (file)
@@ -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;
 
index 98cc3fa..ecfc49e 100644 (file)
@@ -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;
 
index 3c6f363..f1d5102 100644 (file)
@@ -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
index b013755..e7a010d 100644 (file)
@@ -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;
 
index d8f9076..2fda6b9 100644 (file)
@@ -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)