]> gcc.gnu.org Git - gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Tue, 22 Jun 2010 08:49:11 +0000 (10:49 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 22 Jun 2010 08:49:11 +0000 (10:49 +0200)
2010-06-22  Robert Dewar  <dewar@adacore.com>

* sem_ch4.adb (Analyze_Conditional_Expression): Defend against
malformed tree.
* sprint.adb (Sprint_Node_Actual, case N_Conditional_Expression): Ditto.

2010-06-22  Arnaud Charlet  <charlet@adacore.com>

* s-intman-vxworks.ads: Code clean up.

2010-06-22  Thomas Quinot  <quinot@adacore.com>

* sem_res.adb (Resolve_Slice): When the prefix is an explicit
dereference, construct actual subtype of designated object to generate
proper bounds checks.

2010-06-22  Thomas Quinot  <quinot@adacore.com>

* ali-util.adb, ali-util.ads, gnatbind.adb (Read_ALI): Rename to
Read_Withed_ALIs, which is more descriptive.

2010-06-22  Pascal Obry  <obry@adacore.com>

* g-sothco.ads: Minor reformatting.
* g-socthi-mingw.adb: Remove part of work on the C_Recvmsg and
C_Sendmsg implementation.
(C_Sendmsg): Do not use lock (not needed).
(C_Recvmsg): Likewise and also do not wait for incoming data.

From-SVN: r161148

gcc/ada/ChangeLog
gcc/ada/ali-util.adb
gcc/ada/ali-util.ads
gcc/ada/g-socthi-mingw.adb
gcc/ada/g-sothco.ads
gcc/ada/gnatbind.adb
gcc/ada/s-intman-vxworks.ads
gcc/ada/sem_ch4.adb
gcc/ada/sem_res.adb
gcc/ada/sprint.adb

index c33f44cf52e2345070be5468517223faf335509b..01b0076807bd8e7b74d8889cc53880bed895b1fc 100644 (file)
@@ -1,3 +1,32 @@
+2010-06-22  Robert Dewar  <dewar@adacore.com>
+
+       * sem_ch4.adb (Analyze_Conditional_Expression): Defend against
+       malformed tree.
+       * sprint.adb (Sprint_Node_Actual, case N_Conditional_Expression): Ditto.
+
+2010-06-22  Arnaud Charlet  <charlet@adacore.com>
+
+       * s-intman-vxworks.ads: Code clean up.
+
+2010-06-22  Thomas Quinot  <quinot@adacore.com>
+
+       * sem_res.adb (Resolve_Slice): When the prefix is an explicit
+       dereference, construct actual subtype of designated object to generate
+       proper bounds checks.
+
+2010-06-22  Thomas Quinot  <quinot@adacore.com>
+
+       * ali-util.adb, ali-util.ads, gnatbind.adb (Read_ALI): Rename to
+       Read_Withed_ALIs, which is more descriptive.
+
+2010-06-22  Pascal Obry  <obry@adacore.com>
+
+       * g-sothco.ads: Minor reformatting.
+       * g-socthi-mingw.adb: Remove part of work on the C_Recvmsg and
+       C_Sendmsg implementation.
+       (C_Sendmsg): Do not use lock (not needed).
+       (C_Recvmsg): Likewise and also do not wait for incoming data.
+
 2010-06-22  Ed Schonberg  <schonberg@adacore.com>
 
        * uintp.adb: Fix scope error in operator call.
index 3443fe35da6967c22b9d9c54674163f2f80edf51..001d654ff1db962b4940ead77acd5f68d4c7b32c 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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- --
@@ -220,11 +220,11 @@ package body ALI.Util is
       null;
    end Post_Scan;
 
-   --------------
-   -- Read_ALI --
-   --------------
+   ----------------------
+   -- Read_Withed_ALIs --
+   ----------------------
 
-   procedure Read_ALI (Id : ALI_Id) is
+   procedure Read_Withed_ALIs (Id : ALI_Id) is
       Afile  : File_Name_Type;
       Text   : Text_Buffer_Ptr;
       Idread : ALI_Id;
@@ -298,7 +298,7 @@ package body ALI.Util is
                else
                   --  Otherwise, recurse to get new dependents
 
-                  Read_ALI (Idread);
+                  Read_Withed_ALIs (Idread);
                end if;
 
             --  If the ALI file has already been processed and is an interface,
@@ -309,7 +309,7 @@ package body ALI.Util is
             end if;
          end loop;
       end loop;
-   end Read_ALI;
+   end Read_Withed_ALIs;
 
    ----------------------
    -- Set_Source_Table --
index d28ad40d54d7c5e585d79ca472d1e6fda7a46b29..3f4f6ebded853874e1a40bcbea602ffc87d58bb4 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2007, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, 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- --
@@ -32,9 +32,9 @@ package ALI.Util is
    -- Source File Table --
    -----------------------
 
-   --  A source file table entry is built for every source file that is
-   --  in the source dependency table of any of the ALI files that make
-   --  up the current program.
+   --  A source file table entry is built for every source file that is in the
+   --  source dependency table of any of the ALI files that make up the current
+   --  program.
 
    No_Source_Id : constant Source_Id := Source_Id'First;
    --  Special value indicating no Source table entry
@@ -101,11 +101,11 @@ package ALI.Util is
    -- Subprograms for Manipulating ALI Information --
    --------------------------------------------------
 
-   procedure Read_ALI (Id : ALI_Id);
-   --  Process an ALI file which has been read and scanned by looping
-   --  through all withed units in the ALI file, checking if they have
-   --  been processed. Each unit that has not yet been processed will
-   --  be read, scanned, and processed recursively.
+   procedure Read_Withed_ALIs (Id : ALI_Id);
+   --  Process an ALI file which has been read and scanned by looping through
+   --  all withed units in the ALI file, checking if they have been processed.
+   --  Each unit that has not yet been processed will be read, scanned, and
+   --  processed recursively.
 
    procedure Set_Source_Table (A : ALI_Id);
    --  Build source table entry corresponding to the ALI file whose id is A
index 6cf0058e96c9cdba1fdb8ccde7d6102c3e5aaeeb..6d7ca23f0b8a8940d55f0a9cbc8b8e7ce15f17e3 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---                     Copyright (C) 2001-2010, AdaCore                     --
+--                    Copyright (C) 2001-2010, AdaCore                      --
 --                                                                          --
 -- 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- --
@@ -43,8 +43,6 @@ with Interfaces.C.Strings;    use Interfaces.C.Strings;
 with System;                  use System;
 with System.Storage_Elements; use System.Storage_Elements;
 
-with GNAT.Task_Lock;
-
 package body GNAT.Sockets.Thin is
 
    use type C.unsigned;
@@ -278,10 +276,8 @@ package body GNAT.Sockets.Thin is
    is
       use type C.size_t;
 
-      Res    : C.int;
-      Count  : C.int := 0;
-      Locked : Boolean := False;
-      --  Set to false when the lock is activated
+      Res   : C.int;
+      Count : C.int := 0;
 
       MH : Msghdr;
       for MH'Address use Msg;
@@ -302,33 +298,8 @@ package body GNAT.Sockets.Thin is
    begin
       --  Windows does not provide an implementation of recvmsg(). The spec for
       --  WSARecvMsg() is incompatible with the data types we define, and is
-      --  not available in all versions of Windows. So, we use C_Recv instead.
-
-      --  First, wait for some data to be available if socket is blocking
-
-      declare
-         Selector     : Selector_Type;
-         R_Socket_Set : Socket_Set_Type;
-         W_Socket_Set : Socket_Set_Type;
-         Status       : Selector_Status;
-         Req          : Request_Type (Name => Non_Blocking_IO);
-      begin
-         Control_Socket (Socket_Type (S), Req);
-
-         if not Req.Enabled then
-            --  We are in a blocking IO mode
-            Create_Selector (Selector);
-
-            Set (R_Socket_Set, Socket_Type (S));
-
-            Check_Selector (Selector, R_Socket_Set, W_Socket_Set, Status);
-
-            Close_Selector (Selector);
-         end if;
-      end;
-
-      GNAT.Task_Lock.Lock;
-      Locked := True;
+      --  available starting with Windows Vista and Server 2008 only. So,
+      --  we use C_Recv instead.
 
       --  Check how much data are available
 
@@ -354,7 +325,6 @@ package body GNAT.Sockets.Thin is
              Flags);
 
          if Res < 0 then
