1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 1992-2021, 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 with Atree
; use Atree
;
27 with Casing
; use Casing
;
28 with Einfo
; use Einfo
;
29 with Einfo
.Entities
; use Einfo
.Entities
;
30 with Einfo
.Utils
; use Einfo
.Utils
;
31 with Errout
; use Errout
;
32 with Debug
; use Debug
;
33 with Fname
; use Fname
;
34 with Fname
.UF
; use Fname
.UF
;
37 with Sinfo
; use Sinfo
;
38 with Sinfo
.Nodes
; use Sinfo
.Nodes
;
39 with Sinfo
.Utils
; use Sinfo
.Utils
;
40 with Sinput
; use Sinput
;
41 with Stand
; use Stand
;
42 with Targparm
; use Targparm
;
43 with Uname
; use Uname
;
45 package body Restrict
is
47 Global_Restriction_No_Tasking
: Boolean := False;
48 -- Set to True when No_Tasking is set in the run-time package System
49 -- or in a configuration pragmas file (for example, gnat.adc).
51 --------------------------------
52 -- Package Local Declarations --
53 --------------------------------
55 Config_Cunit_Boolean_Restrictions
: Save_Cunit_Boolean_Restrictions
;
56 -- Save compilation unit restrictions set by config pragma files
58 Restricted_Profile_Result
: Boolean := False;
59 -- This switch memoizes the result of Restricted_Profile function calls for
60 -- improved efficiency. Valid only if Restricted_Profile_Cached is True.
61 -- Note: if this switch is ever set True, it is never turned off again.
63 Restricted_Profile_Cached
: Boolean := False;
64 -- This flag is set to True if the Restricted_Profile_Result contains the
65 -- correct cached result of Restricted_Profile calls.
67 No_Specification_Of_Aspects
: array (Aspect_Id
) of Source_Ptr
:=
68 (others => No_Location
);
69 -- Entries in this array are set to point to a previously occurring pragma
70 -- that activates a No_Specification_Of_Aspect check.
72 No_Specification_Of_Aspect_Warning
: array (Aspect_Id
) of Boolean :=
74 -- An entry in this array is set False in reponse to a previous call to
75 -- Set_No_Speficiation_Of_Aspect for pragmas in the main unit that
76 -- specify Warning as False. Once set False, an entry is never reset.
78 No_Specification_Of_Aspect_Set
: Boolean := False;
79 -- Set True if any entry of No_Specifcation_Of_Aspects has been set True.
80 -- Once set True, this is never turned off again.
82 No_Use_Of_Attribute
: array (Attribute_Id
) of Source_Ptr
:=
83 (others => No_Location
);
85 No_Use_Of_Attribute_Warning
: array (Attribute_Id
) of Boolean :=
88 No_Use_Of_Attribute_Set
: Boolean := False;
89 -- Indicates that No_Use_Of_Attribute was set at least once
91 No_Use_Of_Pragma
: array (Pragma_Id
) of Source_Ptr
:=
92 (others => No_Location
);
93 -- Source location of pragma No_Use_Of_Pragma for given pragma, a value
94 -- of System_Location indicates occurrence in system.ads.
96 No_Use_Of_Pragma_Warning
: array (Pragma_Id
) of Boolean :=
99 No_Use_Of_Pragma_Set
: Boolean := False;
100 -- Indicates that No_Use_Of_Pragma was set at least once
102 -----------------------
103 -- Local Subprograms --
104 -----------------------
106 procedure Restriction_Msg
(R
: Restriction_Id
; N
: Node_Id
);
107 -- Called if a violation of restriction R at node N is found. This routine
108 -- outputs the appropriate message or messages taking care of warning vs
109 -- real violation, serious vs non-serious, implicit vs explicit, the second
110 -- message giving the profile name if needed, and the location information.
112 function Same_Entity
(E1
, E2
: Node_Id
) return Boolean;
113 -- Returns True iff E1 and E2 represent the same entity. Used for handling
114 -- of No_Use_Of_Entity => fully_qualified_ENTITY restriction case.
116 function Same_Unit
(U1
, U2
: Node_Id
) return Boolean;
117 -- Returns True iff U1 and U2 represent the same library unit. Used for
118 -- handling of No_Dependence => Unit restriction case.
120 function Suppress_Restriction_Message
(N
: Node_Id
) return Boolean;
121 -- N is the node for a possible restriction violation message, but the
122 -- message is to be suppressed if this is an internal file and this file is
123 -- not the main unit. Returns True if message is to be suppressed.
129 function Abort_Allowed
return Boolean is
131 if Restrictions
.Set
(No_Abort_Statements
)
132 and then Restrictions
.Set
(Max_Asynchronous_Select_Nesting
)
133 and then Restrictions
.Value
(Max_Asynchronous_Select_Nesting
) = 0
141 ----------------------------------------
142 -- Add_To_Config_Boolean_Restrictions --
143 ----------------------------------------
145 procedure Add_To_Config_Boolean_Restrictions
(R
: Restriction_Id
) is
147 Config_Cunit_Boolean_Restrictions
(R
) := True;
148 end Add_To_Config_Boolean_Restrictions
;
149 -- Add specified restriction to stored configuration boolean restrictions.
150 -- This is used for handling the special case of No_Elaboration_Code.
152 -------------------------
153 -- Check_Compiler_Unit --
154 -------------------------
156 procedure Check_Compiler_Unit
(Feature
: String; N
: Node_Id
) is
158 if Compiler_Unit
then
159 Error_Msg_N
(Feature
& " not allowed in compiler unit!!??", N
);
161 end Check_Compiler_Unit
;
163 procedure Check_Compiler_Unit
(Feature
: String; Loc
: Source_Ptr
) is
165 if Compiler_Unit
then
166 Error_Msg
(Feature
& " not allowed in compiler unit!!??", Loc
);
168 end Check_Compiler_Unit
;
170 ------------------------------------
171 -- Check_Elaboration_Code_Allowed --
172 ------------------------------------
174 procedure Check_Elaboration_Code_Allowed
(N
: Node_Id
) is
176 Check_Restriction
(No_Elaboration_Code
, N
);
177 end Check_Elaboration_Code_Allowed
;
179 -----------------------------------------
180 -- Check_Implicit_Dynamic_Code_Allowed --
181 -----------------------------------------
183 procedure Check_Implicit_Dynamic_Code_Allowed
(N
: Node_Id
) is
185 Check_Restriction
(No_Implicit_Dynamic_Code
, N
);
186 end Check_Implicit_Dynamic_Code_Allowed
;
188 --------------------------------
189 -- Check_No_Implicit_Aliasing --
190 --------------------------------
192 procedure Check_No_Implicit_Aliasing
(Obj
: Node_Id
) is
196 -- If restriction not active, nothing to check
198 if not Restriction_Active
(No_Implicit_Aliasing
) then
202 -- If we have an entity name, check entity
204 if Is_Entity_Name
(Obj
) then
207 -- Restriction applies to entities that are objects
209 if Is_Object
(E
) then
210 if Is_Aliased
(E
) then
213 elsif Present
(Renamed_Object
(E
)) then
214 Check_No_Implicit_Aliasing
(Renamed_Object
(E
));
218 -- If we don't have an object, then it's OK
224 -- For selected component, check selector
226 elsif Nkind
(Obj
) = N_Selected_Component
then
227 Check_No_Implicit_Aliasing
(Selector_Name
(Obj
));
230 -- Indexed component is OK if aliased components
232 elsif Nkind
(Obj
) = N_Indexed_Component
then
233 if Has_Aliased_Components
(Etype
(Prefix
(Obj
)))
235 (Is_Access_Type
(Etype
(Prefix
(Obj
)))
236 and then Has_Aliased_Components
237 (Designated_Type
(Etype
(Prefix
(Obj
)))))
242 -- For type conversion, check converted expression
244 elsif Nkind
(Obj
) in N_Unchecked_Type_Conversion | N_Type_Conversion
then
245 Check_No_Implicit_Aliasing
(Expression
(Obj
));
248 -- Explicit dereference is always OK
250 elsif Nkind
(Obj
) = N_Explicit_Dereference
then
254 -- If we fall through, then we have an aliased view that does not meet
255 -- the rules for being explicitly aliased, so issue restriction msg.
257 Check_Restriction
(No_Implicit_Aliasing
, Obj
);
258 end Check_No_Implicit_Aliasing
;
260 ----------------------------------
261 -- Check_No_Implicit_Heap_Alloc --
262 ----------------------------------
264 procedure Check_No_Implicit_Heap_Alloc
(N
: Node_Id
) is
266 Check_Restriction
(No_Implicit_Heap_Allocations
, N
);
267 end Check_No_Implicit_Heap_Alloc
;
269 ----------------------------------
270 -- Check_No_Implicit_Task_Alloc --
271 ----------------------------------
273 procedure Check_No_Implicit_Task_Alloc
(N
: Node_Id
) is
275 Check_Restriction
(No_Implicit_Task_Allocations
, N
);
276 end Check_No_Implicit_Task_Alloc
;
278 ---------------------------------------
279 -- Check_No_Implicit_Protected_Alloc --
280 ---------------------------------------
282 procedure Check_No_Implicit_Protected_Alloc
(N
: Node_Id
) is
284 Check_Restriction
(No_Implicit_Protected_Object_Allocations
, N
);
285 end Check_No_Implicit_Protected_Alloc
;
287 -----------------------------------
288 -- Check_Obsolescent_2005_Entity --
289 -----------------------------------
291 procedure Check_Obsolescent_2005_Entity
(E
: Entity_Id
; N
: Node_Id
) is
292 function Chars_Is
(E
: Entity_Id
; S
: String) return Boolean;
293 -- Return True iff Chars (E) matches S (given in lower case)
299 function Chars_Is
(E
: Entity_Id
; S
: String) return Boolean is
300 Nam
: constant Name_Id
:= Chars
(E
);
302 if Length_Of_Name
(Nam
) /= S
'Length then
305 return Get_Name_String
(Nam
) = S
;
309 -- Start of processing for Check_Obsolescent_2005_Entity
312 if Restriction_Check_Required
(No_Obsolescent_Features
)
313 and then Ada_Version
>= Ada_2005
314 and then Chars_Is
(Scope
(E
), "handling")
315 and then Chars_Is
(Scope
(Scope
(E
)), "characters")
316 and then Chars_Is
(Scope
(Scope
(Scope
(E
))), "ada")
317 and then Scope
(Scope
(Scope
(Scope
(E
)))) = Standard_Standard
319 if Chars_Is
(E
, "is_character") or else
320 Chars_Is
(E
, "is_string") or else
321 Chars_Is
(E
, "to_character") or else
322 Chars_Is
(E
, "to_string") or else
323 Chars_Is
(E
, "to_wide_character") or else
324 Chars_Is
(E
, "to_wide_string")
326 Check_Restriction
(No_Obsolescent_Features
, N
);
329 end Check_Obsolescent_2005_Entity
;
331 ---------------------------
332 -- Check_Restricted_Unit --
333 ---------------------------
335 procedure Check_Restricted_Unit
(U
: Unit_Name_Type
; N
: Node_Id
) is
337 if Suppress_Restriction_Message
(N
) then
340 elsif Is_Spec_Name
(U
) then
342 Fnam
: constant File_Name_Type
:=
343 Get_File_Name
(U
, Subunit
=> False);
348 Get_Name_String
(Fnam
);
350 -- Nothing to do if name not at least 5 characters long ending
351 -- in .ads or .adb extension, which we strip.
354 or else (Name_Buffer
(Name_Len
- 3 .. Name_Len
) /= ".ads"
356 Name_Buffer
(Name_Len
- 3 .. Name_Len
) /= ".adb")
361 -- Strip extension and pad to eight characters
363 Name_Len
:= Name_Len
- 4;
364 Add_Str_To_Name_Buffer
((Name_Len
+ 1 .. 8 => ' '));
366 -- If predefined unit, check the list of restricted units
368 if Is_Predefined_File_Name
(Fnam
) then
369 for J
in Unit_Array
'Range loop
371 and then Name_Buffer
(1 .. 8) = Unit_Array
(J
).Filenm
373 Check_Restriction
(Unit_Array
(J
).Res_Id
, N
);
377 -- If not predefined unit, then one special check still
378 -- remains. GNAT.Current_Exception is not allowed if we have
379 -- restriction No_Exception_Propagation active.
382 if Name_Buffer
(1 .. 8) = "g-curexc" then
383 Check_Restriction
(No_Exception_Propagation
, N
);
388 end Check_Restricted_Unit
;
390 -----------------------
391 -- Check_Restriction --
392 -----------------------
394 procedure Check_Restriction
397 V
: Uint
:= Uint_Minus_1
)
399 Ignore_Msg_Issued
: Boolean;
401 Check_Restriction
(Ignore_Msg_Issued
, R
, N
, V
);
402 end Check_Restriction
;
404 procedure Check_Restriction
405 (Msg_Issued
: out Boolean;
408 V
: Uint
:= Uint_Minus_1
)
411 -- V converted to integer form. If V is greater than Integer'Last,
412 -- it is reset to minus 1 (unknown value).
414 procedure Update_Restrictions
(Info
: in out Restrictions_Info
);
415 -- Update violation information in Info.Violated and Info.Count
417 -------------------------
418 -- Update_Restrictions --
419 -------------------------
421 procedure Update_Restrictions
(Info
: in out Restrictions_Info
) is
423 -- If not violated, set as violated now
425 if not Info
.Violated
(R
) then
426 Info
.Violated
(R
) := True;
428 if R
in All_Parameter_Restrictions
then
430 Info
.Unknown
(R
) := True;
434 Info
.Count
(R
) := VV
;
438 -- Otherwise if violated already and a parameter restriction,
439 -- update count by maximizing or summing depending on restriction.
441 elsif R
in All_Parameter_Restrictions
then
443 -- If new value is unknown, result is unknown
446 Info
.Unknown
(R
) := True;
448 -- If checked by maximization, nothing to do because the
449 -- check is per-object.
451 elsif R
in Checked_Max_Parameter_Restrictions
then
454 -- If checked by adding, do add, checking for overflow
456 elsif R
in Checked_Add_Parameter_Restrictions
then
458 pragma Unsuppress
(Overflow_Check
);
460 Info
.Count
(R
) := Info
.Count
(R
) + VV
;
462 when Constraint_Error
=>
463 Info
.Count
(R
) := Integer'Last;
464 Info
.Unknown
(R
) := True;
467 -- Should not be able to come here, known counts should only
468 -- occur for restrictions that are Checked_max or Checked_Sum.
474 end Update_Restrictions
;
476 -- Start of processing for Check_Restriction
481 -- In CodePeer mode, we do not want to check for any restriction, or set
482 -- additional restrictions other than those already set in gnat1drv.adb
483 -- so that we have consistency between each compilation.
485 -- In GNATprove mode restrictions are checked, except for
486 -- No_Initialize_Scalars, which is implicitly set in gnat1drv.adb.
489 or else (GNATprove_Mode
and then R
= No_Initialize_Scalars
)
494 if UI_Is_In_Int_Range
(V
) then
495 VV
:= Integer (UI_To_Int
(V
));
500 -- Count can only be specified in the checked val parameter case
502 pragma Assert
(VV
< 0 or else R
in Checked_Val_Parameter_Restrictions
);
504 -- Nothing to do if value of zero specified for parameter restriction
510 -- Update current restrictions
512 Update_Restrictions
(Restrictions
);
514 -- If in main extended unit, update main restrictions as well. Note
515 -- that as usual we check for Main_Unit explicitly to deal with the
516 -- case of configuration pragma files.
518 if Current_Sem_Unit
= Main_Unit
519 or else In_Extended_Main_Source_Unit
(N
)
521 Update_Restrictions
(Main_Restrictions
);
524 -- Nothing to do if restriction message suppressed
526 if Suppress_Restriction_Message
(N
) then
529 -- If restriction not set, nothing to do
531 elsif not Restrictions
.Set
(R
) then
534 -- Don't complain about No_Obsolescent_Features in an instance, since we
535 -- will complain on the template, which is much better. Are there other
536 -- cases like this ??? Do we need a more general mechanism ???
538 elsif R
= No_Obsolescent_Features
539 and then Instantiation_Location
(Sloc
(N
)) /= No_Location
543 -- Here if restriction set, check for violation (this is a Boolean
544 -- restriction, or a parameter restriction with a value of zero and an
545 -- unknown count, or a parameter restriction with a known value that
546 -- exceeds the restriction count).
548 elsif R
in All_Boolean_Restrictions
549 or else (Restrictions
.Unknown
(R
)
550 and then Restrictions
.Value
(R
) = 0)
551 or else Restrictions
.Count
(R
) > Restrictions
.Value
(R
)
554 Restriction_Msg
(R
, N
);
557 -- For Max_Entries and the like, do not carry forward the violation
558 -- count because it does not affect later declarations.
560 if R
in Checked_Max_Parameter_Restrictions
then
561 Restrictions
.Count
(R
) := 0;
562 Restrictions
.Violated
(R
) := False;
564 end Check_Restriction
;
566 -------------------------------------
567 -- Check_Restriction_No_Dependence --
568 -------------------------------------
570 procedure Check_Restriction_No_Dependence
(U
: Node_Id
; Err
: Node_Id
) is
574 -- Ignore call if node U is not in the main source unit. This avoids
575 -- cascaded errors, e.g. when Ada.Containers units with other units.
576 -- However, allow Standard_Location here, since this catches some cases
577 -- of constructs that get converted to run-time calls.
579 if not In_Extended_Main_Source_Unit
(U
)
580 and then Sloc
(U
) /= Standard_Location
585 -- Loop through entries in No_Dependence table to check each one in turn
587 for J
in No_Dependences
.First
.. No_Dependences
.Last
loop
588 DU
:= No_Dependences
.Table
(J
).Unit
;
590 if Same_Unit
(U
, DU
) then
591 Error_Msg_Sloc
:= Sloc
(DU
);
592 Error_Msg_Node_1
:= DU
;
594 if No_Dependences
.Table
(J
).Warn
then
596 ("?*?violation of restriction `No_Dependence '='> &`#",
600 ("|violation of restriction `No_Dependence '='> &`#",
607 end Check_Restriction_No_Dependence
;
609 --------------------------------------------------
610 -- Check_Restriction_No_Specification_Of_Aspect --
611 --------------------------------------------------
613 procedure Check_Restriction_No_Specification_Of_Aspect
(N
: Node_Id
) is
618 -- Ignore call if no instances of this restriction set
620 if not No_Specification_Of_Aspect_Set
then
624 -- Ignore call if node N is not in the main source unit, since we only
625 -- give messages for the main unit. This avoids giving messages for
626 -- aspects that are specified in withed units.
628 if not In_Extended_Main_Source_Unit
(N
) then
632 if Nkind
(N
) = N_Pragma
then
633 Id
:= Pragma_Identifier
(N
);
634 elsif Nkind
(N
) = N_Attribute_Definition_Clause
then
637 Id
:= Identifier
(N
);
640 A_Id
:= Get_Aspect_Id
(Chars
(Id
));
641 pragma Assert
(A_Id
/= No_Aspect
);
643 Error_Msg_Sloc
:= No_Specification_Of_Aspects
(A_Id
);
645 if Error_Msg_Sloc
/= No_Location
then
646 Error_Msg_Node_1
:= Id
;
647 Error_Msg_Warn
:= No_Specification_Of_Aspect_Warning
(A_Id
);
649 ("<*<violation of restriction `No_Specification_Of_Aspect '='> &`#",
652 end Check_Restriction_No_Specification_Of_Aspect
;
654 -------------------------------------------
655 -- Check_Restriction_No_Use_Of_Attribute --
656 --------------------------------------------
658 procedure Check_Restriction_No_Use_Of_Attribute
(N
: Node_Id
) is
659 Attr_Id
: Attribute_Id
;
663 -- Nothing to do if the attribute is not in the main source unit, since
664 -- we only give messages for the main unit. This avoids giving messages
665 -- for attributes that are specified in withed units.
667 if not In_Extended_Main_Source_Unit
(N
) then
670 -- Nothing to do if not checking No_Use_Of_Attribute
672 elsif not No_Use_Of_Attribute_Set
then
675 -- Do not consider internally generated attributes because this leads to
678 elsif not Comes_From_Source
(N
) then
682 if Nkind
(N
) = N_Attribute_Definition_Clause
then
683 Attr_Nam
:= Chars
(N
);
685 pragma Assert
(Nkind
(N
) = N_Attribute_Reference
);
686 Attr_Nam
:= Attribute_Name
(N
);
689 Attr_Id
:= Get_Attribute_Id
(Attr_Nam
);
690 Error_Msg_Sloc
:= No_Use_Of_Attribute
(Attr_Id
);
692 if Error_Msg_Sloc
/= No_Location
then
693 Error_Msg_Name_1
:= Attr_Nam
;
694 Error_Msg_Warn
:= No_Use_Of_Attribute_Warning
(Attr_Id
);
696 ("<*<violation of restriction `No_Use_Of_Attribute '='> %` #", N
);
698 end Check_Restriction_No_Use_Of_Attribute
;
700 ----------------------------------------
701 -- Check_Restriction_No_Use_Of_Entity --
702 ----------------------------------------
704 procedure Check_Restriction_No_Use_Of_Entity
(N
: Node_Id
) is
706 -- Error defence (not clearly necessary, but better safe)
708 if No
(Entity
(N
)) then
712 -- If simple name of entity not flagged with Boolean2 flag, then there
713 -- cannot be a matching entry in the table, so skip the search.
715 if Get_Name_Table_Boolean2
(Chars
(Entity
(N
))) = False then
719 -- Restriction is only recognized within a configuration pragma file,
720 -- or within a unit of the main extended program. Note: the test for
721 -- Main_Unit is needed to properly include the case of configuration
724 if Current_Sem_Unit
/= Main_Unit
725 and then not In_Extended_Main_Source_Unit
(N
)
730 -- Here we must search the table
732 for J
in No_Use_Of_Entity
.First
.. No_Use_Of_Entity
.Last
loop
734 NE_Ent
: NE_Entry
renames No_Use_Of_Entity
.Table
(J
);
740 Expr
:= NE_Ent
.Entity
;
742 -- Here if at outer level of entity name in reference (handle
743 -- also the direct use of Text_IO in the pragma). For example:
744 -- pragma Restrictions (No_Use_Of_Entity => Text_IO.Put);
746 if Scope
(Ent
) = Standard_Standard
747 or else (Nkind
(Expr
) = N_Identifier
748 and then Chars
(Ent
) = Name_Text_IO
749 and then Chars
(Scope
(Ent
)) = Name_Ada
750 and then Scope
(Scope
(Ent
)) = Standard_Standard
)
752 if Nkind
(Expr
) in N_Identifier | N_Operator_Symbol
753 and then Chars
(Ent
) = Chars
(Expr
)
755 Error_Msg_Node_1
:= N
;
756 Error_Msg_Warn
:= NE_Ent
.Warn
;
757 Error_Msg_Sloc
:= Sloc
(NE_Ent
.Entity
);
759 ("<*<reference to & violates restriction "
760 & "No_Use_Of_Entity #", N
);
767 -- Here if at outer level of entity name in table
769 elsif Nkind
(Expr
) in N_Identifier | N_Operator_Symbol
then
772 -- Here if neither at the outer level
775 pragma Assert
(Nkind
(Expr
) = N_Selected_Component
);
776 exit when Chars
(Selector_Name
(Expr
)) /= Chars
(Ent
);
783 exit when not Is_Internal_Name
(Chars
(Ent
));
786 Expr
:= Prefix
(Expr
);
790 end Check_Restriction_No_Use_Of_Entity
;
792 ----------------------------------------
793 -- Check_Restriction_No_Use_Of_Pragma --
794 ----------------------------------------
796 procedure Check_Restriction_No_Use_Of_Pragma
(N
: Node_Id
) is
797 Id
: constant Node_Id
:= Pragma_Identifier
(N
);
798 P_Id
: constant Pragma_Id
:= Get_Pragma_Id
(Chars
(Id
));
801 -- Nothing to do if the pragma is not in the main source unit, since we
802 -- only give messages for the main unit. This avoids giving messages for
803 -- pragmas that are specified in withed units.
805 if not In_Extended_Main_Source_Unit
(N
) then
808 -- Nothing to do if not checking No_Use_Of_Pragma
810 elsif not No_Use_Of_Pragma_Set
then
813 -- Do not consider internally generated pragmas because this leads to
816 elsif not Comes_From_Source
(N
) then
820 Error_Msg_Sloc
:= No_Use_Of_Pragma
(P_Id
);
822 if Error_Msg_Sloc
/= No_Location
then
823 Error_Msg_Warn
:= No_Use_Of_Pragma_Warning
(P_Id
);
825 ("<*<violation of restriction `No_Use_Of_Pragma '='> &` #", Id
);
827 end Check_Restriction_No_Use_Of_Pragma
;
829 --------------------------------------
830 -- Check_Wide_Character_Restriction --
831 --------------------------------------
833 procedure Check_Wide_Character_Restriction
(E
: Entity_Id
; N
: Node_Id
) is
835 if Restriction_Check_Required
(No_Wide_Characters
)
836 and then Comes_From_Source
(N
)
839 T
: constant Entity_Id
:= Root_Type
(E
);
841 if T
= Standard_Wide_Character
or else
842 T
= Standard_Wide_String
or else
843 T
= Standard_Wide_Wide_Character
or else
844 T
= Standard_Wide_Wide_String
846 Check_Restriction
(No_Wide_Characters
, N
);
850 end Check_Wide_Character_Restriction
;
852 ----------------------------------------
853 -- Cunit_Boolean_Restrictions_Restore --
854 ----------------------------------------
856 procedure Cunit_Boolean_Restrictions_Restore
857 (R
: Save_Cunit_Boolean_Restrictions
)
860 for J
in Cunit_Boolean_Restrictions
loop
861 Restrictions
.Set
(J
) := R
(J
);
864 -- If No_Elaboration_Code set in configuration restrictions, and we
865 -- in the main extended source, then set it here now. This is part of
866 -- the special processing for No_Elaboration_Code.
868 if In_Extended_Main_Source_Unit
(Cunit_Entity
(Current_Sem_Unit
))
869 and then Config_Cunit_Boolean_Restrictions
(No_Elaboration_Code
)
871 Restrictions
.Set
(No_Elaboration_Code
) := True;
873 end Cunit_Boolean_Restrictions_Restore
;
875 -------------------------------------
876 -- Cunit_Boolean_Restrictions_Save --
877 -------------------------------------
879 function Cunit_Boolean_Restrictions_Save
880 return Save_Cunit_Boolean_Restrictions
882 R
: Save_Cunit_Boolean_Restrictions
;
885 for J
in Cunit_Boolean_Restrictions
loop
886 R
(J
) := Restrictions
.Set
(J
);
890 end Cunit_Boolean_Restrictions_Save
;
892 ------------------------
893 -- Get_Restriction_Id --
894 ------------------------
896 function Get_Restriction_Id
897 (N
: Name_Id
) return Restriction_Id
901 Set_Casing
(All_Upper_Case
);
903 for J
in All_Restrictions
loop
905 S
: constant String := Restriction_Id
'Image (J
);
907 if S
= Name_Buffer
(1 .. Name_Len
) then
913 return Not_A_Restriction_Id
;
914 end Get_Restriction_Id
;
916 -----------------------
917 -- Global_No_Tasking --
918 -----------------------
920 function Global_No_Tasking
return Boolean is
922 return Global_Restriction_No_Tasking
923 or else Targparm
.Restrictions_On_Target
.Set
(No_Tasking
);
924 end Global_No_Tasking
;
926 ---------------------------------------------
927 -- No_Dynamic_Accessibility_Checks_Enabled --
928 ---------------------------------------------
930 function No_Dynamic_Accessibility_Checks_Enabled
931 (N
: Node_Id
) return Boolean
933 pragma Unreferenced
(N
);
934 -- N is currently unreferenced but present for debugging purposes and
935 -- potential future use.
938 return Restrictions
.Set
(No_Dynamic_Accessibility_Checks
);
939 end No_Dynamic_Accessibility_Checks_Enabled
;
941 -------------------------------
942 -- No_Exception_Handlers_Set --
943 -------------------------------
945 function No_Exception_Handlers_Set
return Boolean is
947 return (No_Run_Time_Mode
or else Configurable_Run_Time_Mode
)
948 and then (Restrictions
.Set
(No_Exception_Handlers
)
950 Restrictions
.Set
(No_Exception_Propagation
));
951 end No_Exception_Handlers_Set
;
953 -------------------------------------
954 -- No_Exception_Propagation_Active --
955 -------------------------------------
957 function No_Exception_Propagation_Active
return Boolean is
959 return (No_Run_Time_Mode
960 or else Configurable_Run_Time_Mode
961 or else Debug_Flag_Dot_G
)
962 and then Restriction_Active
(No_Exception_Propagation
);
963 end No_Exception_Propagation_Active
;
965 --------------------------------
966 -- OK_No_Dependence_Unit_Name --
967 --------------------------------
969 function OK_No_Dependence_Unit_Name
(N
: Node_Id
) return Boolean is
971 if Nkind
(N
) = N_Selected_Component
then
973 OK_No_Dependence_Unit_Name
(Prefix
(N
))
975 OK_No_Dependence_Unit_Name
(Selector_Name
(N
));
977 elsif Nkind
(N
) = N_Identifier
then
981 Error_Msg_N
("wrong form for unit name for No_Dependence", N
);
984 end OK_No_Dependence_Unit_Name
;
986 ------------------------------
987 -- OK_No_Use_Of_Entity_Name --
988 ------------------------------
990 function OK_No_Use_Of_Entity_Name
(N
: Node_Id
) return Boolean is
992 if Nkind
(N
) = N_Selected_Component
then
994 OK_No_Use_Of_Entity_Name
(Prefix
(N
))
996 OK_No_Use_Of_Entity_Name
(Selector_Name
(N
));
998 elsif Nkind
(N
) in N_Identifier | N_Operator_Symbol
then
1002 Error_Msg_N
("wrong form for entity name for No_Use_Of_Entity", N
);
1005 end OK_No_Use_Of_Entity_Name
;
1007 ----------------------------------
1008 -- Process_Restriction_Synonyms --
1009 ----------------------------------
1011 -- Note: body of this function must be coordinated with list of renaming
1012 -- declarations in System.Rident.
1014 function Process_Restriction_Synonyms
(N
: Node_Id
) return Name_Id
is
1015 Old_Name
: constant Name_Id
:= Chars
(N
);
1020 when Name_Boolean_Entry_Barriers
=>
1021 New_Name
:= Name_Simple_Barriers
;
1023 when Name_Max_Entry_Queue_Depth
=>
1024 New_Name
:= Name_Max_Entry_Queue_Length
;
1026 when Name_No_Dynamic_Interrupts
=>
1027 New_Name
:= Name_No_Dynamic_Attachment
;
1029 when Name_No_Requeue
=>
1030 New_Name
:= Name_No_Requeue_Statements
;
1032 when Name_No_Task_Attributes
=>
1033 New_Name
:= Name_No_Task_Attributes_Package
;
1039 -- Output warning if we are warning on obsolescent features.
1041 if Warn_On_Obsolescent_Feature
then
1042 Error_Msg_Name_1
:= Old_Name
;
1043 Error_Msg_N
("restriction identifier % is obsolescent?j?", N
);
1044 Error_Msg_Name_1
:= New_Name
;
1045 Error_Msg_N
("|use restriction identifier % instead?j?", N
);
1049 end Process_Restriction_Synonyms
;
1051 --------------------------------------
1052 -- Reset_Cunit_Boolean_Restrictions --
1053 --------------------------------------
1055 procedure Reset_Cunit_Boolean_Restrictions
is
1057 for J
in Cunit_Boolean_Restrictions
loop
1058 Restrictions
.Set
(J
) := False;
1060 end Reset_Cunit_Boolean_Restrictions
;
1062 -----------------------------------------------
1063 -- Restore_Config_Cunit_Boolean_Restrictions --
1064 -----------------------------------------------
1066 procedure Restore_Config_Cunit_Boolean_Restrictions
is
1068 Cunit_Boolean_Restrictions_Restore
(Config_Cunit_Boolean_Restrictions
);
1069 end Restore_Config_Cunit_Boolean_Restrictions
;
1071 ------------------------
1072 -- Restricted_Profile --
1073 ------------------------
1075 function Restricted_Profile
return Boolean is
1077 if Restricted_Profile_Cached
then
1078 return Restricted_Profile_Result
;
1081 Restricted_Profile_Result
:= True;
1082 Restricted_Profile_Cached
:= True;
1085 R
: Restriction_Flags
renames
1086 Profile_Info
(Restricted_Tasking
).Set
;
1087 V
: Restriction_Values
renames
1088 Profile_Info
(Restricted_Tasking
).Value
;
1090 for J
in R
'Range loop
1092 and then (Restrictions
.Set
(J
) = False
1093 or else Restriction_Warnings
(J
)
1095 (J
in All_Parameter_Restrictions
1096 and then Restrictions
.Value
(J
) > V
(J
)))
1098 Restricted_Profile_Result
:= False;
1103 return Restricted_Profile_Result
;
1106 end Restricted_Profile
;
1108 ------------------------
1109 -- Restriction_Active --
1110 ------------------------
1112 function Restriction_Active
(R
: All_Restrictions
) return Boolean is
1114 return Restrictions
.Set
(R
) and then not Restriction_Warnings
(R
);
1115 end Restriction_Active
;
1117 --------------------------------
1118 -- Restriction_Check_Required --
1119 --------------------------------
1121 function Restriction_Check_Required
(R
: All_Restrictions
) return Boolean is
1123 return Restrictions
.Set
(R
);
1124 end Restriction_Check_Required
;
1126 ---------------------
1127 -- Restriction_Msg --
1128 ---------------------
1130 procedure Restriction_Msg
(R
: Restriction_Id
; N
: Node_Id
) is
1131 Msg
: String (1 .. 100);
1134 procedure Add_Char
(C
: Character);
1135 -- Append given character to Msg, bumping Len
1137 procedure Add_Str
(S
: String);
1138 -- Append given string to Msg, bumping Len appropriately
1140 procedure Id_Case
(S
: String; Quotes
: Boolean := True);
1141 -- Given a string S, case it according to current identifier casing, and
1142 -- store in Error_Msg_String. Then append `~` to the message buffer
1143 -- to output the string unchanged surrounded in quotes. The quotes
1144 -- are suppressed if Quotes = False.
1150 procedure Add_Char
(C
: Character) is
1160 procedure Add_Str
(S
: String) is
1162 Msg
(Len
+ 1 .. Len
+ S
'Length) := S
;
1163 Len
:= Len
+ S
'Length;
1170 procedure Id_Case
(S
: String; Quotes
: Boolean := True) is
1172 Name_Buffer
(1 .. S
'Last) := S
;
1173 Name_Len
:= S
'Length;
1174 Set_Casing
(Identifier_Casing
(Get_Source_File_Index
(Sloc
(N
))));
1175 Error_Msg_Strlen
:= Name_Len
;
1176 Error_Msg_String
(1 .. Name_Len
) := Name_Buffer
(1 .. Name_Len
);
1185 -- Start of processing for Restriction_Msg
1188 -- Set warning message if warning
1190 if Restriction_Warnings
(R
) then
1193 -- If real violation (not warning), then mark it as non-serious unless
1194 -- it is a violation of No_Finalization in which case we leave it as a
1195 -- serious message, since otherwise we get crashes during attempts to
1196 -- expand stuff that is not properly formed due to assumptions made
1197 -- about no finalization being present.
1199 elsif R
/= No_Finalization
then
1203 Error_Msg_Sloc
:= Restrictions_Loc
(R
);
1205 -- Set main message, adding implicit if no source location
1207 if Error_Msg_Sloc
> No_Location
1208 or else Error_Msg_Sloc
= System_Location
1210 Add_Str
("violation of restriction ");
1212 Add_Str
("violation of implicit restriction ");
1213 Error_Msg_Sloc
:= No_Location
;
1216 -- Case of parameterized restriction
1218 if R
in All_Parameter_Restrictions
then
1220 Id_Case
(Restriction_Id
'Image (R
), Quotes
=> False);
1222 Error_Msg_Uint_1
:= UI_From_Int
(Int
(Restrictions
.Value
(R
)));
1224 -- Case of boolean restriction
1227 Id_Case
(Restriction_Id
'Image (R
));
1230 -- Case of no secondary profile continuation message
1232 if Restriction_Profile_Name
(R
) = No_Profile
then
1233 if Error_Msg_Sloc
/= No_Location
then
1238 Error_Msg_N
(Msg
(1 .. Len
), N
);
1240 -- Case of secondary profile continuation message present
1244 Error_Msg_N
(Msg
(1 .. Len
), N
);
1249 -- Set as warning if warning case
1251 if Restriction_Warnings
(R
) then
1257 Add_Str
("from profile ");
1258 Id_Case
(Profile_Name
'Image (Restriction_Profile_Name
(R
)));
1260 -- Add location if we have one
1262 if Error_Msg_Sloc
/= No_Location
then
1266 -- Output unconditional message and we are done
1269 Error_Msg_N
(Msg
(1 .. Len
), N
);
1271 end Restriction_Msg
;
1277 function Same_Entity
(E1
, E2
: Node_Id
) return Boolean is
1279 if Nkind
(E1
) in N_Identifier | N_Operator_Symbol
1281 Nkind
(E2
) in N_Identifier | N_Operator_Symbol
1283 return Chars
(E1
) = Chars
(E2
);
1285 elsif Nkind
(E1
) in N_Selected_Component | N_Expanded_Name
1287 Nkind
(E2
) in N_Selected_Component | N_Expanded_Name
1289 return Same_Unit
(Prefix
(E1
), Prefix
(E2
))
1291 Same_Unit
(Selector_Name
(E1
), Selector_Name
(E2
));
1301 function Same_Unit
(U1
, U2
: Node_Id
) return Boolean is
1303 if Nkind
(U1
) = N_Identifier
and then Nkind
(U2
) = N_Identifier
then
1304 return Chars
(U1
) = Chars
(U2
);
1306 elsif Nkind
(U1
) in N_Selected_Component | N_Expanded_Name
1308 Nkind
(U2
) in N_Selected_Component | N_Expanded_Name
1310 return Same_Unit
(Prefix
(U1
), Prefix
(U2
))
1312 Same_Unit
(Selector_Name
(U1
), Selector_Name
(U2
));
1318 --------------------------------------------
1319 -- Save_Config_Cunit_Boolean_Restrictions --
1320 --------------------------------------------
1322 procedure Save_Config_Cunit_Boolean_Restrictions
is
1324 Config_Cunit_Boolean_Restrictions
:= Cunit_Boolean_Restrictions_Save
;
1325 end Save_Config_Cunit_Boolean_Restrictions
;
1327 ------------------------------
1328 -- Set_Profile_Restrictions --
1329 ------------------------------
1331 procedure Set_Profile_Restrictions
1336 R
: Restriction_Flags
renames Profile_Info
(P
).Set
;
1337 V
: Restriction_Values
renames Profile_Info
(P
).Value
;
1340 for J
in R
'Range loop
1343 Already_Restricted
: constant Boolean := Restriction_Active
(J
);
1346 -- Set the restriction
1348 if J
in All_Boolean_Restrictions
then
1349 Set_Restriction
(J
, N
);
1351 Set_Restriction
(J
, N
, V
(J
));
1354 -- Record that this came from a Profile[_Warnings] restriction
1356 Restriction_Profile_Name
(J
) := P
;
1358 -- Set warning flag, except that we do not set the warning
1359 -- flag if the restriction was already active and this is
1360 -- the warning case. That avoids a warning overriding a real
1361 -- restriction, which should never happen.
1363 if not (Warn
and Already_Restricted
) then
1364 Restriction_Warnings
(J
) := Warn
;
1369 end Set_Profile_Restrictions
;
1371 ---------------------
1372 -- Set_Restriction --
1373 ---------------------
1375 procedure Set_Restriction
1376 (R
: All_Boolean_Restrictions
;
1380 Restrictions
.Set
(R
) := True;
1382 if Restricted_Profile_Cached
and Restricted_Profile_Result
then
1385 Restricted_Profile_Cached
:= False;
1388 -- Set location, but preserve location of system restriction for nice
1389 -- error msg with run time name.
1391 if Restrictions_Loc
(R
) /= System_Location
then
1392 Restrictions_Loc
(R
) := Sloc
(N
);
1395 -- Note restriction came from restriction pragma, not profile
1397 Restriction_Profile_Name
(R
) := No_Profile
;
1399 -- Record the restriction if we are in the main unit, or in the extended
1400 -- main unit. The reason that we test separately for Main_Unit is that
1401 -- gnat.adc is processed with Current_Sem_Unit = Main_Unit, but nodes in
1402 -- gnat.adc do not appear to be in the extended main source unit (they
1403 -- probably should do ???)
1405 if Current_Sem_Unit
= Main_Unit
1406 or else In_Extended_Main_Source_Unit
(N
)
1408 if not Restriction_Warnings
(R
) then
1409 Main_Restrictions
.Set
(R
) := True;
1412 end Set_Restriction
;
1414 procedure Set_Restriction
1415 (R
: All_Parameter_Restrictions
;
1420 if Restricted_Profile_Cached
and Restricted_Profile_Result
then
1423 Restricted_Profile_Cached
:= False;
1426 if Restrictions
.Set
(R
) then
1427 if V
< Restrictions
.Value
(R
) then
1428 Restrictions
.Value
(R
) := V
;
1429 Restrictions_Loc
(R
) := Sloc
(N
);
1433 Restrictions
.Set
(R
) := True;
1434 Restrictions
.Value
(R
) := V
;
1435 Restrictions_Loc
(R
) := Sloc
(N
);
1438 -- Record the restriction if we are in the main unit, or in the extended
1439 -- main unit. The reason that we test separately for Main_Unit is that
1440 -- gnat.adc is processed with Current_Sem_Unit = Main_Unit, but nodes in
1441 -- gnat.adc do not appear to be the extended main source unit (they
1442 -- probably should do ???)
1444 if Current_Sem_Unit
= Main_Unit
1445 or else In_Extended_Main_Source_Unit
(N
)
1447 if Main_Restrictions
.Set
(R
) then
1448 if V
< Main_Restrictions
.Value
(R
) then
1449 Main_Restrictions
.Value
(R
) := V
;
1452 elsif not Restriction_Warnings
(R
) then
1453 Main_Restrictions
.Set
(R
) := True;
1454 Main_Restrictions
.Value
(R
) := V
;
1458 -- Note restriction came from restriction pragma, not profile
1460 Restriction_Profile_Name
(R
) := No_Profile
;
1461 end Set_Restriction
;
1463 procedure Set_Restriction
1464 (R
: All_Restrictions
;
1467 V
: Integer := Integer'First)
1469 Set
: Boolean := True;
1471 if Warn
and then Restriction_Active
(R
) then
1476 if R
in All_Boolean_Restrictions
then
1477 Set_Restriction
(R
, N
);
1479 Set_Restriction
(R
, N
, V
);
1482 Restriction_Warnings
(R
) := Warn
;
1484 end Set_Restriction
;
1486 -----------------------------------
1487 -- Set_Restriction_No_Dependence --
1488 -----------------------------------
1490 procedure Set_Restriction_No_Dependence
1493 Profile
: Profile_Name
:= No_Profile
)
1496 -- Loop to check for duplicate entry
1498 for J
in No_Dependences
.First
.. No_Dependences
.Last
loop
1500 -- Case of entry already in table
1502 if Same_Unit
(Unit
, No_Dependences
.Table
(J
).Unit
) then
1504 -- Error has precedence over warning
1507 No_Dependences
.Table
(J
).Warn
:= False;
1514 -- Entry is not currently in table
1516 No_Dependences
.Append
((Unit
, Warn
, Profile
));
1517 end Set_Restriction_No_Dependence
;
1519 --------------------------------------
1520 -- Set_Restriction_No_Use_Of_Entity --
1521 --------------------------------------
1523 procedure Set_Restriction_No_Use_Of_Entity
1526 Profile
: Profile_Name
:= No_Profile
)
1531 -- Loop to check for duplicate entry
1533 for J
in No_Use_Of_Entity
.First
.. No_Use_Of_Entity
.Last
loop
1535 -- Case of entry already in table
1537 if Same_Entity
(Entity
, No_Use_Of_Entity
.Table
(J
).Entity
) then
1539 -- Error has precedence over warning
1542 No_Use_Of_Entity
.Table
(J
).Warn
:= False;
1549 -- Entry is not currently in table
1551 No_Use_Of_Entity
.Append
((Entity
, Warn
, Profile
));
1553 -- Now we need to find the direct name and set Boolean2 flag
1555 if Nkind
(Entity
) in N_Identifier | N_Operator_Symbol
then
1559 pragma Assert
(Nkind
(Entity
) = N_Selected_Component
);
1560 Nam
:= Selector_Name
(Entity
);
1561 pragma Assert
(Nkind
(Nam
) in N_Identifier | N_Operator_Symbol
);
1564 Set_Name_Table_Boolean2
(Chars
(Nam
), True);
1565 end Set_Restriction_No_Use_Of_Entity
;
1567 ------------------------------------------------
1568 -- Set_Restriction_No_Specification_Of_Aspect --
1569 ------------------------------------------------
1571 procedure Set_Restriction_No_Specification_Of_Aspect
1575 A_Id
: constant Aspect_Id_Exclude_No_Aspect
:= Get_Aspect_Id
(Chars
(N
));
1578 No_Specification_Of_Aspect_Set
:= True;
1579 No_Specification_Of_Aspects
(A_Id
) := Sloc
(N
);
1580 No_Specification_Of_Aspect_Warning
(A_Id
) := Warn
;
1581 end Set_Restriction_No_Specification_Of_Aspect
;
1583 procedure Set_Restriction_No_Specification_Of_Aspect
(A_Id
: Aspect_Id
) is
1585 No_Specification_Of_Aspect_Set
:= True;
1586 No_Specification_Of_Aspects
(A_Id
) := System_Location
;
1587 No_Specification_Of_Aspect_Warning
(A_Id
) := False;
1588 end Set_Restriction_No_Specification_Of_Aspect
;
1590 -----------------------------------------
1591 -- Set_Restriction_No_Use_Of_Attribute --
1592 -----------------------------------------
1594 procedure Set_Restriction_No_Use_Of_Attribute
1598 A_Id
: constant Attribute_Id
:= Get_Attribute_Id
(Chars
(N
));
1601 No_Use_Of_Attribute_Set
:= True;
1602 No_Use_Of_Attribute
(A_Id
) := Sloc
(N
);
1603 No_Use_Of_Attribute_Warning
(A_Id
) := Warn
;
1604 end Set_Restriction_No_Use_Of_Attribute
;
1606 procedure Set_Restriction_No_Use_Of_Attribute
(A_Id
: Attribute_Id
) is
1608 No_Use_Of_Attribute_Set
:= True;
1609 No_Use_Of_Attribute
(A_Id
) := System_Location
;
1610 No_Use_Of_Attribute_Warning
(A_Id
) := False;
1611 end Set_Restriction_No_Use_Of_Attribute
;
1613 --------------------------------------
1614 -- Set_Restriction_No_Use_Of_Pragma --
1615 --------------------------------------
1617 procedure Set_Restriction_No_Use_Of_Pragma
1621 A_Id
: constant Pragma_Id
:= Get_Pragma_Id
(Chars
(N
));
1624 No_Use_Of_Pragma_Set
:= True;
1625 No_Use_Of_Pragma
(A_Id
) := Sloc
(N
);
1626 No_Use_Of_Pragma_Warning
(A_Id
) := Warn
;
1627 end Set_Restriction_No_Use_Of_Pragma
;
1629 procedure Set_Restriction_No_Use_Of_Pragma
(A_Id
: Pragma_Id
) is
1631 No_Use_Of_Pragma_Set
:= True;
1632 No_Use_Of_Pragma
(A_Id
) := System_Location
;
1633 No_Use_Of_Pragma_Warning
(A_Id
) := False;
1634 end Set_Restriction_No_Use_Of_Pragma
;
1636 ---------------------------
1637 -- Set_Global_No_Tasking --
1638 ---------------------------
1640 procedure Set_Global_No_Tasking
is
1642 Global_Restriction_No_Tasking
:= True;
1643 end Set_Global_No_Tasking
;
1645 ----------------------------------
1646 -- Suppress_Restriction_Message --
1647 ----------------------------------
1649 function Suppress_Restriction_Message
(N
: Node_Id
) return Boolean is
1651 -- We only output messages for the extended main source unit
1653 if In_Extended_Main_Source_Unit
(N
) then
1656 -- If loaded by rtsfind, then suppress message
1658 elsif Sloc
(N
) <= No_Location
then
1661 -- Otherwise suppress message if internal file
1664 return In_Internal_Unit
(N
);
1666 end Suppress_Restriction_Message
;
1668 ---------------------
1669 -- Tasking_Allowed --
1670 ---------------------
1672 function Tasking_Allowed
return Boolean is
1674 return not Restrictions
.Set
(No_Tasking
)
1675 and then (not Restrictions
.Set
(Max_Tasks
)
1676 or else Restrictions
.Value
(Max_Tasks
) > 0)
1677 and then not No_Run_Time_Mode
;
1678 end Tasking_Allowed
;