OSDN Git Service

* gcc-interface/decl.c (gnat_to_gnu_entity): Create variables for size
[pf3gnuchains/gcc-fork.git] / gcc / ada / s-inmaop-posix.adb
index 2dab2de..3a10e73 100644 (file)
@@ -2,13 +2,12 @@
 --                                                                          --
 --                  GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS                --
 --                                                                          --
---          S Y S T E M . I N T E R R U P T _ M A N A G E M E N T .         --
---                            O P E R A T I O N S                           --
+--                  SYSTEM.INTERRUPT_MANAGEMENT.OPERATIONS                  --
 --                                                                          --
 --                                  B o d y                                 --
 --                                                                          --
 --             Copyright (C) 1991-1994, Florida State University            --
---                     Copyright (C) 1995-2005, AdaCore                     --
+--                     Copyright (C) 1995-2008, AdaCore                     --
 --                                                                          --
 -- 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- --
 --                                                                          --
 ------------------------------------------------------------------------------
 
---  This is a POSIX-like version of this package.
---  Note: this file can only be used for POSIX compliant systems.
+--  This is a POSIX-like version of this package
+
+--  Note: this file can only be used for POSIX compliant systems
 
 with Interfaces.C;
---  used for int
---           size_t
---           unsigned
 
 with System.OS_Interface;
---  used for various type, constant, and operations
-
 with System.Storage_Elements;
---  used for To_Address
---           Integer_Address
-
-with Unchecked_Conversion;
 
 package body System.Interrupt_Management.Operations is
 
    use Interfaces.C;
    use System.OS_Interface;
 
-   type Interrupt_Mask_Ptr is access all Interrupt_Mask;
-
-   function "+" is new
-     Unchecked_Conversion (Interrupt_Mask_Ptr, sigset_t_ptr);
-
    ---------------------
    -- Local Variables --
    ---------------------
@@ -67,8 +53,9 @@ package body System.Interrupt_Management.Operations is
    Initial_Action : array (Signal) of aliased struct_sigaction;
 
    Default_Action : aliased struct_sigaction;
+   pragma Warnings (Off, Default_Action);
 
-   Ignore_Action  : aliased struct_sigaction;
+   Ignore_Action : aliased struct_sigaction;
 
    ----------------------------
    -- Thread_Block_Interrupt --
@@ -84,7 +71,7 @@ package body System.Interrupt_Management.Operations is
       pragma Assert (Result = 0);
       Result := sigaddset (Mask'Access, Signal (Interrupt));
       pragma Assert (Result = 0);
-      Result := pthread_sigmask (SIG_BLOCK, Mask'Unchecked_Access, null);
+      Result := pthread_sigmask (SIG_BLOCK, Mask'Access, null);
       pragma Assert (Result = 0);
    end Thread_Block_Interrupt;
 
@@ -102,7 +89,7 @@ package body System.Interrupt_Management.Operations is
       pragma Assert (Result = 0);
       Result := sigaddset (Mask'Access, Signal (Interrupt));
       pragma Assert (Result = 0);
-      Result := pthread_sigmask (SIG_UNBLOCK, Mask'Unchecked_Access, null);
+      Result := pthread_sigmask (SIG_UNBLOCK, Mask'Access, null);
       pragma Assert (Result = 0);
    end Thread_Unblock_Interrupt;
 
@@ -111,10 +98,9 @@ package body System.Interrupt_Management.Operations is
    ------------------------
 
    procedure Set_Interrupt_Mask (Mask : access Interrupt_Mask) is
-      Result   : Interfaces.C.int;
+      Result : Interfaces.C.int;
    begin
-      Result := pthread_sigmask
-        (SIG_SETMASK, +Interrupt_Mask_Ptr (Mask), null);
+      Result := pthread_sigmask (SIG_SETMASK, Mask, null);
       pragma Assert (Result = 0);
    end Set_Interrupt_Mask;
 
@@ -124,8 +110,7 @@ package body System.Interrupt_Management.Operations is
    is
       Result  : Interfaces.C.int;
    begin
-      Result := pthread_sigmask
-        (SIG_SETMASK, +Interrupt_Mask_Ptr (Mask), +Interrupt_Mask_Ptr (OMask));
+      Result := pthread_sigmask (SIG_SETMASK, Mask, OMask);
       pragma Assert (Result = 0);
    end Set_Interrupt_Mask;
 
@@ -136,8 +121,7 @@ package body System.Interrupt_Management.Operations is
    procedure Get_Interrupt_Mask (Mask : access Interrupt_Mask) is
       Result : Interfaces.C.int;
    begin
-      Result := pthread_sigmask
-        (SIG_SETMASK, null, +Interrupt_Mask_Ptr (Mask));
+      Result := pthread_sigmask (SIG_SETMASK, null, Mask);
       pragma Assert (Result = 0);
    end Get_Interrupt_Mask;
 
@@ -146,11 +130,11 @@ package body System.Interrupt_Management.Operations is
    --------------------
 
    function Interrupt_Wait
-     (Mask : access Interrupt_Mask)
-      return Interrupt_ID
+     (Mask : access Interrupt_Mask) return Interrupt_ID
    is
       Result : Interfaces.C.int;
       Sig    : aliased Signal;
+
    begin
       Result := sigwait (Mask, Sig'Access);
 
@@ -296,7 +280,7 @@ begin
 
       for Sig in 1 .. Signal'Last loop
          Result := sigaction
-           (Sig, null, Initial_Action (Sig)'Unchecked_Access);
+           (Sig, null, Initial_Action (Sig)'Access);
 
          --  ??? [assert 1]
          --  we can't check Result here since sigaction will fail on
@@ -305,7 +289,7 @@ begin
 
       end loop;
 
-      --  Setup the masks to be exported.
+      --  Setup the masks to be exported
 
       Result := sigemptyset (mask'Access);
       pragma Assert (Result = 0);
@@ -326,12 +310,7 @@ begin
           (Storage_Elements.Integer_Address (SIG_IGN));
 
       for J in Interrupt_ID loop
-
-         --  We need to check whether J is in Keep_Unmasked because
-         --  the index type of the Keep_Unmasked array is not always
-         --  Interrupt_ID; it may be a subtype of Interrupt_ID.
-
-         if J in Keep_Unmasked'Range and then Keep_Unmasked (J) then
+         if Keep_Unmasked (J) then
             Result := sigaddset (mask'Access, Signal (J));
             pragma Assert (Result = 0);
             Result := sigdelset (allmask'Access, Signal (J));
@@ -341,12 +320,12 @@ begin
 
       --  The Keep_Unmasked signals should be unmasked for Environment task
 
-      Result := pthread_sigmask (SIG_UNBLOCK, mask'Unchecked_Access, null);
+      Result := pthread_sigmask (SIG_UNBLOCK, mask'Access, null);
       pragma Assert (Result = 0);
 
       --  Get the signal mask of the Environment Task
 
-      Result := pthread_sigmask (SIG_SETMASK, null, mask'Unchecked_Access);
+      Result := pthread_sigmask (SIG_SETMASK, null, mask'Access);
       pragma Assert (Result = 0);
 
       --  Setup the constants exported