]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2017-09-25 Yannick Moy <moy@adacore.com>
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 25 Sep 2017 09:51:49 +0000 (09:51 +0000)
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 25 Sep 2017 09:51:49 +0000 (09:51 +0000)
* exp_spark.adb (Expand_SPARK_Indexed_Component,
Expand_SPARK_Selected_Component): New procedures to insert explicit
dereference if required.
(Expand_SPARK): Call the new procedures.

2017-09-25  Patrick Bernardi  <bernardi@adacore.com>

* libgnat/a-stwiun.adb, libgnat/s-stchop__vxworks.adb,
libgnat/g-socthi__vxworks.ads, libgnat/a-stzunb.adb,
libgnat/a-strunb.adb, libgnarl/s-osinte__lynxos178.adb,
libgnarl/s-intman__vxworks.adb, libgnarl/s-osinte__darwin.adb,
libgnarl/a-exetim__darwin.adb: Removed ineffective use-clauses.

2017-09-25  Vasiliy Fofanov  <fofanov@adacore.com>

* adaint.c (win32_wait): Properly handle error and take into account
the WIN32 limitation on the number of simultaneous wait objects.

2017-09-25  Yannick Moy  <moy@adacore.com>

* sem_ch3.adb (Constant_Redeclaration): Do not insert a call to the
invariant procedure in GNATprove mode.
* sem_ch5.adb (Analyze_Assignment): Likewise.

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

14 files changed:
gcc/ada/ChangeLog
gcc/ada/adaint.c
gcc/ada/exp_spark.adb
gcc/ada/libgnarl/a-exetim__darwin.adb
gcc/ada/libgnarl/s-intman__vxworks.adb
gcc/ada/libgnarl/s-osinte__darwin.adb
gcc/ada/libgnarl/s-osinte__lynxos178.adb
gcc/ada/libgnat/a-strunb.adb
gcc/ada/libgnat/a-stwiun.adb
gcc/ada/libgnat/a-stzunb.adb
gcc/ada/libgnat/g-socthi__vxworks.ads
gcc/ada/libgnat/s-stchop__vxworks.adb
gcc/ada/sem_ch3.adb
gcc/ada/sem_ch5.adb

index 979748ed75d14b2a453a18593df821ef902be253..28fa8f18e3052c155fe3a086ceafff0a4fec626c 100644 (file)
@@ -1,3 +1,29 @@
+2017-09-25  Yannick Moy  <moy@adacore.com>
+
+       * exp_spark.adb (Expand_SPARK_Indexed_Component,
+       Expand_SPARK_Selected_Component): New procedures to insert explicit
+       dereference if required.
+       (Expand_SPARK): Call the new procedures.
+
+2017-09-25  Patrick Bernardi  <bernardi@adacore.com>
+
+       * libgnat/a-stwiun.adb, libgnat/s-stchop__vxworks.adb,
+       libgnat/g-socthi__vxworks.ads, libgnat/a-stzunb.adb,
+       libgnat/a-strunb.adb, libgnarl/s-osinte__lynxos178.adb,
+       libgnarl/s-intman__vxworks.adb, libgnarl/s-osinte__darwin.adb,
+       libgnarl/a-exetim__darwin.adb: Removed ineffective use-clauses.
+
+2017-09-25  Vasiliy Fofanov  <fofanov@adacore.com>
+
+       * adaint.c (win32_wait): Properly handle error and take into account
+       the WIN32 limitation on the number of simultaneous wait objects.
+
+2017-09-25  Yannick Moy  <moy@adacore.com>
+
+       * sem_ch3.adb (Constant_Redeclaration): Do not insert a call to the
+       invariant procedure in GNATprove mode.
+       * sem_ch5.adb (Analyze_Assignment): Likewise.
+
 2017-09-25  Piotr Trojanek  <trojanek@adacore.com>
 
        * adabkend.adb (Call_Back_End): Fix wording of "front-end" and
index b1da3e25dd22c03fe7ec1dd9a1a0afefa69bcc6c..10325b0f1d05418c3485eb5409752743dd0a4c34 100644 (file)
@@ -2551,6 +2551,7 @@ win32_wait (int *status)
   DWORD res;
   int hl_len;
   int found;
+  int pos;
 
  START_WAIT:
 
@@ -2563,7 +2564,15 @@ win32_wait (int *status)
   /* -------------------- critical section -------------------- */
   EnterCS();
 
+  /* ??? We can't wait for more than MAXIMUM_WAIT_OBJECTS due to a Win32
+     limitation */
+  if (plist_length < MAXIMUM_WAIT_OBJECTS)
   hl_len = plist_length;
+  else
+    {
+      errno = EINVAL;
+      return -1;
+    }
 
 #ifdef CERT
   hl = (HANDLE *) xmalloc (sizeof (HANDLE) * hl_len);
@@ -2586,6 +2595,13 @@ win32_wait (int *status)
 
   res = WaitForMultipleObjects (hl_len, hl, FALSE, INFINITE);
 
