1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- L O C A L _ R E S T R I C T --
9 -- Copyright (C) 1992-2023, Free Software Foundation, Inc. --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING3. If not, go to --
19 -- http://www.gnu.org/licenses for a complete copy of the license. --
21 -- GNAT was originally developed by the GNAT team at New York University. --
22 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 ------------------------------------------------------------------------------
26 -- This package deals with the implementation of the Local_Restrictions aspect
28 with Types
; use Types
;
30 package Local_Restrict
is
31 type Local_Restriction
is (No_Secondary_Stack
, No_Heap_Allocations
);
32 -- A local restriction can be mentioned in a Local_Restrictions aspect
33 -- specification. A local restriction might apply, for example, to a
34 -- single subprogram. No_Secondary_Stack corresponds to the
35 -- GNAT-defined restriction of the same name. No_Heap_Allocations
36 -- corresponds to the conjunction of the RM-defined restrictions
37 -- No_Allocators and No_Implicit_Heap_Allocations. If a subprogram is
38 -- subject to a local restriction, then any subprogram that it calls
39 -- shall be known to satisfy that restriction.
41 type Local_Restriction_Set
is array (Local_Restriction
) of Boolean;
43 procedure Check_Call
(Call
: Node_Id
; Callee
: Entity_Id
:= Empty
);
44 -- Check whether a call violates any local restrictions that are
45 -- in effect. An empty callee indicates that the callee should be
46 -- conservatively assumed to violate any local restrictions that
47 -- are in effect (for example, for an entry call or a call through
48 -- an access-to-subprogram value).
50 procedure Check_Overriding
(Overrider_Op
, Overridden_Op
: Entity_Id
);
51 -- Check that all of the local restrictions in effect for
52 -- Overridden_Op are also in effect for Overrider_Op.
54 procedure Check_Actual_Subprogram_For_Instance
55 (Actual_Subp_Name
: Node_Id
; Formal_Subp
: Entity_Id
);
56 -- Check that all of the local restrictions in effect for
57 -- Formal_Subp are also in effect for Actual_Subp.