[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Mon, 27 Jan 2014 16:43:29 +0000 (17:43 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 27 Jan 2014 16:43:29 +0000 (17:43 +0100)
2014-01-27  Robert Dewar  <dewar@adacore.com>

* exp_smem.adb: Minor reformatting.

2014-01-27  Thomas Quinot  <quinot@adacore.com>

* a-calfor.ads: Fix incorrect reference to operator "-" in comment.

2014-01-27  Ed Schonberg  <schonberg@adacore.com>

* sem_res.adb (Make_Call_Into_Operator): In ASIS mode, relocate
nodes for operands to the original node for the call, to preserve
Original_Node pointers within the resolved operands, given that
they may have been rewritten as well. Previous approach copied
the operands into a new tree and lost those pointers.

2014-01-27  Claire Dross  <dross@adacore.com>

* a-cofove.adb, a-cofove.ads: Add Strict_Equal function to the API.

2014-01-27  Ed Schonberg  <schonberg@adacore.com>

* sem_util.adb (Check_Internal_Protected_Use): A call through
an anonymous access parameter of the current protected function
is not a potential modification of the current object.

2014-01-27  Ed Schonberg  <schonberg@adacore.com>

* a-cobove.adb (Reserve_Capacity): Procedure raises
Capacity_Error, not Constraint_Error, when request cannot be
satisfied.

2014-01-27  Vincent Celier  <celier@adacore.com>

* a-coorma.adb, a-cohama.adb (Assign): Copy the Source to the Target,
not the Target to itself.

2014-01-27  Ed Schonberg  <schonberg@adacore.com>

* exp_ch4.adb (Expand_Concatenate): If the target of the
concatenation is a library-level entity, always use the off-line
version of concatenation, regardless of optimization level. This
is space-efficient, and prevents linking problems when some
units are compiled with different optimization levels.

2014-01-27  Ed Schonberg  <schonberg@adacore.com>

* sem_ch5.adb: Code clean up.

2014-01-27  Ed Schonberg  <schonberg@adacore.com>

* par-ch5.adb (P_Iterator_Specification): Improve error recovery
when an array or container iterator includes a subtype indication,
which is only legal in an element iterator.

From-SVN: r207141

13 files changed:
gcc/ada/ChangeLog
gcc/ada/a-calfor.ads
gcc/ada/a-cobove.adb
gcc/ada/a-cofove.adb
gcc/ada/a-cofove.ads
gcc/ada/a-cohama.adb
gcc/ada/a-coorma.adb
gcc/ada/exp_ch4.adb
gcc/ada/exp_smem.adb
gcc/ada/par-ch5.adb
gcc/ada/sem_ch5.adb
gcc/ada/sem_res.adb
gcc/ada/sem_util.adb

index f50f691737683709cbf027ed3a3b850dae6578d7..fc60f65b09d7ad0d9aa22e2f11643e94e4958734 100644 (file)
@@ -1,3 +1,59 @@
+2014-01-27  Robert Dewar  <dewar@adacore.com>
+
+       * exp_smem.adb: Minor reformatting.
+
+2014-01-27  Thomas Quinot  <quinot@adacore.com>
+
+       * a-calfor.ads: Fix incorrect reference to operator "-" in comment.
+
+2014-01-27  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_res.adb (Make_Call_Into_Operator): In ASIS mode, relocate
+       nodes for operands to the original node for the call, to preserve
+       Original_Node pointers within the resolved operands, given that
+       they may have been rewritten as well. Previous approach copied
+       the operands into a new tree and lost those pointers.
+
+2014-01-27  Claire Dross  <dross@adacore.com>
+
+
+       * a-cofove.adb, a-cofove.ads: Add Strict_Equal function to the API.
+
+2014-01-27  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_util.adb (Check_Internal_Protected_Use): A call through
+       an anonymous access parameter of the current protected function
+       is not a potential modification of the current object.
+
+2014-01-27  Ed Schonberg  <schonberg@adacore.com>
+
+       * a-cobove.adb (Reserve_Capacity): Procedure raises
+       Capacity_Error, not Constraint_Error, when request cannot be
+       satisfied.
+
+2014-01-27  Vincent Celier  <celier@adacore.com>
+
+       * a-coorma.adb, a-cohama.adb (Assign): Copy the Source to the Target,
+       not the Target to itself.
+
+2014-01-27  Ed Schonberg  <schonberg@adacore.com>
+
+       * exp_ch4.adb (Expand_Concatenate): If the target of the
+       concatenation is a library-level entity, always use the off-line
+       version of concatenation, regardless of optimization level. This
+       is space-efficient, and prevents linking problems when some
+       units are compiled with different optimization levels.
+
+2014-01-27  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch5.adb: Code clean up.
+
+2014-01-27  Ed Schonberg  <schonberg@adacore.com>
+
+       * par-ch5.adb (P_Iterator_Specification): Improve error recovery
+       when an array or container iterator includes a subtype indication,
+       which is only legal in an element iterator.
+
 2014-01-27  Thomas Quinot  <quinot@adacore.com>
 
        * exp_ch7.adb: Minor reformatting.
index d5cc934b99ecbeeb48bd3e79ebb8d60f1fd3f2e9..8cfd6a403dce580701884c2090d41888c3946fa3 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---         Copyright (C) 2005-2008, Free Software Foundation, Inc.          --
+--         Copyright (C) 2005-2013, Free Software Foundation, Inc.          --
 --                                                                          --
 -- This specification is derived from the Ada Reference Manual for use with --
 -- GNAT.  In accordance with the copyright of that document, you can freely --
@@ -70,7 +70,7 @@ package Ada.Calendar.Formatting is
       Sub_Second : Second_Duration := 0.0) return Day_Duration;
    --  Returns a Day_Duration value for the combination of the given Hour,
    --  Minute, Second, and Sub_Second. This value can be used in Ada.Calendar.
-   --  Time_Of as well as the argument to Calendar."+" and Calendar."". If
+   --  Time_Of as well as the argument to Calendar."+" and Calendar."-". If
    --  Seconds_Of is called with a Sub_Second value of 1.0, the value returned
    --  is equal to the value of Seconds_Of for the next second with a Sub_
    --  Second value of 0.0.
index bcd6118e607abc9b50b26e8e07f8097c2d0acb14..b2e75b58118e8e2dd22945065f48fe2d33a0ad64 100644 (file)
@@ -2390,7 +2390,7 @@ package body Ada.Containers.Bounded_Vectors is
    is
    begin
       if Capacity > Container.Capacity then
-         raise Constraint_Error with "Capacity is out of range";
+         raise Capacity_Error with "Capacity is out of range";
       end if;
    end Reserve_Capacity;
 
index 240715dca75249e98333f94616075b81ef6810fb..6789f712af8505da6143daa493537eb5aa47dde2 100644 (file)
@@ -1506,6 +1506,19 @@ package body Ada.Containers.Formal_Vectors is
       end;
    end Set_Length;
 
+   ------------------
+   -- Strict_Equal --
+   ------------------
+
+   function Strict_Equal (Left, Right : Vector) return Boolean is
+   begin
+      --  On bounded vectors, cursors are indexes. As a consequence, two
+      --  vectors always have the same cursor at the same position and
+      --  Strict_Equal is simply =
+
+      return Left = Right;
+   end Strict_Equal;
+
    ----------
    -- Swap --
    ----------
index 1f9b94f735364ad77f14f0542f7de4fe3943ce07..2c451fb8ebcdb79be708a2962f820590e9498576 100644 (file)
@@ -45,8 +45,9 @@
 --    which is not possible if cursors encapsulate an access to the underlying
 --    container.
 
---    There are two new functions:
+--    There are three new functions:
 
+--      function Strict_Equal (Left, Right : Vector) return Boolean;
 --      function Left  (Container : Vector; Position : Cursor) return Vector;
 --      function Right (Container : Vector; Position : Cursor) return Vector;
 
@@ -349,6 +350,11 @@ package Ada.Containers.Formal_Vectors is
 
    end Generic_Sorting;
 
+   function Strict_Equal (Left, Right : Vector) return Boolean;
+   --  Strict_Equal returns True if the containers are physically equal, i.e.
+   --  they are structurally equal (function "=" returns True) and that they
+   --  have the same set of cursors.
+
    function Left (Container : Vector; Position : Cursor) return Vector with
      Pre => Has_Element (Container, Position) or else Position = No_Element;
    function Right (Container : Vector; Position : Cursor) return Vector with
index 6af16eec227645e561b0fdf57a9c0c5a9560efb6..0616f4373ba3df5bc67b5b84117626d094a7f71f 100644 (file)
@@ -167,7 +167,7 @@ package body Ada.Containers.Hashed_Maps is
          Target.Reserve_Capacity (Source.Length);
       end if;
 
-      Insert_Items (Target.HT);
+      Insert_Items (Source.HT);
    end Assign;
 
    --------------
index 52025bb5c2c0eac8d4dda2643b8e1adbf8f57570..e451ec628ffac7e670d692093f6350fe3cedab74 100644 (file)
@@ -274,7 +274,7 @@ package body Ada.Containers.Ordered_Maps is
       end if;
 
       Target.Clear;
-      Insert_Items (Target.Tree);
+      Insert_Items (Source.Tree);
    end Assign;
 
    -------------
index 97368c09acc56860f5dbcdb8bd121bb571621fc4..d0288b2dd2042289c8c3c54069b8072aa4d6efc6 100644 (file)
@@ -3043,6 +3043,16 @@ package body Exp_Ch4 is
 
       --  Local Declarations
 
+      Lib_Level_Target : constant Boolean :=
+        Nkind (Parent (Cnode)) = N_Object_Declaration
+          and then
+            Is_Library_Level_Entity (Defining_Identifier (Parent (Cnode)));
+
+      --  If the concatenation declares a library level entity, we call the
+      --  built-in concatenation routines to prevent code bloat, regardless
+      --  of optimization level. This is space-efficient, and prevent linking
+      --  problems when units are compiled with different optimizations.
+
       Opnd_Typ : Entity_Id;
       Ent      : Entity_Id;
       Len      : Uint;
@@ -3571,8 +3581,10 @@ package body Exp_Ch4 is
 
       if Atyp = Standard_String
         and then NN in 2 .. 9
-        and then (Opt.Optimization_Level = 0 or else Debug_Flag_Dot_CC)
-        and then not Debug_Flag_Dot_C
+        and then (Lib_Level_Target
+          or else
+            ((Opt.Optimization_Level = 0 or else Debug_Flag_Dot_CC)
+               and then not Debug_Flag_Dot_C))
       then
          declare
             RR : constant array (Nat range 2 .. 9) of RE_Id :=
index 7fb40c44aae1a554b7cd5a9d7bcf9c017b59ca22..8ee67027421d84622b0e01c6905ef6e97f521d55 100644 (file)
@@ -195,7 +195,7 @@ package body Exp_Smem is
    procedure Add_Write_After (N : Node_Id) is
       Loc : constant Source_Ptr := Sloc (N);
       Ent : constant Entity_Id  := Entity (N);
-      Par : constant Node_Id := Insert_Node;
+      Par : constant Node_Id    := Insert_Node;
    begin
       if Present (Shared_Var_Procs_Instance (Ent)) then
          if Nkind (Insert_Node) = N_Function_Call then
index 8992f15a5a76d40dfa8653c2fa9199d1e55abcab..bf28e23bb9d81d76129de10a3dc68c93bfba74bc 100644 (file)
@@ -1736,6 +1736,19 @@ package body Ch5 is
       elsif Token = Tok_In then
          Scan;  --  past IN
 
+      elsif Prev_Token = Tok_In
+        and then Present (Subtype_Indication (Node1))
+      then
+
+         --  Simplest recovery is to transform it into an element iterator.
+         --  Error message on 'in" has already been emitted when parsing the
+         --  optional constraint.
+
+         Set_Of_Present (Node1);
+         Error_Msg_N
+           ("subtype indication is only legal on on element iterator",
+              Subtype_Indication (Node1));
+
       else
          return Error;
       end if;
index 581edf413835c04894b86493abb12b80e82ea35e..590d8ab178803f8a6a6b01da624e0404b20c6ea9 100644 (file)
@@ -1814,7 +1814,7 @@ package body Sem_Ch5 is
             Set_Etype (Def_Id, Component_Type (Typ));
 
             if Present (Subt)
-              and then Bas /= Base_Type (Component_Type (Typ))
+              and then Base_Type (Bas) /= Base_Type (Component_Type (Typ))
             then
                Error_Msg_N
                  ("subtype indication does not match component type", Subt);
index 59986f521af7743d256cd6c4e53923e908708947..7e2e55cff7414e7489820b5e1344e3092ba2221a 100644 (file)
@@ -1585,17 +1585,20 @@ package body Sem_Res is
 
       --  If in ASIS_Mode, propagate operand types to original actuals of
       --  function call, which would otherwise not be fully resolved. If
-      --  the call has already been constant-folded, nothing to do.
+      --  the call has already been constant-folded, nothing to do. We
+      --  relocate the operand nodes rather than copy them, to preserve
+      --  original_node pointers, given that the operands themselves may
+      --  have been rewritten.
 
       if ASIS_Mode and then Nkind (N) in N_Op then
          if Is_Binary then
             Rewrite (First (Parameter_Associations (Original_Node (N))),
-               New_Copy_Tree (Left_Opnd (N)));
+               Relocate_Node (Left_Opnd (N)));
             Rewrite (Next (First (Parameter_Associations (Original_Node (N)))),
-               New_Copy_Tree (Right_Opnd (N)));
+               Relocate_Node (Right_Opnd (N)));
          else
             Rewrite (First (Parameter_Associations (Original_Node (N))),
-               New_Copy_Tree (Right_Opnd (N)));
+               Relocate_Node (Right_Opnd (N)));
          end if;
 
          Set_Parent (Original_Node (N), Parent (N));
index d41eb3a75a519fd2496ac36474ae1bb00876a450..284872bfc538d3094187650b9e9b175c418fbbf1 100644 (file)
@@ -2240,7 +2240,19 @@ package body Sem_Util is
       end loop;
 
       if Scope (Nam) = Prot and then Ekind (Nam) /= E_Function then
-         if Nkind (N) = N_Subprogram_Renaming_Declaration then
+
+         --  An indirect function call (e.g. a callback within a protected
+         --  function body) is not statically illegal. If the access type is
+         --  anonymous and is the type of an access parameter, the scope of Nam
+         --  will be the protected type, but it is not a protected operation.
+
+         if Ekind (Nam) = E_Subprogram_Type
+           and then
+             Nkind (Associated_Node_For_Itype (Nam)) = N_Function_Specification
+         then
+            null;
+
+         elsif Nkind (N) = N_Subprogram_Renaming_Declaration then
             Error_Msg_N
               ("within protected function cannot use protected "
                & "procedure in renaming or as generic actual", N);