s-stoele.ads, [...]: Move inline_always subprograms earlier than their first call.
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 6 Jun 2007 10:49:08 +0000 (12:49 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 6 Jun 2007 10:49:08 +0000 (12:49 +0200)
2007-04-20  Eric Botcazou  <ebotcazou@adacore.com>

* s-stoele.ads, s-stoele.adb: Move inline_always subprograms earlier
than their first call.
Add type Dummy_Communication_Block used in the generation of the pre-
defined dispatching primitive _disp_asynchronous_select.
(Storage_Element): Put Pragma Universal_Aliasing on it.

From-SVN: r125467

gcc/ada/s-stoele.adb
gcc/ada/s-stoele.ads

index 4d4f9594e76faa5bf37bfc0789c6e94c619ff731..3a4f97333d4095e4ed5cb9ad2da2885c54272fff 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2005, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2007, 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- --
 --                                                                          --
 ------------------------------------------------------------------------------
 
-with Unchecked_Conversion;
+with Ada.Unchecked_Conversion;
+
 package body System.Storage_Elements is
 
    pragma Suppress (All_Checks);
 
-   function To_Address is new Unchecked_Conversion (Storage_Offset, Address);
-   function To_Offset  is new Unchecked_Conversion (Address, Storage_Offset);
+   function To_Address is
+     new Ada.Unchecked_Conversion (Storage_Offset, Address);
+   function To_Offset  is
+     new Ada.Unchecked_Conversion (Address, Storage_Offset);
+
+   --  Conversion to/from integers
+   --  Those functions must be place first because they are inlined_always
+   --  and are used in other subprograms defined in this unit.
+
+   function To_Integer (Value : Address) return Integer_Address is
+   begin
+      return Integer_Address (Value);
+   end To_Integer;
+
+   function To_Address (Value : Integer_Address) return Address is
+   begin
+      return Address (Value);
+   end To_Address;
 
    --  Address arithmetic
 
@@ -74,17 +91,4 @@ package body System.Storage_Elements is
                   ((-To_Integer (Left)) mod Integer_Address (-Right));
       end if;
    end "mod";
-
-   --  Conversion to/from integers
-
-   function To_Address (Value : Integer_Address) return Address is
-   begin
-      return Address (Value);
-   end To_Address;
-
-   function To_Integer (Value : Address) return Integer_Address is
-   begin
-      return Integer_Address (Value);
-   end To_Integer;
-
 end System.Storage_Elements;
index 3b1527bfbdc5920860265f27aa3bcfad07ddf98a..2bc6c8bb20e4a908122ae7aad90333754d3f4166 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 2002-2006, Free Software Foundation, Inc.         --
+--          Copyright (C) 2002-2007, Free Software Foundation, Inc.         --
 --                                                                          --
 -- This specification is derived from the Ada Reference Manual for use with --
 -- GNAT. The copyright notice above, and the license provisions that follow --
@@ -64,6 +64,13 @@ package System.Storage_Elements is
    type Storage_Element is mod 2 ** Storage_Unit;
    for Storage_Element'Size use Storage_Unit;
 
+   pragma Warnings (Off);
+   pragma Universal_Aliasing (Storage_Element);
+   pragma Warnings (On);
+   --  This type is used by the expansion to implement aggregate copy.
+   --  We turn off warnings for this pragma to deal with being compiled
+   --  with an earlier GNAT version that does not recognize this pragma.
+
    type Storage_Array is
      array (Storage_Offset range <>) of aliased Storage_Element;
    for Storage_Array'Component_Size use Storage_Unit;
@@ -111,4 +118,25 @@ package System.Storage_Elements is
    pragma Inline_Always (To_Integer);
    pragma Pure_Function (To_Integer);
 
+   --  The following is a dummy record designed to mimic Communication_Block as
+   --  defined in s-tpobop.ads:
+
+   --     type Communication_Block is record
+   --        Self      : Task_Id;  --  An access type
+   --        Enqueued  : Boolean := True;
+   --        Cancelled : Boolean := False;
+   --     end record;
+
+   --  The record is used in the construction of the predefined dispatching
+   --  primitive _disp_asynchronous_select in order to avoid the import of
+   --  System.Tasking.Protected_Objects.Operations. Note that this package
+   --  is always imported in the presence of interfaces since the dispatch
+   --  table uses entities from here.
+
+   type Dummy_Communication_Block is record
+      Comp_1 : Address;  --  Address and access have the same size
+      Comp_2 : Boolean;
+      Comp_3 : Boolean;
+   end record;
+
 end System.Storage_Elements;