-            Task_Lock.Unlock;
             return System.CRTL.ssize_t (Res);
 
          elsif Res = 0 then
@@ -370,25 +340,15 @@ package body GNAT.Sockets.Thin is
               To_Access (Current_Iovec.Base.all'Address
                 + Storage_Offset (Res));
 
-            --  If we have read all the data that was initially available,
-            --  do not attempt to receive more, since this might block, or
-            --  merge data from successive datagrams in case of a datagram-
-            --  oriented socket.
+            --  If all the data that was initially available read, do not
+            --  attempt to receive more, since this might block, or merge data
+            --  from successive datagrams for a datagram-oriented socket.
 
             exit when Natural (Count) >= Req.Size;
          end if;
       end loop;
 
-      Task_Lock.Unlock;
-
       return System.CRTL.ssize_t (Count);
-
-   exception
-      when others =>
-         if Locked then
-            Task_Lock.Unlock;
-         end if;
-         raise;
    end C_Recvmsg;
 
    --------------
@@ -411,8 +371,8 @@ package body GNAT.Sockets.Thin is
       Last : aliased C.int;
 
    begin
-      --  Asynchronous connection failures are notified in the exception fd set
-      --  instead of the write fd set. To ensure POSIX compatibility, copy
+      --  Asynchronous connection failures are notified in the exception fd
+      --  set instead of the write fd set. To ensure POSIX compatibility, copy
       --  write fd set into exception fd set. Once select() returns, check any
       --  socket present in the exception fd set and peek at incoming
       --  out-of-band data. If the test is not successful, and the socket is
