]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Tue, 2 Oct 2012 08:19:14 +0000 (10:19 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 2 Oct 2012 08:19:14 +0000 (10:19 +0200)
2012-10-02  Vincent Pucci  <pucci@adacore.com>

* sem_attr.adb (Analyze_Attribute): Check dimension for attribute
Old before it gets expanded.
* sem_dim.adb (Analyze_Dimension_Has_Etype): Correctly propagate
dimensions for identifier.

2012-10-02  Ed Schonberg  <schonberg@adacore.com>

* exp_ch5.adb (Expand_Iterator_Loop): Handle properly the case
where the iterator type is derived locally from an instantiation
of Ada.Iterators_Interface.
* exp_ch7.adb (Establish_Transient_Scope): Do not create a
transient scope if within the expansion of an iterator loop,
because a transient block already exists.

2012-10-02  Vincent Celier  <celier@adacore.com>

* gnatcmd.adb: Use absolute path for configuration pragmas files
* make.adb (Configuration_Pragmas_Switch.Absolute_Path): Moved
to Makeutl.
* makeutl.ads, makeutl.adb (Absolute_Path): New function, moved from
make.adb.

2012-10-02  Vincent Celier  <celier@adacore.com>

* prj-part.adb (Post_Parse_Context_Clause): Resurrect Boolean
parameter In_Limited.  Check for circularity also if In_Limited
is True.
(Parse_Single_Project): Call Post_Parse_Context_Clause with
In_Limited parameter.

From-SVN: r191961

gcc/ada/ChangeLog
gcc/ada/exp_ch5.adb
gcc/ada/exp_ch7.adb
gcc/ada/gnatcmd.adb
gcc/ada/make.adb
gcc/ada/makeutl.adb
gcc/ada/makeutl.ads
gcc/ada/prj-part.adb
gcc/ada/sem_attr.adb
gcc/ada/sem_dim.adb

index 79f37c74773266a5861d160c8c935da352d843cc..bd069612248769b9e90a73c3d26bfafcae5e9ff2 100644 (file)
@@ -1,3 +1,35 @@
+2012-10-02  Vincent Pucci  <pucci@adacore.com>
+
+       * sem_attr.adb (Analyze_Attribute): Check dimension for attribute
+       Old before it gets expanded.
+       * sem_dim.adb (Analyze_Dimension_Has_Etype): Correctly propagate
+       dimensions for identifier.
+
+2012-10-02  Ed Schonberg  <schonberg@adacore.com>
+
+       * exp_ch5.adb (Expand_Iterator_Loop): Handle properly the case
+       where the iterator type is derived locally from an instantiation
+       of Ada.Iterators_Interface.
+       * exp_ch7.adb (Establish_Transient_Scope): Do not create a
+       transient scope if within the expansion of an iterator loop,
+       because a transient block already exists.
+
+2012-10-02  Vincent Celier  <celier@adacore.com>
+
+       * gnatcmd.adb: Use absolute path for configuration pragmas files
+       * make.adb (Configuration_Pragmas_Switch.Absolute_Path): Moved
+       to Makeutl.
+       * makeutl.ads, makeutl.adb (Absolute_Path): New function, moved from
+       make.adb.
+
+2012-10-02  Vincent Celier  <celier@adacore.com>
+
+       * prj-part.adb (Post_Parse_Context_Clause): Resurrect Boolean
+       parameter In_Limited.  Check for circularity also if In_Limited
+       is True.
+       (Parse_Single_Project): Call Post_Parse_Context_Clause with
+       In_Limited parameter.
+
 2012-10-02  Bob Duff  <duff@adacore.com>
 
        * checks.adb (Apply_Predicate_Check): Disable check in -gnatc mode.
index a1aaa37363e2ab3150517d2db15a1ff03bbf153f..e9ec75ed0030e6cf1e1acaa7cb4915173b37fe2a 100644 (file)
@@ -3039,10 +3039,18 @@ package body Exp_Ch5 is
                Cursor := Make_Temporary (Loc, 'I');
 
                --  For an container element iterator, the iterator type
-               --  is obtained from the corresponding aspect.
+               --  is obtained from the corresponding aspect, whose return
+               --  type is descended from the corresponding interface type
+               --  in some instance of Ada.Iterator_Interfaces. The actuals
+               --  of that instantiation are Cursor and Has_Element.
 
                Iter_Type := Etype (Default_Iter);
-               Pack := Scope (Iter_Type);
+
+               --  The iterator type, which is a class_wide type,  may itself
+               --  be derived locally, so the desired instantiation is the
+               --  scope of the root type of the iterator type.
+
+               Pack := Scope (Root_Type (Etype (Iter_Type)));
 
                --  Rewrite domain of iteration as a call to the default
                --  iterator for the container type. If the container is
index 9c6955a7b9ebdad20c72e98eb85ff15f5534f666..2a2b7dde4bb874717b05a5c472bc486ab54af83d 100644 (file)
@@ -3639,9 +3639,13 @@ package body Exp_Ch7 is
       --  If the node to wrap is an iteration_scheme, the expression is
       --  one of the bounds, and the expansion will make an explicit
       --  declaration for it (see Analyze_Iteration_Scheme, sem_ch5.adb),
-      --  so do not apply any transformations here.
+      --  so do not apply any transformations here. Same for an Ada 2012
+      --  iterator specification, where a block is created for the expression
+      --  that build the container.
 
-      elsif Nkind (Wrap_Node) = N_Iteration_Scheme then
+      elsif Nkind (Wrap_Node) = N_Iteration_Scheme
+        or else Nkind (Wrap_Node) = N_Iterator_Specification
+      then
          null;
 
       --  In formal verification mode, if the node to wrap is a pragma check,
index 7e547535aca851f5cbf44af32b41f4db0664f029..1919f9a00350e1f36a5f9da0b8fa4de71038bb8a 100644 (file)
@@ -2352,9 +2352,14 @@ begin
                      if Variable /= Nil_Variable_Value
                        and then Length_Of_Name (Variable.Value) /= 0
                      then
-                        Add_To_Carg_Switches
-                          (new String'
-                             ("-gnatec=" & Get_Name_String (Variable.Value)));
+                        declare
+                           Path : constant String :=
+                             Absolute_Path
+                               (Path_Name_Type (Variable.Value), Project);
+                        begin
+                           Add_To_Carg_Switches
+                             (new String'("-gnatec=" & Path));
+                        end;
                      end if;
                   end;
 
@@ -2392,10 +2397,14 @@ begin
                         if Variable /= Nil_Variable_Value
                           and then Length_Of_Name (Variable.Value) /= 0
                         then
-                           Add_To_Carg_Switches
-                             (new String'
-                                ("-gnatec=" &
-                                 Get_Name_String (Variable.Value)));
+                           declare
+                              Path : constant String :=
+                                Absolute_Path
+                                  (Path_Name_Type (Variable.Value), Project);
+                           begin
+                              Add_To_Carg_Switches
+                                (new String'("-gnatec=" & Path));
+                           end;
                         end if;
                      end;
                   end if;
index 69a996d8a14d6e9b8ed3c650f352a2b63a97102d..28674251b1700d3e0d8e125c04972ebc4f41fa6b 100644 (file)
@@ -3790,44 +3790,6 @@ package body Make is
       Result : Argument_List (1 .. 3);
       Last   : Natural := 0;
 
-      function Absolute_Path
-        (Path    : Path_Name_Type;
-         Project : Project_Id) return String;
-      --  Returns an absolute path for a configuration pragmas file
-
-      -------------------
-      -- Absolute_Path --
-      -------------------
-
-      function Absolute_Path
-        (Path    : Path_Name_Type;
-         Project : Project_Id) return String
-      is
-      begin
-         Get_Name_String (Path);
-
-         declare
-            Path_Name : constant String := Name_Buffer (1 .. Name_Len);
-
-         begin
-            if Is_Absolute_Path (Path_Name) then
-               return Path_Name;
-
-            else
-               declare
-                  Parent_Directory : constant String :=
-                                       Get_Name_String
-                                         (Project.Directory.Display_Name);
-
-               begin
-                  return Parent_Directory & Path_Name;
-               end;
-            end if;
-         end;
-      end Absolute_Path;
-
-   --  Start of processing for Configuration_Pragmas_Switch
-
    begin
       Prj.Env.Create_Config_Pragmas_File
         (For_Project, Project_Tree);
index cdbe1aa134c7d6d4cdee5cb579d08d8c78e1b346..a2ea435269dec8f3499e1424f41c9dc23db3948b 100644 (file)
@@ -139,6 +139,37 @@ package body Makeutl is
       end if;
    end Add_Linker_Option;
 
+   -------------------
+   -- Absolute_Path --
+   -------------------
+
+   function Absolute_Path
+     (Path    : Path_Name_Type;
+      Project : Project_Id) return String
+   is
+   begin
+      Get_Name_String (Path);
+
+      declare
+         Path_Name : constant String := Name_Buffer (1 .. Name_Len);
+
+      begin
+         if Is_Absolute_Path (Path_Name) then
+            return Path_Name;
+
+         else
+            declare
+               Parent_Directory : constant String :=
+                 Get_Name_String
+                   (Project.Directory.Display_Name);
+
+            begin
+               return Parent_Directory & Path_Name;
+            end;
+         end if;
+      end;
+   end Absolute_Path;
+
    -------------------------
    -- Base_Name_Index_For --
    -------------------------
index 1b899c1bb45f883a8271407272dc724c6284da04..7848ed093cbc5733dba1689f7aaca3a8f3013ab3 100644 (file)
@@ -87,6 +87,11 @@ package Makeutl is
       Last   : in out Natural);
    --  Add a string to a list of strings
 
+   function Absolute_Path
+     (Path    : Path_Name_Type;
+      Project : Project_Id) return String;
+   --  Returns an absolute path for a configuration pragmas file
+
    function Create_Binder_Mapping_File
      (Project_Tree : Project_Tree_Ref) return Path_Name_Type;
    --  Create a binder mapping file and returns its path name
index d70480e152b921057746d54d2cb3bb44fb4670e3..7ea2dc930947e403ca5cb68c6791fe6c5167d4b1 100644 (file)
@@ -216,6 +216,7 @@ package body Prj.Part is
    procedure Post_Parse_Context_Clause
      (Context_Clause    : With_Id;
       In_Tree           : Project_Node_Tree_Ref;
+      In_Limited        : Boolean;
       Limited_Withs     : Boolean;
       Imported_Projects : in out Project_Node_Id;
       Project_Directory : Path_Name_Type;
@@ -827,6 +828,7 @@ package body Prj.Part is
    procedure Post_Parse_Context_Clause
      (Context_Clause    : With_Id;
       In_Tree           : Project_Node_Tree_Ref;
+      In_Limited        : Boolean;
       Limited_Withs     : Boolean;
       Imported_Projects : in out Project_Node_Id;
       Project_Directory : Path_Name_Type;
@@ -941,7 +943,9 @@ package body Prj.Part is
                   --  If we have one, get the project id of the limited
                   --  imported project file, and do not parse it.
 
-                  if Limited_Withs and then Project_Stack.Last > 1 then
+                  if (In_Limited or else Limited_Withs) and then
+                     Project_Stack.Last > 1
+                  then
                      declare
                         Canonical_Path_Name : Path_Name_Type;
 
@@ -975,7 +979,7 @@ package body Prj.Part is
                         Path_Name_Id      => Imported_Path_Name_Id,
                         Extended          => False,
                         From_Extended     => From_Extended,
-                        In_Limited        => Limited_Withs,
+                        In_Limited        => In_Limited or else Limited_Withs,
                         Packages_To_Check => Packages_To_Check,
                         Depth             => Depth,
                         Current_Dir       => Current_Dir,
@@ -1577,6 +1581,7 @@ package body Prj.Part is
             Post_Parse_Context_Clause
               (In_Tree           => In_Tree,
                Context_Clause    => First_With,
+               In_Limited        => In_Limited,
                Limited_Withs     => False,
                Imported_Projects => Imported_Projects,
                Project_Directory => Project_Directory,
@@ -1936,6 +1941,7 @@ package body Prj.Part is
          Post_Parse_Context_Clause
            (In_Tree           => In_Tree,
             Context_Clause    => First_With,
+            In_Limited        => In_Limited,
             Limited_Withs     => True,
             Imported_Projects => Imported_Projects,
             Project_Directory => Project_Directory,
index f2cb86c12f24506a492e75e95f64e9a2de416a7c..5b1585a39824190d84a4c0b9e83bb5c9fb86153f 100644 (file)
@@ -4053,6 +4053,7 @@ package body Sem_Attr is
             P_Type := Base_Type (P_Type);
             Set_Etype (N, P_Type);
             Set_Etype (P, P_Type);
+            Analyze_Dimension (N);
             Expand (N);
          end if;
       end Old;
index ca7f3b2899f56c24ba760cee1ec86e44995589e6..163c93b789f2939629ae10c2b3aef57d32ea43df 100644 (file)
@@ -1925,12 +1925,18 @@ package body Sem_Dim is
          Set_Dimensions (N, Dims_Of_Etyp);
 
       --  Identifier case. Propagate the dimensions from the entity for
-      --  identifier whose entity is a non-dimensionless consant.
+      --  identifier whose entity is a non-dimensionless constant.
 
-      elsif Nkind (N) = N_Identifier
-        and then Exists (Dimensions_Of (Entity (N)))
-      then
-         Set_Dimensions (N, Dimensions_Of (Entity (N)));
+      elsif Nkind (N) = N_Identifier then
+         Analyze_Dimension_Identifier : declare
+            Id : constant Entity_Id := Entity (N);
+         begin
+            if Ekind (Id) = E_Constant
+              and then Exists (Dimensions_Of (Id))
+            then
+               Set_Dimensions (N, Dimensions_Of (Id));
+            end if;
+         end Analyze_Dimension_Identifier;
 
       --  Attribute reference case. Propagate the dimensions from the prefix.