+  /* If there was an error, exit now */
+  if (res == WAIT_FAILED)
+    {
+      errno = EINVAL;
+      return -1;
+    }
+
   /* if the ProcListEvt has been signaled then the list of processes has been
      updated to add or remove a handle, just loop over */
 
@@ -2596,9 +2612,17 @@ win32_wait (int *status)
       goto START_WAIT;
     }
 
-  h = hl[res - WAIT_OBJECT_0];
+  /* Handle two distinct groups of return codes: finished waits and abandoned
+     waits */
+
+  if (res < WAIT_ABANDONED_0)
+    pos = res - WAIT_OBJECT_0;
+  else
+    pos = res - WAIT_ABANDONED_0;
+
+  h = hl[pos];
   GetExitCodeProcess (h, &exitcode);
-  pid = pidl [res - WAIT_OBJECT_0];
+  pid = pidl [pos];
 
   found = __gnat_win32_remove_handle (h, -1);
 
index d4b9436959fae1c50524d30055f1ce835ca96211..811033e9d5bb992c5b92a3f7b2f9c2824ab5ad05 100644 (file)
@@ -58,6 +58,9 @@ package body Exp_SPARK is
    procedure Expand_SPARK_Freeze_Type (E : Entity_Id);
    --  Build the DIC procedure of a type when needed, if not already done
 
+   procedure Expand_SPARK_Indexed_Component (N : Node_Id);
+   --  Insert explicit dereference if required
+
    procedure Expand_SPARK_N_Object_Declaration (N : Node_Id);
    --  Perform object-declaration-specific expansion
 
@@ -67,6 +70,9 @@ package body Exp_SPARK is
    procedure Expand_SPARK_Op_Ne (N : Node_Id);
    --  Rewrite operator /= based on operator = when defined explicitly
 
+   procedure Expand_SPARK_Selected_Component (N : Node_Id);
+   --  Insert explicit dereference if required
+
    ------------------
    -- Expand_SPARK --
    ------------------
@@ -138,6 +144,12 @@ package body Exp_SPARK is
                Expand_SPARK_Freeze_Type (Entity (N));
             end if;
 
+         when N_Indexed_Component =>
+            Expand_SPARK_Indexed_Component (N);
+
+         when N_Selected_Component =>
+            Expand_SPARK_Selected_Component (N);
+
          --  In SPARK mode, no other constructs require expansion
 
          when others =>
@@ -264,6 +276,20 @@ package body Exp_SPARK is
       end if;
    end Expand_SPARK_Freeze_Type;
 
+   ------------------------------------
+   -- Expand_SPARK_Indexed_Component --
+   ------------------------------------
+
+   procedure Expand_SPARK_Indexed_Component (N : Node_Id) is
+      P   : constant Node_Id    := Prefix (N);
+      T   : constant Entity_Id  := Etype (P);
+   begin
+      if Is_Access_Type (T) then
+         Insert_Explicit_Dereference (P);
+         Analyze_And_Resolve (P, Designated_Type (T));
+      end if;
+   end Expand_SPARK_Indexed_Component;
+
    ---------------------------------------
    -- Expand_SPARK_N_Object_Declaration --
    ---------------------------------------
@@ -445,4 +471,31 @@ package body Exp_SPARK is
       end if;
    end Expand_SPARK_Potential_Renaming;
 
+   -------------------------------------
+   -- Expand_SPARK_Selected_Component --
+   -------------------------------------
+
+   procedure Expand_SPARK_Selected_Component (N : Node_Id) is
+      P    : constant Node_Id   := Prefix (N);
+      Ptyp : constant Entity_Id := Underlying_Type (Etype (P));
+   begin
+      if Present (Ptyp)
+        and then Is_Access_Type (Ptyp)
+      then
+         --  First set prefix type to proper access type, in case it currently
+         --  has a private (non-access) view of this type.
+
+         Set_Etype (P, Ptyp);
+
+         Insert_Explicit_Dereference (P);
+         Analyze_And_Resolve (P, Designated_Type (Ptyp));
+
+         if Ekind (Etype (P)) = E_Private_Subtype
+           and then Is_For_Access_Subtype (Etype (P))
+         then
+            Set_Etype (P, Base_Type (Etype (P)));
+         end if;
+      end if;
+   end Expand_SPARK_Selected_Component;
+
 end Exp_SPARK;
index a417d9127288e0fc54ff2011dc18dc08f3ef1634..cb3a55adf0c84daba31ea7ddf465021301ff8f79 100644 (file)
@@ -189,7 +189,6 @@ package body Ada.Execution_Time is
       SC : out Ada.Real_Time.Seconds_Count;
       TS : out Ada.Real_Time.Time_Span)
    is
-      use type Ada.Real_Time.Time;
    begin
       Ada.Real_Time.Split (Ada.Real_Time.Time (T), SC, TS);
    end Split;
index 67f7db36a0dd30bcd490fcc7a8c993310b4d0d00..62f9711bb643f92549191941ea8283ee43c81d03 100644 (file)
@@ -37,7 +37,6 @@
 package body System.Interrupt_Management is
 
    use System.OS_Interface;