@@ -511,13 +471,10 @@ package body GNAT.Sockets.Thin is
    begin
       --  Windows does not provide an implementation of sendmsg(). The spec for
       --  WSASendMsg() is incompatible with the data types we define, and is
-      --  not available in all versions of Windows. So, we'll use C_Sendto
-      --  instead.
-
-      Task_Lock.Lock;
+      --  available starting with Windows Vista and Server 2008 only. So
+      --  use C_Sendto instead.
 
       for J in Iovec'Range loop
-
          Res :=
            C_Sendto
             (S,
@@ -528,20 +485,13 @@ package body GNAT.Sockets.Thin is
              Tolen => C.int (MH.Msg_Namelen));
 
          if Res < 0 then
-            Task_Lock.Unlock;
             return System.CRTL.ssize_t (Res);
          else
             Count := Count + Res;
          end if;
       end loop;
 
-      Task_Lock.Unlock;
-
       return System.CRTL.ssize_t (Count);
-   exception
-      when others =>
-         Task_Lock.Unlock;
-         raise;
    end C_Sendmsg;
 
    --------------
@@ -563,13 +513,12 @@ package body GNAT.Sockets.Thin is
    package body Host_Error_Messages is
 
       --  On Windows, socket and host errors share the same code space, and
-      --  error messages are provided by Socket_Error_Message. The default
-      --  separate body for Host_Error_Messages is therefore not used in
-      --  this case.
+      --  error messages are provided by Socket_Error_Message, so the default
+      --  separate body for Host_Error_Messages is not used in this case.
 
       function Host_Error_Message
         (H_Errno : Integer) return C.Strings.chars_ptr
-        renames Socket_Error_Message;
+         renames Socket_Error_Message;
 
    end Host_Error_Messages;
 
index 63a6a22880637f153ae1dba47adf229ccd1e25bb..6ffd06631e7141057ca600ed3850fa327185b0e6 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---                     Copyright (C) 2008-2009, AdaCore                     --
+--                     Copyright (C) 2008-2010, AdaCore                     --
 --                                                                          --
 -- 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- --
@@ -294,18 +294,18 @@ package GNAT.Sockets.Thin_Common is
       H_Errnop  : not null access C.int) return C.int;
 
    function C_Getservbyname
-     (Name     : C.char_array;
-      Proto    : C.char_array;
-      Ret      : not null access Servent;
-      Buf      : System.Address;
-      Buflen   : C.int) return C.int;
+     (Name   : C.char_array;
+      Proto  : C.char_array;
+      Ret    : not null access Servent;
+      Buf    : System.Address;
+      Buflen : C.int) return C.int;
 
    function C_Getservbyport
