]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2017-04-25 Ed Schonberg <schonberg@adacore.com>
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 25 Apr 2017 10:33:46 +0000 (10:33 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 25 Apr 2017 10:33:46 +0000 (10:33 +0000)
* sem_prag.adb (Inherits_Class_Wide_Pre): Cleanup code, handle
properly type derived from generic formal types, to handle
properly modified version of ACATS 4.1B B611017.

2017-04-25  Javier Miranda  <miranda@adacore.com>

* exp_unst.adb (Subp_Index): Adding missing
support for renamings and functions that return a constrained
array type (i.e. functions for which the frontend built a
procedure with an extra out parameter).

2017-04-25  Pascal Obry  <obry@adacore.com>

* s-string.adb: Minor code clean-up.

2017-04-25  Bob Duff  <duff@adacore.com>

* s-os_lib.ads, s-os_lib.adb (Non_Blocking_Wait_Process): New
procedure.
* adaint.h, adaint.c (__gnat_portable_no_block_wait): C support
function for Non_Blocking_Wait_Process.

2017-04-25  Bob Duff  <duff@adacore.com>

* prep.adb (Preprocess): Remove incorrect
Assert. Current character can be ASCII.CR.

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

gcc/ada/ChangeLog
gcc/ada/adaint.c
gcc/ada/adaint.h
gcc/ada/exp_unst.adb
gcc/ada/prep.adb
gcc/ada/s-os_lib.adb
gcc/ada/s-os_lib.ads
gcc/ada/s-string.adb
gcc/ada/sem_prag.adb

index 3d5423ca86638b59bfab570289f0436abc5e507d..4ed0c7443b7f0f9124d29e121671a4025eee322b 100644 (file)
@@ -1,3 +1,32 @@
+2017-04-25  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_prag.adb (Inherits_Class_Wide_Pre): Cleanup code, handle
+       properly type derived from generic formal types, to handle
+       properly modified version of ACATS 4.1B B611017.
+
+2017-04-25  Javier Miranda  <miranda@adacore.com>
+
+       * exp_unst.adb (Subp_Index): Adding missing
+       support for renamings and functions that return a constrained
+       array type (i.e. functions for which the frontend built a
+       procedure with an extra out parameter).
+
+2017-04-25  Pascal Obry  <obry@adacore.com>
+
+       * s-string.adb: Minor code clean-up.
+
+2017-04-25  Bob Duff  <duff@adacore.com>
+
+       * s-os_lib.ads, s-os_lib.adb (Non_Blocking_Wait_Process): New
+       procedure.
+       * adaint.h, adaint.c (__gnat_portable_no_block_wait): C support
+       function for Non_Blocking_Wait_Process.
+
+2017-04-25  Bob Duff  <duff@adacore.com>
+
+       * prep.adb (Preprocess): Remove incorrect
+       Assert. Current character can be ASCII.CR.
+
 2017-04-25  Ed Schonberg  <schonberg@adacore.com>
 
        * sem_prag.adb (Set_Convention_From_Pragma): Cleanup code for
index bff875a6822fd7746235fcfac9537ea92facc696..5cc84caedeb396a7351dd84506fbf2464998cef9 100644 (file)
@@ -2315,7 +2315,7 @@ __gnat_dup2 (int oldfd ATTRIBUTE_UNUSED, int newfd ATTRIBUTE_UNUSED)
      RTPs.  */
   return -1;
 #elif defined (__PikeOS__)
-  /* Not supported.  */
+  /* Not supported. */
   return -1;
 #elif defined (_WIN32)
   /* Special case when oldfd and newfd are identical and are the standard
@@ -2679,6 +2679,26 @@ __gnat_portable_wait (int *process_status)
   return pid;
 }
 
+int
+__gnat_portable_no_block_wait (int *process_status)
+{
+  int status = 0;
+  int pid = 0;
+
+#if defined (__vxworks) || defined (__PikeOS__) || defined (_WIN32)
+  /* Not supported. */
+  status = -1;
+
+#else
+
+  pid = waitpid (-1, &status, WNOHANG);
+  status = status & 0xffff;
+#endif
+
+  *process_status = status;
+  return pid;
+}
+
 void
 __gnat_os_exit (int status)
 {
index 232b5eb4371fd51106223b59e605b5068d887286..444e04d753c354a268574b5ab9ca098e72e80014 100644 (file)
@@ -233,6 +233,7 @@ extern int    __gnat_is_symbolic_link                  (char *name);
 extern int    __gnat_portable_spawn                (char *[]);
 extern int    __gnat_portable_no_block_spawn       (char *[]);
 extern int    __gnat_portable_wait                 (int *);
+extern int    __gnat_portable_no_block_wait        (int *);
 extern int    __gnat_current_process_id            (void);
 extern char  *__gnat_locate_exec                   (char *, char *);
 extern char  *__gnat_locate_exec_on_path           (char *);
index a3e433fedb8f4b46ecaad0ae18b47840a555fedb..62d9d339f209fe8fe2ce822d7c2c9e2e7a279b42 100644 (file)
@@ -35,6 +35,7 @@ with Opt;      use Opt;
 with Output;   use Output;
 with Rtsfind;  use Rtsfind;
 with Sem;      use Sem;
+with Sem_Aux;  use Sem_Aux;
 with Sem_Ch8;  use Sem_Ch8;
 with Sem_Mech; use Sem_Mech;
 with Sem_Res;  use Sem_Res;
@@ -176,9 +177,24 @@ package body Exp_Unst is
    ----------------
 
    function Subp_Index (Sub : Entity_Id) return SI_Type is
+      E : Entity_Id := Sub;
+
    begin
-      pragma Assert (Is_Subprogram (Sub));
-      return SI_Type (UI_To_Int (Subps_Index (Sub)));
+      pragma Assert (Is_Subprogram (E));
+
+      if Subps_Index (E) = Uint_0 then
+         E := Ultimate_Alias (E);
+
+         if Ekind (E) = E_Function
+           and then Rewritten_For_C (E)
+           and then Present (Corresponding_Procedure (E))
+         then
+            E := Corresponding_Procedure (E);
+         end if;
+      end if;
+
+      pragma Assert (Subps_Index (E) /= Uint_0);
+      return SI_Type (UI_To_Int (Subps_Index (E)));
    end Subp_Index;
 
    -----------------------
index 02256ec66c0bfd0ceb7ee649ee06ce74a504dec5..ef0712da6ac734f8232f138a78ffadc1ada62692 100644 (file)
@@ -1572,7 +1572,6 @@ package body Prep is
             then
                Start_Of_Processing := Token_Ptr + 2;
             else
-               pragma Assert (Sinput.Source (Token_Ptr) = ASCII.LF);
                Start_Of_Processing := Token_Ptr + 1;
             end if;
          end if;
index 36064e97bd3784bab6a74d15eeece5343c5f3e19..014f6b4d66b78764bb66926375fb564ccf65f771 100644 (file)
@@ -1927,6 +1927,28 @@ package body System.OS_Lib is
       return Result;
    end Non_Blocking_Spawn;
 
+   -------------------------------
+   -- Non_Blocking_Wait_Process --
+   -------------------------------
+
+   procedure Non_Blocking_Wait_Process
+     (Pid : out Process_Id; Success : out Boolean)
+   is
+      Status : Integer;
+
+      function Portable_No_Block_Wait (S : Address) return Process_Id;
+      pragma Import
+        (C, Portable_No_Block_Wait, "__gnat_portable_no_block_wait");
+
+   begin
+      Pid := Portable_No_Block_Wait (Status'Address);
+      Success := (Status = 0);
+
+      if Pid = 0 then
+         Pid := Invalid_Pid;
+      end if;
+   end Non_Blocking_Wait_Process;
+
    -------------------------
    -- Normalize_Arguments --
    -------------------------
index 21f9ec5556ff0839226c21ea240da6a360d08706..31e171b2f702999b2b5fcd2bc2146d86023806b8 100644 (file)
@@ -937,6 +937,12 @@ package System.OS_Lib is
    --  This function will always set success to False under VxWorks, since
    --  there is no notion of executables under this OS.
 
+   procedure Non_Blocking_Wait_Process
+     (Pid : out Process_Id; Success : out Boolean);
+   --  Same as Wait_Process, except if there are no completed child processes,
+   --  return immediately without blocking, and return Invalid_Pid in Pid.
+   --  Not supported on all platforms; Success = False if not supported.
+
    -------------------------------------
    -- NOTE: Spawn in Tasking Programs --
    -------------------------------------
index d6e32fb51574c8cf40c27724822372e18558f743..88439ccf2bcb163b97a1828975290ee17f2a0af8 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1995-2013, Free Software Foundation, Inc.         --
+--          Copyright (C) 1995-2016, 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- --
@@ -38,7 +38,6 @@ package body System.Strings is
    ----------
 
    procedure Free (Arg : in out String_List_Access) is
-      X : String_Access;
 
       procedure Free_Array is new Ada.Unchecked_Deallocation
         (Object => String_List, Name => String_List_Access);
@@ -48,8 +47,7 @@ package body System.Strings is
 
       if Arg /= null then
          for J in Arg'Range loop
-            X := Arg (J);
-            Free (X);
+            Free (Arg (J));
          end loop;
       end if;
 
index 70e20ab875d8a5d3bee57a1c32ed867713bc09f3..7e13f52ab59f03bc8633a89c89c17e2f25382a7f 100644 (file)
@@ -4218,10 +4218,10 @@ package body Sem_Prag is
          -----------------------------
 
          function Inherits_Class_Wide_Pre (E : Entity_Id) return Boolean is
-            Prev : Entity_Id := Overridden_Operation (E);
+            Typ  : constant Entity_Id := Find_Dispatching_Type (E);
+            Prev : Entity_Id          := Overridden_Operation (E);
             Cont : Node_Id;
             Prag : Node_Id;
-            Typ  : Entity_Id;
 
          begin
             --  Check ancestors on the overriding operation to examine the
@@ -4240,14 +4240,21 @@ package body Sem_Prag is
                   end loop;
                end if;
 
-               Prev := Overridden_Operation (Prev);
+               --  For a type derived from a generic formal type, the
+               --  operation inheriting the condition is a renaming, not
+               --  an overriding of the operation of the formal.
+
+               if Is_Generic_Type (Find_Dispatching_Type (Prev)) then
+                  Prev := Alias (Prev);
+               else
+                  Prev := Overridden_Operation (Prev);
+               end if;
             end loop;
 
             --  If the controlling type of the subprogram has progenitors, an
             --  interface operation implemented by the current operation may
             --  have a class-wide precondition.
 
-            Typ := Find_Dispatching_Type (E);
             if Has_Interfaces (Typ) then
                declare
                   Elmt      : Elmt_Id;
@@ -4414,7 +4421,6 @@ package body Sem_Prag is
 
             declare
                E : constant Entity_Id := Defining_Entity (Subp_Decl);
-               H : constant Entity_Id := Homonym (E);
 
             begin
                if Class_Present (N)
@@ -4425,22 +4431,6 @@ package body Sem_Prag is
                   Error_Msg_N
                     ("illegal class-wide precondition on overriding operation",
                      Corresponding_Aspect (N));
-
-               --  If the operation is declared in the private part of an
-               --  instance it may not override any visible operations, but
-               --  still have a parent operation that carries a precondition.
-
-               elsif In_Instance
-                 and then In_Private_Part (Current_Scope)
-                 and then Present (H)
-                 and then Scope (E) = Scope (H)
-                 and then Is_Inherited_Operation (H)
-                 and then Present (Overridden_Operation (H))
-                 and then not Inherits_Class_Wide_Pre (H)
-               then
-                  Error_Msg_N
-                    ("illegal class-wide precondition on overriding "
-                     & "operation in instance", Corresponding_Aspect (N));
                end if;
             end;