]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2014-07-18 Ed Schonberg <schonberg@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 18 Jul 2014 09:29:54 +0000 (09:29 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 18 Jul 2014 09:29:54 +0000 (09:29 +0000)
* sem_ch4.adb (Try_Container_Indexing): Refine previous patch for
indexing over containers that are derived types: check whether
signature of found operation has the correct first parameter
before retrieving directly a primitive operation.

2014-07-18  Ed Schonberg  <schonberg@adacore.com>

* sem_attr.adb (Analyze_Attribute, case 'Update): Set
Do_Range_Check flag on dynamic bounds of a range used in a
component association in the argument of Update.

2014-07-18  Thomas Quinot  <quinot@adacore.com>

* adaint.c: #define _REENTRANT and _THREAD_SAFE in order for
accesses to errno(3) to be thread safe.

2014-07-18  Vincent Celier  <celier@adacore.com>

* prj-tree.adb (Imported_Or_Extended_Project_Of): For each non
limited imported project that is an extending project, return
a project being extended if it has the expected name.

2014-07-18  Pascal Obry  <obry@adacore.com>

* s-os_lib.ads, s-os_lib.adb (Set_File_Last_Modify_Time_Stamp): New
routine to set the last modification time stamp for the given file.
* gnatchop.adb (File_Time_Stamp): Removed.
(Write_Unit): Use
Set_File_Last_Modify_Time_Stamp instead of ad-hoc implementation.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212787 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/adaint.c
gcc/ada/gnatchop.adb
gcc/ada/prj-tree.adb
gcc/ada/s-os_lib.adb
gcc/ada/s-os_lib.ads
gcc/ada/sem_attr.adb
gcc/ada/sem_ch4.adb

index cb343c818a52d5148735896305fe46807dbc2d1a..7321d41992ec022d88ea7a68bcd7e39db73c4b2a 100644 (file)
@@ -1,3 +1,35 @@
+2014-07-18  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch4.adb (Try_Container_Indexing): Refine previous patch for
+       indexing over containers that are derived types: check whether
+       signature of found operation has the correct first parameter
+       before retrieving directly a primitive operation.
+
+2014-07-18  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_attr.adb (Analyze_Attribute, case 'Update): Set
+       Do_Range_Check flag on dynamic bounds of a range used in a
+       component association in the argument of Update.
+
+2014-07-18  Thomas Quinot  <quinot@adacore.com>
+
+       * adaint.c: #define _REENTRANT and _THREAD_SAFE in order for
+       accesses to errno(3) to be thread safe.
+
+2014-07-18  Vincent Celier  <celier@adacore.com>
+
+       * prj-tree.adb (Imported_Or_Extended_Project_Of): For each non
+       limited imported project that is an extending project, return
+       a project being extended if it has the expected name.
+
+2014-07-18  Pascal Obry  <obry@adacore.com>
+
+       * s-os_lib.ads, s-os_lib.adb (Set_File_Last_Modify_Time_Stamp): New
+       routine to set the last modification time stamp for the given file.
+       * gnatchop.adb (File_Time_Stamp): Removed.
+       (Write_Unit): Use
+       Set_File_Last_Modify_Time_Stamp instead of ad-hoc implementation.
+
 2014-07-18  Ed Schonberg  <schonberg@adacore.com>
 
        * sem_aggr.adb (Aggregate_Constraint_Checks): Moved to sem_util.
index a3829f7be1f1ca760574e0d1755d3c8881fd1ba2..607ba8257295a06fc1f1f8ef26529d108e450563 100644 (file)
    package Osint.  Many of the subprograms in OS_Lib import standard
    library calls directly. This file contains all other routines.  */
 
+/* Ensure accesses to errno are thread safe.  */
+#define _REENTRANT
+#define _THREAD_SAFE
+
 #ifdef __vxworks
 
 /* No need to redefine exit here.  */
index 3d953a2ec3db00dbacc7539cfef2e4600c646bbf..d51e83adf5c1ee9f5d452ea921a2a18a9de590d8 100644 (file)
@@ -209,10 +209,6 @@ procedure Gnatchop is
    procedure Error_Msg (Message : String; Warning : Boolean := False);
    --  Produce an error message on standard error output
 
-   procedure File_Time_Stamp (Name : C_File_Name; Time : OS_Time);
-   --  Given the name of a file or directory, Name, set the
-   --  time stamp. This function must be used for an unopened file.
-
    function Files_Exist return Boolean;
    --  Check Unit.Table for possible file names that already exist
    --  in the file system. Returns true if files exist, False otherwise
@@ -372,18 +368,6 @@ procedure Gnatchop is
       end if;
    end Error_Msg;
 
-   ---------------------
-   -- File_Time_Stamp --
-   ---------------------
-
-   procedure File_Time_Stamp (Name : C_File_Name; Time : OS_Time) is
-      procedure Set_File_Time (Name : C_File_Name; Time : OS_Time);
-      pragma Import (C, Set_File_Time, "__gnat_set_file_time_name");
-
-   begin
-      Set_File_Time (Name, Time);
-   end File_Time_Stamp;
-
    -----------------
    -- Files_Exist --
    -----------------
@@ -1708,7 +1692,6 @@ procedure Gnatchop is
 
       declare
          E_Name      : constant String := OS_Name (1 .. O_Length);
-         C_Name      : aliased constant String := E_Name & ASCII.NUL;
          OS_Encoding : constant String := Encoding (1 .. E_Length);
          File        : Stream_IO.File_Type;
 
@@ -1776,7 +1759,7 @@ procedure Gnatchop is
          Stream_IO.Close (File);
 
          if Preserve_Mode then
-            File_Time_Stamp (C_Name'Address, TS_Time);
+            Set_File_Last_Modify_Time_Stamp (E_Name, TS_Time);
          end if;
       end;
    end Write_Unit;
index 37ec38fe7b85d3ef11887650805c06e145745094..e4a23602e20f7a1a1b506254b4c52e3e21456c05 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2001-2013, Free Software Foundation, Inc.         --
+--          Copyright (C) 2001-2014, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -1134,8 +1134,17 @@ package body Prj.Tree is
          --  of variable or attributes.
 
          Result := Non_Limited_Project_Node_Of (With_Clause, In_Tree);
-         exit when Present (Result)
-           and then Name_Of (Result, In_Tree) = With_Name;
+
+         while Present (Result) loop
+            if Name_Of (Result, In_Tree) = With_Name then
+               return Result;
+            end if;
+
+            Result :=
+              Extended_Project_Of
+                (Project_Declaration_Of (Result, In_Tree), In_Tree);
+         end loop;
+
          With_Clause := Next_With_Clause_Of (With_Clause, In_Tree);
       end loop;
 
index 6669b42f0cc5a2a3a704c2da4e141f11bd66b490..17ac32e3bdb9f3c6c31485eca8e87ac6b87e4240 100644 (file)
@@ -2385,6 +2385,20 @@ package body System.OS_Lib is
       C_Set_Executable (C_Name (C_Name'First)'Address, Mode);
    end Set_Executable;
 
+   -------------------------------------
+   -- Set_File_Last_Modify_Time_Stamp --
+   -------------------------------------
+
+   procedure Set_File_Last_Modify_Time_Stamp (Name : String; Time : OS_Time) is
+      procedure C_Set_File_Time (Name : C_File_Name; Time : OS_Time);
+      pragma Import (C, C_Set_File_Time, "__gnat_set_file_time_name");
+      C_Name : aliased String (Name'First .. Name'Last + 1);
+   begin
+      C_Name (Name'Range)  := Name;
+      C_Name (C_Name'Last) := ASCII.NUL;
+      C_Set_File_Time (C_Name'Address, Time);
+   end Set_File_Last_Modify_Time_Stamp;
+
    ----------------------
    -- Set_Non_Readable --
    ----------------------
index 014f114bc720065d8dd7ff94394ff6a3ef57143f..9552d8626fd5421785557537653358cbd0ae7ee4 100644 (file)
@@ -384,6 +384,10 @@ package System.OS_Lib is
    --  Note: this procedure is not supported on VMS and VxWorks 5. On these
    --  platforms, Success is always set to False.
 
+   procedure Set_File_Last_Modify_Time_Stamp (Name : String; Time : OS_Time);
+   --  Given the name of a file or directory, Name, set the last modification
+   --  time stamp. This function must be used for an unopened file.
+
    function Read
      (FD : File_Descriptor;
       A  : System.Address;
index 5326490da6c992591cc75d8042230018cb0f8f91..e65fecd339e39df5c5380339b553b44cf529f9de 100644 (file)
@@ -6314,6 +6314,7 @@ package body Sem_Attr is
                   declare
                      Index      : Node_Id;
                      Index_Type : Entity_Id;
+                     Lo, Hi     : Node_Id;
 
                   begin
                      if Nkind (First (Choices (Assoc))) /= N_Aggregate then
@@ -6331,11 +6332,18 @@ package body Sem_Attr is
                         Index := First (Choices (Assoc));
                         while Present (Index) loop
                            if Nkind (Index) = N_Range then
-                              Analyze_And_Resolve
-                                (Low_Bound (Index), Etype (Index_Type));
-                              Analyze_And_Resolve
-                                (High_Bound (Index), Etype (Index_Type));
-                              Set_Etype (Index, Etype (Index_Type));
+                              Lo := Low_Bound  (Index);
+                              Hi := High_Bound (Index);
+
+                              Analyze_And_Resolve (Lo, Etype (Index_Type));
+                              if not Is_OK_Static_Expression (Lo) then
+                                 Set_Do_Range_Check (Lo);
+                              end if;
+
+                              Analyze_And_Resolve (Hi, Etype (Index_Type));
+                              if not Is_OK_Static_Expression (Hi) then
+                                 Set_Do_Range_Check (Hi);
+                              end if;
 
                            else
                               Analyze_And_Resolve (Index, Etype (Index_Type));
index 6d0db7d63f7bd3921e65aad8f461eb68f975e20d..ab7a10de09e16423bbb9f5a355a8fdb360b2e428 100644 (file)
@@ -7021,13 +7021,24 @@ package body Sem_Ch4 is
             return False;
          end if;
 
-      --  If the container type is a derived type, the value of the inherited
-      --  aspect is the Reference operation declared for the parent type.
+      --  If the container type is derived from another container type, the
+      --  value of the inherited aspect is the Reference operation declared
+      --  for the parent type.
+
       --  However, Reference is also a primitive operation of the type, and
       --  the inherited operation has a different signature. We retrieve the
       --  right one from the list of primitive operations of the derived type.
 
-      elsif Is_Derived_Type (Etype (Prefix)) then
+      --  Note that predefined containers are typically all derived from one
+      --  of the Controlled types. The code below is motivated by containers
+      --  that are derived from other types with a Reference aspect.
+
+      --  Additional machinery may be needed for types that have several user-
+      --  defined Reference operations with different signatures ???
+
+      elsif Is_Derived_Type (Etype (Prefix))
+        and then Etype (First_Formal (Entity (Func_Name))) /= Etype (Prefix)
+      then
          Func := Find_Prim_Op (Etype (Prefix), Chars (Func_Name));
          Func_Name := New_Occurrence_Of (Func, Loc);
       end if;