2008-05-30 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / ada / s-stoele.ads
blob45871a5f3b491f82036ea58612b41ca985120eac
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S Y S T E M . S T O R A G E _ E L E M E N T S --
6 -- --
7 -- S p e c --
8 -- --
9 -- Copyright (C) 2002-2008, Free Software Foundation, Inc. --
10 -- --
11 -- This specification is derived from the Ada Reference Manual for use with --
12 -- GNAT. The copyright notice above, and the license provisions that follow --
13 -- apply solely to the implementation dependent sections of this file. --
14 -- --
15 -- GNAT is free software; you can redistribute it and/or modify it under --
16 -- terms of the GNU General Public License as published by the Free Soft- --
17 -- ware Foundation; either version 2, or (at your option) any later ver- --
18 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
19 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
20 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
21 -- for more details. You should have received a copy of the GNU General --
22 -- Public License distributed with GNAT; see file COPYING. If not, write --
23 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
24 -- Boston, MA 02110-1301, USA. --
25 -- --
26 -- As a special exception, if other files instantiate generics from this --
27 -- unit, or you link this unit with other files to produce an executable, --
28 -- this unit does not by itself cause the resulting executable to be --
29 -- covered by the GNU General Public License. This exception does not --
30 -- however invalidate any other reasons why the executable file might be --
31 -- covered by the GNU Public License. --
32 -- --
33 -- GNAT was originally developed by the GNAT team at New York University. --
34 -- Extensive contributions were provided by Ada Core Technologies Inc. --
35 -- --
36 ------------------------------------------------------------------------------
38 -- Warning: declarations in this package are ambiguous with respect to the
39 -- extra declarations that can be introduced into System using Extend_System.
40 -- It is a good idea to avoid use clauses for this package!
42 pragma Warnings (Off);
43 pragma Compiler_Unit;
44 pragma Warnings (On);
46 package System.Storage_Elements is
47 pragma Pure;
48 -- Note that we take advantage of the implementation permission to make
49 -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada 2005,
50 -- this is Pure in any case (AI-362).
52 -- We also add the pragma Pure_Function to the operations in this package,
53 -- because otherwise functions with parameters derived from Address are
54 -- treated as non-pure by the back-end (see exp_ch6.adb). This is because
55 -- in many cases such a parameter is used to hide read/out access to
56 -- objects, and it would be unsafe to treat such functions as pure.
58 type Storage_Offset is range
59 -(2 ** (Integer'(Standard'Address_Size) - 1)) ..
60 +(2 ** (Integer'(Standard'Address_Size) - 1)) - Long_Long_Integer'(1);
61 -- Note: the reason for the Long_Long_Integer qualification here is to
62 -- avoid a bogus ambiguity when this unit is analyzed in an rtsfind
63 -- context. It may be possible to remove this in the future, but it is
64 -- certainly harmless in any case ???
66 subtype Storage_Count is Storage_Offset range 0 .. Storage_Offset'Last;
68 type Storage_Element is mod 2 ** Storage_Unit;
69 for Storage_Element'Size use Storage_Unit;
71 pragma Warnings (Off);
72 pragma Universal_Aliasing (Storage_Element);
73 pragma Warnings (On);
74 -- This type is used by the expansion to implement aggregate copy.
75 -- We turn off warnings for this pragma to deal with being compiled
76 -- with an earlier GNAT version that does not recognize this pragma.
78 type Storage_Array is
79 array (Storage_Offset range <>) of aliased Storage_Element;
80 for Storage_Array'Component_Size use Storage_Unit;
82 -- Address arithmetic
84 function "+" (Left : Address; Right : Storage_Offset) return Address;
85 pragma Convention (Intrinsic, "+");
86 pragma Inline_Always ("+");
87 pragma Pure_Function ("+");
89 function "+" (Left : Storage_Offset; Right : Address) return Address;
90 pragma Convention (Intrinsic, "+");
91 pragma Inline_Always ("+");
92 pragma Pure_Function ("+");
94 function "-" (Left : Address; Right : Storage_Offset) return Address;
95 pragma Convention (Intrinsic, "-");
96 pragma Inline_Always ("-");
97 pragma Pure_Function ("-");
99 function "-" (Left, Right : Address) return Storage_Offset;
100 pragma Convention (Intrinsic, "-");
101 pragma Inline_Always ("-");
102 pragma Pure_Function ("-");
104 function "mod"
105 (Left : Address;
106 Right : Storage_Offset) return Storage_Offset;
107 pragma Convention (Intrinsic, "mod");
108 pragma Inline_Always ("mod");
109 pragma Pure_Function ("mod");
111 -- Conversion to/from integers
113 type Integer_Address is mod Memory_Size;
115 function To_Address (Value : Integer_Address) return Address;
116 pragma Convention (Intrinsic, To_Address);
117 pragma Inline_Always (To_Address);
118 pragma Pure_Function (To_Address);
120 function To_Integer (Value : Address) return Integer_Address;
121 pragma Convention (Intrinsic, To_Integer);
122 pragma Inline_Always (To_Integer);
123 pragma Pure_Function (To_Integer);
125 end System.Storage_Elements;