-     (Port     : C.int;
-      Proto    : C.char_array;
-      Ret      : not null access Servent;
-      Buf      : System.Address;
-      Buflen   : C.int) return C.int;
+     (Port   : C.int;
+      Proto  : C.char_array;
+      Ret    : not null access Servent;
+      Buf    : System.Address;
+      Buflen : C.int) return C.int;
 
    ------------------------------------
    -- Scatter/gather vector handling --
index 9d7ac41b32f081edb2ae6b8040a455a33b0f81f3..bdd9702af94329369fb162b1fd6ea431a18eb1c9 100644 (file)
@@ -741,7 +741,7 @@ begin
       --  Acquire all information in ALI files that have been read in
 
       for Index in ALIs.First .. ALIs.Last loop
-         Read_ALI (Index);
+         Read_Withed_ALIs (Index);
       end loop;
 
       --  Quit if some file needs compiling
index be1165db44874186a2ea171a6c4b6398ebb91abc..5614553c77b935a76880c3f8766c36f002ede407 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                  S p e c                                 --
 --                                                                          --
---          Copyright (C) 1992-2009, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2010, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNARL 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- --
@@ -59,8 +59,7 @@ package System.Interrupt_Management is
 
    type Interrupt_Set is array (Interrupt_ID) of Boolean;
 
-   subtype Signal_ID is Interrupt_ID
-     range 0 .. Interfaces.C."-" (System.OS_Interface.NSIG, 1);
+   subtype Signal_ID is Interrupt_ID range 0 .. System.OS_Interface.NSIG - 1;
 
    type Signal_Set is array (Signal_ID) of Boolean;
 
@@ -74,7 +73,7 @@ package System.Interrupt_Management is
    --  convention that ID zero is not used for any "real" signals, and SIGRARE
    --  = 0 when SIGRARE is not one of the locally supported signals, we can
    --  write:
-   --     Reserved (SIGRARE) := true;
+   --     Reserved (SIGRARE) := True;
    --  and the initialization code will be portable.
 
    Abort_Task_Interrupt : Signal_ID;
index 6a8c994c7df42085f8a3b04f86f3e173a1f83865..c33083006b66997fe76c264e75d7ee7c0766c963 100644 (file)
@@ -1385,9 +1385,17 @@ package body Sem_Ch4 is
    procedure Analyze_Conditional_Expression (N : Node_Id) is
       Condition : constant Node_Id := First (Expressions (N));
       Then_Expr : constant Node_Id := Next (Condition);
-      Else_Expr : constant Node_Id := Next (Then_Expr);
+      Else_Expr : Node_Id;
 
    begin
+      --  Defend against error of missing expressions from previous error
+
+      if No (Then_Expr) then
+         return;
+      end if;
+
+      Else_Expr := Next (Then_Expr);
+
       if Comes_From_Source (N) then
          Check_Compiler_Unit (N);
       end if;
index c9f3c5784150c1a11c4d93cef654dfbcd002b009..3ab997b22aa29df38a0f3add83b17d869328a45c 100644 (file)
@@ -8105,6 +8105,7 @@ package body Sem_Res is
          end if;
 
       elsif Is_Entity_Name (Name)
+        or else Nkind (Name) = N_Explicit_Dereference
         or else (Nkind (Name) = N_Function_Call
                   and then not Is_Constrained (Etype (Name)))
       then
index b5e240c97ff5836823090c94ef4b26caa72020de..4fff3f4fcdb24e3aaa66816fc961b700599161ee 100644 (file)
@@ -1251,14 +1251,20 @@ package body Sprint is
             declare
                Condition : constant Node_Id := First (Expressions (Node));
                Then_Expr : constant Node_Id := Next (Condition);
-               Else_Expr : constant Node_Id := Next (Then_Expr);
+
             begin
                Write_Str_With_Col_Check_Sloc ("(if ");
                Sprint_Node (Condition);
                Write_Str_With_Col_Check (" then ");
-               Sprint_Node (Then_Expr);
-               Write_Str_With_Col_Check (" else ");
-               Sprint_Node (Else_Expr);
+
+               --  Defense against junk here!
+
+               if Present (Then_Expr) then
+                  Sprint_Node (Then_Expr);
+                  Write_Str_With_Col_Check (" else ");
+                  Sprint_Node (Next (Then_Expr));
+               end if;
+
                Write_Char (')');
             end;
 
This page took 0.090623 seconds and 5 git commands to generate.