-   use type Interfaces.C.int;
 
    -----------------------
    -- Local Subprograms --
index dcac8c095b89af03ed10c439f1573fc8d60b9afe..880c9b4fd6241e661603a51a689cd863364e31c5 100644 (file)
@@ -39,7 +39,6 @@ with Interfaces.C.Extensions;
 
 package body System.OS_Interface is
    use Interfaces.C;
-   use Interfaces.C.Extensions;
 
    -----------------
    -- To_Duration --
index 50e93538af08495411cab2d452bd052772b618c2..a6dc986750d993639dc2e6aa472c2a24d05e11df 100644 (file)
@@ -37,8 +37,6 @@ pragma Polling (Off);
 
 package body System.OS_Interface is
 
-   use Interfaces.C;
-
    ------------------
    --  Current_CPU --
    ------------------
index 808e26ad29fbdb39c3dc2da0fd3fe4edd81e6f11..0366806ed99e90e797cefd203f104d7c0ebc1778 100644 (file)
@@ -35,8 +35,6 @@ with Ada.Unchecked_Deallocation;
 
 package body Ada.Strings.Unbounded is
 
-   use Ada.Finalization;
-
    ---------
    -- "&" --
    ---------
index 85bc494ff9c01b2038a0ccf1fbd0f1070ad5ed32..2449822b0311c8e4f623d6519df312a874924497 100644 (file)
@@ -35,8 +35,6 @@ with Ada.Unchecked_Deallocation;
 
 package body Ada.Strings.Wide_Unbounded is
 
-   use Ada.Finalization;
-
    ---------
    -- "&" --
    ---------
index 25c3b29ac2e232f90ce46a0043853a303915c6f4..2492fecee4fa0c21aa7af806c300803047851bbf 100644 (file)
@@ -35,8 +35,6 @@ with Ada.Unchecked_Deallocation;
 
 package body Ada.Strings.Wide_Wide_Unbounded is
 
-   use Ada.Finalization;
-
    ---------
    -- "&" --
    ---------
index 9cb4018afcbd5859b6bfb20f841d951399591d30..ac8eddfa26deea6354d6356a472127e79105ed36 100644 (file)
@@ -49,8 +49,6 @@ package GNAT.Sockets.Thin is
 
    package C renames Interfaces.C;
 
-   use type System.CRTL.ssize_t;
-
    function Socket_Errno return Integer renames GNAT.OS_Lib.Errno;
    --  Returns last socket error number
 
index 25b07db7a4e4f27bfcf599ab5e7a8fbd242a92cc..99e0288d5488317b4c125028ca8566043ccf7d30 100644 (file)
@@ -103,8 +103,6 @@ package body System.Stack_Checking.Operations is
    --------------------------------------
 
    procedure Set_Stack_Limit_For_Current_Task is
-      use Interfaces.C;
-
       type OS_Stack_Info is record
          Size  : Interfaces.C.int;
          Base  : System.Address;
index 2d9cacaebf068bfa40e2e9e1c57d64005144adc0..7e451fed0db133786b55d184034d790f21b6e018 100644 (file)
@@ -12755,9 +12755,13 @@ package body Sem_Ch3 is
          end if;
 
          --  A deferred constant is a visible entity. If type has invariants,
-         --  verify that the initial value satisfies them.
+         --  verify that the initial value satisfies them. This is not done in
+         --  GNATprove mode, as GNATprove handles invariant checks itself.
 
-         if Has_Invariants (T) and then Present (Invariant_Procedure (T)) then
+         if Has_Invariants (T)
+           and then Present (Invariant_Procedure (T))
+           and then not GNATprove_Mode
+         then
             Insert_After (N,
               Make_Invariant_Call (New_Occurrence_Of (Prev, Sloc (N))));
          end if;
index e72dc4bf7c2295b5fa817e30c2704b534a72283a..d33d59ab8c0b650ccc740925dcaea990693c6558 100644 (file)
@@ -839,14 +839,16 @@ package body Sem_Ch5 is
          Set_Referenced_Modified (Lhs, Out_Param => False);
       end if;
 
-      --  RM 7.3.2 (12/3): An assignment to a view conversion (from a type
-      --  to one of its ancestors) requires an invariant check. Apply check
-      --  only if expression comes from source, otherwise it will be applied
-      --  when value is assigned to source entity.
+      --  RM 7.3.2 (12/3): An assignment to a view conversion (from a type to
+      --  one of its ancestors) requires an invariant check. Apply check only
+      --  if expression comes from source, otherwise it will be applied when
+      --  value is assigned to source entity. This is not done in GNATprove
+      --  mode, as GNATprove handles invariant checks itself.
 
       if Nkind (Lhs) = N_Type_Conversion
         and then Has_Invariants (Etype (Expression (Lhs)))
         and then Comes_From_Source (Expression (Lhs))
+        and then not GNATprove_Mode
       then
          Insert_After (N, Make_Invariant_Call (Expression (Lhs)));
       end if;