1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
9 -- Copyright (C) 2010-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 defines the aspects that are recognized by GNAT in aspect
27 -- specifications. It also contains the subprograms for storing/retrieving
28 -- aspect specifications from the tree. The semantic processing for aspect
29 -- specifications is found in Sem_Ch13.Analyze_Aspect_Specifications.
31 ------------------------
32 -- Adding New Aspects --
33 ------------------------
35 -- In general, each aspect should have a corresponding pragma or attribute, so
36 -- that the newly developed functionality is available for old Ada versions.
37 -- When both are defined, it is convenient to first transform the aspect into
38 -- an equivalent pragma or attribute in Sem_Ch13.Analyze_Aspect_Specifications
39 -- and then analyze that.
41 -- To add a new aspect, you need to do the following
43 -- 1. Create a name in snames.ads-tmpl
45 -- 2. Create a value in type Aspect_Id in this unit
47 -- 3. Add a value for the aspect in the global arrays defined in this unit
49 -- 4. Add code for the aspect in Sem_Ch13.Analyze_Aspect_Specifications.
50 -- This may involve adding some nodes to the tree to perform additional
53 -- 5. If the semantic analysis of expressions/names in the aspect should not
54 -- occur at the point the aspect is defined, add code in the appropriate
55 -- semantic analysis procedure for the aspect. For example, this is the
56 -- case for aspects Pre and Post on subprograms, which are preanalyzed
57 -- at the end of the declaration list to which the subprogram belongs,
58 -- and fully analyzed (possibly with expansion) during the semantic
59 -- analysis of subprogram bodies.
61 with Namet
; use Namet
;
62 with Snames
; use Snames
;
63 with Types
; use Types
;
67 -- Type defining recognized aspects
70 (No_Aspect
, -- Dummy entry for no aspect
71 Aspect_Abstract_State
, -- GNAT
75 Aspect_Always_Terminates
, -- GNAT
76 Aspect_Annotate
, -- GNAT
77 Aspect_Async_Readers
, -- GNAT
78 Aspect_Async_Writers
, -- GNAT
79 Aspect_Attach_Handler
,
81 Aspect_Component_Size
,
82 Aspect_Constant_After_Elaboration
, -- GNAT
83 Aspect_Constant_Indexing
,
84 Aspect_Contract_Cases
, -- GNAT
87 Aspect_Default_Component_Value
,
88 Aspect_Default_Initial_Condition
, -- GNAT
89 Aspect_Default_Iterator
,
90 Aspect_Default_Storage_Pool
,
92 Aspect_Depends
, -- GNAT
93 Aspect_Designated_Storage_Model
, -- GNAT
94 Aspect_Dimension
, -- GNAT
95 Aspect_Dimension_System
, -- GNAT
96 Aspect_Dispatching_Domain
,
97 Aspect_Dynamic_Predicate
,
98 Aspect_Effective_Reads
, -- GNAT
99 Aspect_Effective_Writes
, -- GNAT
100 Aspect_Exceptional_Cases
, -- GNAT
101 Aspect_Extensions_Visible
, -- GNAT
102 Aspect_External_Name
,
104 Aspect_Ghost
, -- GNAT
105 Aspect_Ghost_Predicate
, -- GNAT
106 Aspect_Global
, -- GNAT
107 Aspect_GNAT_Annotate
, -- GNAT
108 Aspect_Implicit_Dereference
,
109 Aspect_Initial_Condition
, -- GNAT
110 Aspect_Initializes
, -- GNAT
112 Aspect_Integer_Literal
,
113 Aspect_Interrupt_Priority
,
114 Aspect_Invariant
, -- GNAT
115 Aspect_Iterator_Element
,
116 Aspect_Iterable
, -- GNAT
118 Aspect_Linker_Section
, -- GNAT
119 Aspect_Machine_Radix
,
120 Aspect_Max_Entry_Queue_Depth
, -- GNAT
121 Aspect_Max_Entry_Queue_Length
,
122 Aspect_Max_Queue_Length
, -- GNAT
123 Aspect_No_Caching
, -- GNAT
124 Aspect_No_Controlled_Parts
,
125 Aspect_No_Task_Parts
, -- GNAT
126 Aspect_Object_Size
, -- GNAT
127 Aspect_Obsolescent
, -- GNAT
129 Aspect_Part_Of
, -- GNAT
131 Aspect_Postcondition
,
134 Aspect_Predicate
, -- GNAT
135 Aspect_Predicate_Failure
,
140 Aspect_Refined_Depends
, -- GNAT
141 Aspect_Refined_Global
, -- GNAT
142 Aspect_Refined_Post
, -- GNAT
143 Aspect_Refined_State
, -- GNAT
144 Aspect_Relative_Deadline
,
145 Aspect_Relaxed_Initialization
, -- GNAT
146 Aspect_Scalar_Storage_Order
, -- GNAT
147 Aspect_Secondary_Stack_Size
, -- GNAT
148 Aspect_Simple_Storage_Pool
, -- GNAT
151 Aspect_SPARK_Mode
, -- GNAT
152 Aspect_Stable_Properties
,
153 Aspect_Static_Predicate
,
154 Aspect_Storage_Model_Type
, -- GNAT
158 Aspect_String_Literal
,
159 Aspect_Subprogram_Variant
, -- GNAT
161 Aspect_Synchronization
,
162 Aspect_Test_Case
, -- GNAT
163 Aspect_Type_Invariant
,
164 Aspect_Unimplemented
, -- GNAT
166 Aspect_Value_Size
, -- GNAT
167 Aspect_Variable_Indexing
,
168 Aspect_Volatile_Function
, -- GNAT
169 Aspect_Warnings
, -- GNAT
172 -- The following aspects correspond to library unit pragmas
174 Aspect_All_Calls_Remote
,
175 Aspect_Elaborate_Body
,
176 Aspect_No_Elaboration_Code_All
, -- GNAT
179 Aspect_Remote_Call_Interface
,
181 Aspect_Shared_Passive
,
183 -- Remaining aspects have a static boolean value that turns the aspect
184 -- on or off. They all correspond to pragmas, but are only converted to
185 -- the pragmas where the value is True. A value of False normally means
186 -- that the aspect is ignored, except in the case of derived types where
187 -- the aspect value is inherited from the parent, in which case, we do
188 -- not allow False if we inherit a True value from the parent.
192 Aspect_Atomic_Components
,
193 Aspect_Disable_Controlled
, -- GNAT
194 Aspect_Discard_Names
,
195 Aspect_CUDA_Device
, -- GNAT
196 Aspect_CUDA_Global
, -- GNAT
197 Aspect_Exclusive_Functions
,
199 Aspect_Favor_Top_Level
, -- GNAT
200 Aspect_Full_Access_Only
,
202 Aspect_Independent_Components
,
205 Aspect_Inline_Always
, -- GNAT
206 Aspect_Interrupt_Handler
,
207 Aspect_Lock_Free
, -- GNAT
208 Aspect_No_Inline
, -- GNAT
210 Aspect_No_Tagged_Streams
, -- GNAT
212 Aspect_Persistent_BSS
, -- GNAT
213 Aspect_Preelaborable_Initialization
,
214 Aspect_Pure_Function
, -- GNAT
215 Aspect_Remote_Access_Type
, -- GNAT
216 Aspect_Shared
, -- GNAT (equivalent to Atomic)
217 Aspect_Simple_Storage_Pool_Type
, -- GNAT
219 Aspect_Suppress_Debug_Info
, -- GNAT
220 Aspect_Suppress_Initialization
, -- GNAT
221 Aspect_Thread_Local_Storage
, -- GNAT
222 Aspect_Unchecked_Union
,
223 Aspect_Universal_Aliasing
, -- GNAT
224 Aspect_Unmodified
, -- GNAT
225 Aspect_Unreferenced
, -- GNAT
226 Aspect_Unreferenced_Objects
, -- GNAT
228 Aspect_Volatile_Components
,
229 Aspect_Volatile_Full_Access
, -- GNAT
232 subtype Aspect_Id_Exclude_No_Aspect
is
233 Aspect_Id
range Aspect_Id
'Succ (No_Aspect
) .. Aspect_Id
'Last;
234 -- Aspect_Id's excluding No_Aspect
236 subtype Nonoverridable_Aspect_Id
is Aspect_Id
with
237 Static_Predicate
=> Nonoverridable_Aspect_Id
in
238 Aspect_Default_Iterator | Aspect_Iterator_Element |
239 Aspect_Implicit_Dereference | Aspect_Constant_Indexing |
240 Aspect_Variable_Indexing | Aspect_Aggregate |
241 Aspect_Max_Entry_Queue_Length
242 | Aspect_No_Controlled_Parts
243 -- ??? No_Controlled_Parts not yet in Aspect_Id enumeration
244 ; -- see RM 13.1.1(18.7)
246 -- The following array indicates aspects that accept 'Class
248 Class_Aspect_OK
: constant array (Aspect_Id
) of Boolean :=
249 (Aspect_Input
=> True,
250 Aspect_Invariant
=> True,
251 Aspect_Output
=> True,
253 Aspect_Predicate
=> True,
256 Aspect_Write
=> True,
257 Aspect_Stable_Properties
=> True,
258 Aspect_Type_Invariant
=> True,
261 -- The following array identifies all implementation defined aspects
263 Implementation_Defined_Aspect
: constant array (Aspect_Id
) of Boolean :=
264 (Aspect_Abstract_State
=> True,
265 Aspect_Always_Terminates
=> True,
266 Aspect_Annotate
=> True,
267 Aspect_Async_Readers
=> True,
268 Aspect_Async_Writers
=> True,
269 Aspect_Constant_After_Elaboration
=> True,
270 Aspect_Contract_Cases
=> True,
271 Aspect_Depends
=> True,
272 Aspect_Dimension
=> True,
273 Aspect_Dimension_System
=> True,
274 Aspect_Effective_Reads
=> True,
275 Aspect_Effective_Writes
=> True,
276 Aspect_Exceptional_Cases
=> True,
277 Aspect_Extensions_Visible
=> True,
278 Aspect_Favor_Top_Level
=> True,
279 Aspect_Ghost
=> True,
280 Aspect_Ghost_Predicate
=> True,
281 Aspect_Global
=> True,
282 Aspect_GNAT_Annotate
=> True,
283 Aspect_Inline_Always
=> True,
284 Aspect_Invariant
=> True,
285 Aspect_Lock_Free
=> True,
286 Aspect_Max_Entry_Queue_Depth
=> True,
287 Aspect_Max_Entry_Queue_Length
=> True,
288 Aspect_Max_Queue_Length
=> True,
289 Aspect_Object_Size
=> True,
290 Aspect_Persistent_BSS
=> True,
291 Aspect_Predicate
=> True,
292 Aspect_Pure_Function
=> True,
293 Aspect_Relaxed_Initialization
=> True,
294 Aspect_Remote_Access_Type
=> True,
295 Aspect_Scalar_Storage_Order
=> True,
296 Aspect_Secondary_Stack_Size
=> True,
297 Aspect_Shared
=> True,
298 Aspect_Simple_Storage_Pool
=> True,
299 Aspect_Simple_Storage_Pool_Type
=> True,
300 Aspect_Subprogram_Variant
=> True,
301 Aspect_Suppress_Debug_Info
=> True,
302 Aspect_Suppress_Initialization
=> True,
303 Aspect_Thread_Local_Storage
=> True,
304 Aspect_Test_Case
=> True,
305 Aspect_Universal_Aliasing
=> True,
306 Aspect_Unmodified
=> True,
307 Aspect_Unreferenced
=> True,
308 Aspect_Unreferenced_Objects
=> True,
309 Aspect_Value_Size
=> True,
310 Aspect_Volatile_Function
=> True,
311 Aspect_Warnings
=> True,
314 -- The following array indicates aspects that specify operational
315 -- characteristics, and thus are view-specific. Representation
316 -- aspects break privacy, as they are needed during expansion and
318 -- List is currently incomplete ???
320 Operational_Aspect
: constant array (Aspect_Id
) of Boolean :=
321 (Aspect_Constant_Indexing
=> True,
322 Aspect_Default_Iterator
=> True,
323 Aspect_Iterator_Element
=> True,
324 Aspect_Iterable
=> True,
325 Aspect_Variable_Indexing
=> True,
326 Aspect_Aggregate
=> True,
329 -- The following array indicates aspects for which multiple occurrences of
330 -- the same aspect attached to the same declaration are allowed.
332 No_Duplicates_Allowed
: constant array (Aspect_Id
) of Boolean :=
333 (Aspect_Annotate
=> False,
334 Aspect_GNAT_Annotate
=> False,
335 Aspect_Test_Case
=> False,
338 -- The following subtype defines aspects corresponding to library unit
339 -- pragmas, these can only validly appear as aspects for library units,
340 -- and result in a corresponding pragma being inserted immediately after
341 -- the occurrence of the aspect.
343 subtype Library_Unit_Aspects
is
344 Aspect_Id
range Aspect_All_Calls_Remote
.. Aspect_Shared_Passive
;
346 -- The following subtype defines aspects accepting an optional static
347 -- boolean parameter indicating if the aspect should be active or
348 -- cancelling. If the parameter is missing the effective value is True,
349 -- enabling the aspect. If the parameter is present it must be a static
350 -- expression of type Standard.Boolean. If the value is True, then the
351 -- aspect is enabled. If it is False, the aspect is disabled.
353 subtype Boolean_Aspects
is
354 Aspect_Id
range Aspect_Asynchronous
.. Aspect_Id
'Last;
356 subtype Pre_Post_Aspects
is
357 Aspect_Id
range Aspect_Post
.. Aspect_Precondition
;
359 -- The following type is used for indicating allowed expression forms
361 type Aspect_Expression
is
362 (Expression
, -- Required expression
363 Name
, -- Required name
364 Optional_Expression
, -- Optional boolean expression
365 Optional_Name
); -- Optional name
367 -- The following array indicates what argument type is required
369 Aspect_Argument
: constant array (Aspect_Id
) of Aspect_Expression
:=
370 (No_Aspect
=> Optional_Expression
,
371 Aspect_Abstract_State
=> Expression
,
372 Aspect_Address
=> Expression
,
373 Aspect_Aggregate
=> Expression
,
374 Aspect_Alignment
=> Expression
,
375 Aspect_Always_Terminates
=> Optional_Expression
,
376 Aspect_Annotate
=> Expression
,
377 Aspect_Async_Readers
=> Optional_Expression
,
378 Aspect_Async_Writers
=> Optional_Expression
,
379 Aspect_Attach_Handler
=> Expression
,
380 Aspect_Bit_Order
=> Expression
,
381 Aspect_Component_Size
=> Expression
,
382 Aspect_Constant_After_Elaboration
=> Optional_Expression
,
383 Aspect_Constant_Indexing
=> Name
,
384 Aspect_Contract_Cases
=> Expression
,
385 Aspect_Convention
=> Name
,
386 Aspect_CPU
=> Expression
,
387 Aspect_Default_Component_Value
=> Expression
,
388 Aspect_Default_Initial_Condition
=> Optional_Expression
,
389 Aspect_Default_Iterator
=> Name
,
390 Aspect_Default_Storage_Pool
=> Expression
,
391 Aspect_Default_Value
=> Expression
,
392 Aspect_Depends
=> Expression
,
393 Aspect_Designated_Storage_Model
=> Name
,
394 Aspect_Dimension
=> Expression
,
395 Aspect_Dimension_System
=> Expression
,
396 Aspect_Dispatching_Domain
=> Expression
,
397 Aspect_Dynamic_Predicate
=> Expression
,
398 Aspect_Effective_Reads
=> Optional_Expression
,
399 Aspect_Effective_Writes
=> Optional_Expression
,
400 Aspect_Exceptional_Cases
=> Expression
,
401 Aspect_Extensions_Visible
=> Optional_Expression
,
402 Aspect_External_Name
=> Expression
,
403 Aspect_External_Tag
=> Expression
,
404 Aspect_Ghost
=> Optional_Expression
,
405 Aspect_Ghost_Predicate
=> Expression
,
406 Aspect_Global
=> Expression
,
407 Aspect_GNAT_Annotate
=> Expression
,
408 Aspect_Implicit_Dereference
=> Name
,
409 Aspect_Initial_Condition
=> Expression
,
410 Aspect_Initializes
=> Expression
,
411 Aspect_Input
=> Name
,
412 Aspect_Integer_Literal
=> Name
,
413 Aspect_Interrupt_Priority
=> Expression
,
414 Aspect_Invariant
=> Expression
,
415 Aspect_Iterable
=> Expression
,
416 Aspect_Iterator_Element
=> Name
,
417 Aspect_Link_Name
=> Expression
,
418 Aspect_Linker_Section
=> Expression
,
419 Aspect_Machine_Radix
=> Expression
,
420 Aspect_Max_Entry_Queue_Depth
=> Expression
,
421 Aspect_Max_Entry_Queue_Length
=> Expression
,
422 Aspect_Max_Queue_Length
=> Expression
,
423 Aspect_No_Caching
=> Optional_Expression
,
424 Aspect_No_Controlled_Parts
=> Optional_Expression
,
425 Aspect_No_Task_Parts
=> Optional_Expression
,
426 Aspect_Object_Size
=> Expression
,
427 Aspect_Obsolescent
=> Optional_Expression
,
428 Aspect_Output
=> Name
,
429 Aspect_Part_Of
=> Expression
,
430 Aspect_Post
=> Expression
,
431 Aspect_Postcondition
=> Expression
,
432 Aspect_Pre
=> Expression
,
433 Aspect_Precondition
=> Expression
,
434 Aspect_Predicate
=> Expression
,
435 Aspect_Predicate_Failure
=> Expression
,
436 Aspect_Priority
=> Expression
,
437 Aspect_Put_Image
=> Name
,
439 Aspect_Real_Literal
=> Name
,
440 Aspect_Refined_Depends
=> Expression
,
441 Aspect_Refined_Global
=> Expression
,
442 Aspect_Refined_Post
=> Expression
,
443 Aspect_Refined_State
=> Expression
,
444 Aspect_Relative_Deadline
=> Expression
,
445 Aspect_Relaxed_Initialization
=> Optional_Expression
,
446 Aspect_Scalar_Storage_Order
=> Expression
,
447 Aspect_Secondary_Stack_Size
=> Expression
,
448 Aspect_Simple_Storage_Pool
=> Name
,
449 Aspect_Size
=> Expression
,
450 Aspect_Small
=> Expression
,
451 Aspect_SPARK_Mode
=> Optional_Name
,
452 Aspect_Stable_Properties
=> Expression
,
453 Aspect_Static_Predicate
=> Expression
,
454 Aspect_Storage_Model_Type
=> Optional_Expression
,
455 Aspect_Storage_Pool
=> Name
,
456 Aspect_Storage_Size
=> Expression
,
457 Aspect_Stream_Size
=> Expression
,
458 Aspect_String_Literal
=> Name
,
459 Aspect_Subprogram_Variant
=> Expression
,
460 Aspect_Suppress
=> Name
,
461 Aspect_Synchronization
=> Name
,
462 Aspect_Test_Case
=> Expression
,
463 Aspect_Type_Invariant
=> Expression
,
464 Aspect_Unimplemented
=> Optional_Expression
,
465 Aspect_Unsuppress
=> Name
,
466 Aspect_Value_Size
=> Expression
,
467 Aspect_Variable_Indexing
=> Name
,
468 Aspect_Volatile_Function
=> Optional_Expression
,
469 Aspect_Warnings
=> Name
,
470 Aspect_Write
=> Name
,
472 Boolean_Aspects
=> Optional_Expression
,
473 Library_Unit_Aspects
=> Optional_Expression
);
475 -- The following array indicates what aspects are representation aspects
477 Is_Representation_Aspect
: constant array (Aspect_Id
) of Boolean :=
479 Aspect_Abstract_State
=> False,
480 Aspect_Address
=> True,
481 Aspect_Aggregate
=> False,
482 Aspect_Alignment
=> True,
483 Aspect_Always_Terminates
=> False,
484 Aspect_Annotate
=> False,
485 Aspect_Async_Readers
=> False,
486 Aspect_Async_Writers
=> False,
487 Aspect_Attach_Handler
=> False,
488 Aspect_Bit_Order
=> True,
489 Aspect_Component_Size
=> True,
490 Aspect_Constant_After_Elaboration
=> False,
491 Aspect_Constant_Indexing
=> False,
492 Aspect_Contract_Cases
=> False,
493 Aspect_Convention
=> True,
495 Aspect_CUDA_Device
=> False,
496 Aspect_CUDA_Global
=> False,
497 Aspect_Default_Component_Value
=> True,
498 Aspect_Default_Initial_Condition
=> False,
499 Aspect_Default_Iterator
=> False,
500 Aspect_Default_Storage_Pool
=> True,
501 Aspect_Default_Value
=> True,
502 Aspect_Depends
=> False,
503 Aspect_Designated_Storage_Model
=> True,
504 Aspect_Dimension
=> False,
505 Aspect_Dimension_System
=> False,
506 Aspect_Dispatching_Domain
=> False,
507 Aspect_Dynamic_Predicate
=> False,
508 Aspect_Effective_Reads
=> False,
509 Aspect_Effective_Writes
=> False,
510 Aspect_Exceptional_Cases
=> False,
511 Aspect_Exclusive_Functions
=> False,
512 Aspect_Extensions_Visible
=> False,
513 Aspect_External_Name
=> False,
514 Aspect_External_Tag
=> False,
515 Aspect_Ghost
=> False,
516 Aspect_Ghost_Predicate
=> False,
517 Aspect_Global
=> False,
518 Aspect_GNAT_Annotate
=> False,
519 Aspect_Implicit_Dereference
=> False,
520 Aspect_Initial_Condition
=> False,
521 Aspect_Initializes
=> False,
522 Aspect_Input
=> False,
523 Aspect_Integer_Literal
=> False,
524 Aspect_Interrupt_Priority
=> False,
525 Aspect_Invariant
=> False,
526 Aspect_Iterable
=> False,
527 Aspect_Iterator_Element
=> False,
528 Aspect_Link_Name
=> True,
529 Aspect_Linker_Section
=> True,
530 Aspect_Machine_Radix
=> True,
531 Aspect_Max_Entry_Queue_Depth
=> False,
532 Aspect_Max_Entry_Queue_Length
=> False,
533 Aspect_Max_Queue_Length
=> False,
534 Aspect_No_Caching
=> False,
535 Aspect_No_Controlled_Parts
=> False,
536 Aspect_No_Task_Parts
=> False,
537 Aspect_Object_Size
=> True,
538 Aspect_Obsolescent
=> False,
539 Aspect_Output
=> False,
540 Aspect_Part_Of
=> False,
541 Aspect_Post
=> False,
542 Aspect_Postcondition
=> False,
544 Aspect_Precondition
=> False,
545 Aspect_Predicate
=> False,
546 Aspect_Predicate_Failure
=> False,
547 Aspect_Priority
=> False,
548 Aspect_Put_Image
=> False,
549 Aspect_Read
=> False,
550 Aspect_Real_Literal
=> False,
551 Aspect_Refined_Depends
=> False,
552 Aspect_Refined_Global
=> False,
553 Aspect_Refined_Post
=> False,
554 Aspect_Refined_State
=> False,
555 Aspect_Relative_Deadline
=> False,
556 Aspect_Relaxed_Initialization
=> False,
557 Aspect_Scalar_Storage_Order
=> True,
558 Aspect_Secondary_Stack_Size
=> True,
559 Aspect_Simple_Storage_Pool
=> True,
561 Aspect_Small
=> True,
562 Aspect_SPARK_Mode
=> False,
563 Aspect_Stable_Properties
=> False,
564 Aspect_Static_Predicate
=> False,
565 Aspect_Storage_Model_Type
=> False,
566 Aspect_Storage_Pool
=> True,
567 Aspect_Storage_Size
=> True,
568 Aspect_Stream_Size
=> True,
569 Aspect_String_Literal
=> False,
570 Aspect_Subprogram_Variant
=> False,
571 Aspect_Suppress
=> False,
572 Aspect_Synchronization
=> False,
573 Aspect_Test_Case
=> False,
574 Aspect_Type_Invariant
=> False,
575 Aspect_Unimplemented
=> False,
576 Aspect_Unsuppress
=> False,
577 Aspect_Value_Size
=> True,
578 Aspect_Variable_Indexing
=> False,
579 Aspect_Volatile_Function
=> False,
580 Aspect_Warnings
=> False,
581 Aspect_Write
=> False,
583 Library_Unit_Aspects
=> False,
585 Aspect_Asynchronous
=> True,
586 Aspect_Atomic
=> True,
587 Aspect_Atomic_Components
=> True,
588 Aspect_Disable_Controlled
=> False,
589 Aspect_Discard_Names
=> True,
590 Aspect_Export
=> True,
591 Aspect_Favor_Top_Level
=> False,
592 Aspect_Full_Access_Only
=> True,
593 Aspect_Independent
=> True,
594 Aspect_Independent_Components
=> True,
595 Aspect_Import
=> True,
596 Aspect_Inline
=> False,
597 Aspect_Inline_Always
=> False,
598 Aspect_Interrupt_Handler
=> False,
599 Aspect_Lock_Free
=> False,
600 Aspect_No_Inline
=> False,
601 Aspect_No_Return
=> False,
602 Aspect_No_Tagged_Streams
=> False,
604 Aspect_Persistent_BSS
=> True,
605 Aspect_Preelaborable_Initialization
=> False,
606 Aspect_Pure_Function
=> False,
607 Aspect_Remote_Access_Type
=> False,
608 Aspect_Shared
=> True,
609 Aspect_Simple_Storage_Pool_Type
=> True,
610 Aspect_Static
=> False,
611 Aspect_Suppress_Debug_Info
=> False,
612 Aspect_Suppress_Initialization
=> False,
613 Aspect_Thread_Local_Storage
=> True,
614 Aspect_Unchecked_Union
=> True,
615 Aspect_Universal_Aliasing
=> False,
616 Aspect_Unmodified
=> False,
617 Aspect_Unreferenced
=> False,
618 Aspect_Unreferenced_Objects
=> False,
619 Aspect_Volatile
=> True,
620 Aspect_Volatile_Components
=> True,
621 Aspect_Volatile_Full_Access
=> True,
622 Aspect_Yield
=> False);
624 -----------------------------------------
625 -- Table Linking Names and Aspect_Id's --
626 -----------------------------------------
628 -- Table linking aspect names and id's
630 Aspect_Names
: constant array (Aspect_Id
) of Name_Id
:=
631 (No_Aspect
=> No_Name
,
632 Aspect_Abstract_State
=> Name_Abstract_State
,
633 Aspect_Address
=> Name_Address
,
634 Aspect_Aggregate
=> Name_Aggregate
,
635 Aspect_Alignment
=> Name_Alignment
,
636 Aspect_All_Calls_Remote
=> Name_All_Calls_Remote
,
637 Aspect_Always_Terminates
=> Name_Always_Terminates
,
638 Aspect_Annotate
=> Name_Annotate
,
639 Aspect_Async_Readers
=> Name_Async_Readers
,
640 Aspect_Async_Writers
=> Name_Async_Writers
,
641 Aspect_Asynchronous
=> Name_Asynchronous
,
642 Aspect_Atomic
=> Name_Atomic
,
643 Aspect_Atomic_Components
=> Name_Atomic_Components
,
644 Aspect_Attach_Handler
=> Name_Attach_Handler
,
645 Aspect_Bit_Order
=> Name_Bit_Order
,
646 Aspect_Component_Size
=> Name_Component_Size
,
647 Aspect_Constant_After_Elaboration
=> Name_Constant_After_Elaboration
,
648 Aspect_Constant_Indexing
=> Name_Constant_Indexing
,
649 Aspect_Contract_Cases
=> Name_Contract_Cases
,
650 Aspect_Convention
=> Name_Convention
,
651 Aspect_CPU
=> Name_CPU
,
652 Aspect_CUDA_Device
=> Name_CUDA_Device
,
653 Aspect_CUDA_Global
=> Name_CUDA_Global
,
654 Aspect_Default_Component_Value
=> Name_Default_Component_Value
,
655 Aspect_Default_Initial_Condition
=> Name_Default_Initial_Condition
,
656 Aspect_Default_Iterator
=> Name_Default_Iterator
,
657 Aspect_Default_Storage_Pool
=> Name_Default_Storage_Pool
,
658 Aspect_Default_Value
=> Name_Default_Value
,
659 Aspect_Depends
=> Name_Depends
,
660 Aspect_Designated_Storage_Model
=> Name_Designated_Storage_Model
,
661 Aspect_Dimension
=> Name_Dimension
,
662 Aspect_Dimension_System
=> Name_Dimension_System
,
663 Aspect_Disable_Controlled
=> Name_Disable_Controlled
,
664 Aspect_Discard_Names
=> Name_Discard_Names
,
665 Aspect_Dispatching_Domain
=> Name_Dispatching_Domain
,
666 Aspect_Dynamic_Predicate
=> Name_Dynamic_Predicate
,
667 Aspect_Effective_Reads
=> Name_Effective_Reads
,
668 Aspect_Effective_Writes
=> Name_Effective_Writes
,
669 Aspect_Elaborate_Body
=> Name_Elaborate_Body
,
670 Aspect_Exceptional_Cases
=> Name_Exceptional_Cases
,
671 Aspect_Exclusive_Functions
=> Name_Exclusive_Functions
,
672 Aspect_Export
=> Name_Export
,
673 Aspect_Extensions_Visible
=> Name_Extensions_Visible
,
674 Aspect_External_Name
=> Name_External_Name
,
675 Aspect_External_Tag
=> Name_External_Tag
,
676 Aspect_Favor_Top_Level
=> Name_Favor_Top_Level
,
677 Aspect_Full_Access_Only
=> Name_Full_Access_Only
,
678 Aspect_Ghost
=> Name_Ghost
,
679 Aspect_Ghost_Predicate
=> Name_Ghost_Predicate
,
680 Aspect_Global
=> Name_Global
,
681 Aspect_GNAT_Annotate
=> Name_GNAT_Annotate
,
682 Aspect_Implicit_Dereference
=> Name_Implicit_Dereference
,
683 Aspect_Import
=> Name_Import
,
684 Aspect_Independent
=> Name_Independent
,
685 Aspect_Independent_Components
=> Name_Independent_Components
,
686 Aspect_Inline
=> Name_Inline
,
687 Aspect_Inline_Always
=> Name_Inline_Always
,
688 Aspect_Initial_Condition
=> Name_Initial_Condition
,
689 Aspect_Initializes
=> Name_Initializes
,
690 Aspect_Input
=> Name_Input
,
691 Aspect_Integer_Literal
=> Name_Integer_Literal
,
692 Aspect_Interrupt_Handler
=> Name_Interrupt_Handler
,
693 Aspect_Interrupt_Priority
=> Name_Interrupt_Priority
,
694 Aspect_Invariant
=> Name_Invariant
,
695 Aspect_Iterator_Element
=> Name_Iterator_Element
,
696 Aspect_Iterable
=> Name_Iterable
,
697 Aspect_Link_Name
=> Name_Link_Name
,
698 Aspect_Linker_Section
=> Name_Linker_Section
,
699 Aspect_Lock_Free
=> Name_Lock_Free
,
700 Aspect_Machine_Radix
=> Name_Machine_Radix
,
701 Aspect_Max_Entry_Queue_Depth
=> Name_Max_Entry_Queue_Depth
,
702 Aspect_Max_Entry_Queue_Length
=> Name_Max_Entry_Queue_Length
,
703 Aspect_Max_Queue_Length
=> Name_Max_Queue_Length
,
704 Aspect_No_Caching
=> Name_No_Caching
,
705 Aspect_No_Controlled_Parts
=> Name_No_Controlled_Parts
,
706 Aspect_No_Task_Parts
=> Name_No_Task_Parts
,
707 Aspect_No_Elaboration_Code_All
=> Name_No_Elaboration_Code_All
,
708 Aspect_No_Inline
=> Name_No_Inline
,
709 Aspect_No_Return
=> Name_No_Return
,
710 Aspect_No_Tagged_Streams
=> Name_No_Tagged_Streams
,
711 Aspect_Object_Size
=> Name_Object_Size
,
712 Aspect_Obsolescent
=> Name_Obsolescent
,
713 Aspect_Output
=> Name_Output
,
714 Aspect_Pack
=> Name_Pack
,
715 Aspect_Part_Of
=> Name_Part_Of
,
716 Aspect_Persistent_BSS
=> Name_Persistent_BSS
,
717 Aspect_Post
=> Name_Post
,
718 Aspect_Postcondition
=> Name_Postcondition
,
719 Aspect_Pre
=> Name_Pre
,
720 Aspect_Precondition
=> Name_Precondition
,
721 Aspect_Predicate
=> Name_Predicate
,
722 Aspect_Predicate_Failure
=> Name_Predicate_Failure
,
723 Aspect_Preelaborable_Initialization
=> Name_Preelaborable_Initialization
,
724 Aspect_Preelaborate
=> Name_Preelaborate
,
725 Aspect_Priority
=> Name_Priority
,
726 Aspect_Pure
=> Name_Pure
,
727 Aspect_Pure_Function
=> Name_Pure_Function
,
728 Aspect_Put_Image
=> Name_Put_Image
,
729 Aspect_Read
=> Name_Read
,
730 Aspect_Real_Literal
=> Name_Real_Literal
,
731 Aspect_Refined_Depends
=> Name_Refined_Depends
,
732 Aspect_Refined_Global
=> Name_Refined_Global
,
733 Aspect_Refined_Post
=> Name_Refined_Post
,
734 Aspect_Refined_State
=> Name_Refined_State
,
735 Aspect_Relative_Deadline
=> Name_Relative_Deadline
,
736 Aspect_Relaxed_Initialization
=> Name_Relaxed_Initialization
,
737 Aspect_Remote_Access_Type
=> Name_Remote_Access_Type
,
738 Aspect_Remote_Call_Interface
=> Name_Remote_Call_Interface
,
739 Aspect_Remote_Types
=> Name_Remote_Types
,
740 Aspect_Scalar_Storage_Order
=> Name_Scalar_Storage_Order
,
741 Aspect_Secondary_Stack_Size
=> Name_Secondary_Stack_Size
,
742 Aspect_Shared
=> Name_Shared
,
743 Aspect_Shared_Passive
=> Name_Shared_Passive
,
744 Aspect_Simple_Storage_Pool
=> Name_Simple_Storage_Pool
,
745 Aspect_Simple_Storage_Pool_Type
=> Name_Simple_Storage_Pool_Type
,
746 Aspect_Size
=> Name_Size
,
747 Aspect_Small
=> Name_Small
,
748 Aspect_SPARK_Mode
=> Name_SPARK_Mode
,
749 Aspect_Stable_Properties
=> Name_Stable_Properties
,
750 Aspect_Static
=> Name_Static
,
751 Aspect_Static_Predicate
=> Name_Static_Predicate
,
752 Aspect_Storage_Model_Type
=> Name_Storage_Model_Type
,
753 Aspect_Storage_Pool
=> Name_Storage_Pool
,
754 Aspect_Storage_Size
=> Name_Storage_Size
,
755 Aspect_Stream_Size
=> Name_Stream_Size
,
756 Aspect_String_Literal
=> Name_String_Literal
,
757 Aspect_Subprogram_Variant
=> Name_Subprogram_Variant
,
758 Aspect_Suppress
=> Name_Suppress
,
759 Aspect_Suppress_Debug_Info
=> Name_Suppress_Debug_Info
,
760 Aspect_Suppress_Initialization
=> Name_Suppress_Initialization
,
761 Aspect_Thread_Local_Storage
=> Name_Thread_Local_Storage
,
762 Aspect_Synchronization
=> Name_Synchronization
,
763 Aspect_Test_Case
=> Name_Test_Case
,
764 Aspect_Type_Invariant
=> Name_Type_Invariant
,
765 Aspect_Unchecked_Union
=> Name_Unchecked_Union
,
766 Aspect_Unimplemented
=> Name_Unimplemented
,
767 Aspect_Universal_Aliasing
=> Name_Universal_Aliasing
,
768 Aspect_Unmodified
=> Name_Unmodified
,
769 Aspect_Unreferenced
=> Name_Unreferenced
,
770 Aspect_Unreferenced_Objects
=> Name_Unreferenced_Objects
,
771 Aspect_Unsuppress
=> Name_Unsuppress
,
772 Aspect_Value_Size
=> Name_Value_Size
,
773 Aspect_Variable_Indexing
=> Name_Variable_Indexing
,
774 Aspect_Volatile
=> Name_Volatile
,
775 Aspect_Volatile_Components
=> Name_Volatile_Components
,
776 Aspect_Volatile_Full_Access
=> Name_Volatile_Full_Access
,
777 Aspect_Volatile_Function
=> Name_Volatile_Function
,
778 Aspect_Warnings
=> Name_Warnings
,
779 Aspect_Write
=> Name_Write
,
780 Aspect_Yield
=> Name_Yield
);
782 function Get_Aspect_Id
(Name
: Name_Id
) return Aspect_Id
;
783 pragma Inline
(Get_Aspect_Id
);
784 -- Given a name Nam, returns the corresponding aspect id value. If the name
785 -- does not match any aspect, then No_Aspect is returned as the result.
787 function Get_Aspect_Id
(Aspect
: Node_Id
) return Aspect_Id
;
788 pragma Inline
(Get_Aspect_Id
);
789 -- Given an aspect specification, return the corresponding aspect_id value.
790 -- If the name does not match any aspect, return No_Aspect.
792 function Is_Aspect_Id
(Aspect
: Name_Id
) return Boolean;
793 pragma Inline
(Is_Aspect_Id
);
794 -- Return True if a corresponding aspect id exists
796 function Is_Aspect_Id
(Aspect
: Node_Id
) return Boolean;
797 pragma Inline
(Is_Aspect_Id
);
798 -- Return True if a corresponding aspect id exists
800 ------------------------------------
801 -- Delaying Evaluation of Aspects --
802 ------------------------------------
804 -- The RM requires that all language defined aspects taking an expression
805 -- delay evaluation of the expression till the freeze point of the entity
806 -- to which the aspect applies. This allows forward references, and is of
807 -- use for example in connection with preconditions and postconditions
808 -- where the requirement of making all references in contracts to local
809 -- functions be backwards references would be onerous.
811 -- For consistency, even attributes like Size are delayed, so we can do:
813 -- type A is range 1 .. 10
814 -- with Size => Not_Defined_Yet;
816 -- Not_Defined_Yet : constant := 64;
818 -- Resulting in A having a size of 64, which gets set when A is frozen.
819 -- Furthermore, we can have a situation like
821 -- type A is range 1 .. 10
822 -- with Size => Not_Defined_Yet;
826 -- Not_Defined_Yet : constant := 64;
828 -- where the Size of A is considered to have been previously specified at
829 -- the point of derivation, even though the actual value of the size is
830 -- not known yet, and in this example B inherits the size value of 64.
832 -- Our normal implementation model (prior to Ada 2012) was simply to copy
833 -- inheritable attributes at the point of derivation. Then any subsequent
834 -- representation items apply either to the parent type, not affecting the
835 -- derived type, or to the derived type, not affecting the parent type.
837 -- To deal with the delayed aspect case, we use two flags. The first is
838 -- set on the parent type if it has delayed representation aspects. This
839 -- flag Has_Delayed_Rep_Aspects indicates that if we derive from this type
840 -- we have to worry about making sure we inherit any delayed aspects. The
841 -- second flag is set on a derived type: May_Inherit_Delayed_Rep_Aspects
842 -- is set if the parent type has Has_Delayed_Rep_Aspects set.
844 -- When we freeze a derived type, if the May_Inherit_Delayed_Rep_Aspects
845 -- flag is set, then we call Sem_Ch13.Inherit_Delayed_Rep_Aspects when
846 -- the derived type is frozen, which deals with the necessary copying of
847 -- information from the parent type, which must be frozen at that point
848 -- (since freezing the derived type first freezes the parent type).
850 -- SPARK 2014 aspects do not follow the general delay mechanism as they
851 -- act as annotations and cannot modify the attributes of their related
852 -- constructs. To handle forward references in such aspects, the compiler
853 -- delays the analysis of their respective pragmas by collecting them in
854 -- N_Contract nodes. The pragmas are then analyzed at the end of the
855 -- declarative region containing the related construct. For details,
856 -- see routines Analyze_xxx_In_Decl_Part.
858 -- The following shows which aspects are delayed. There are three cases:
862 -- This aspect is not a representation aspect that can be inherited and
863 -- is always delayed, as required by the language definition.
866 -- There are two cases. There are language defined aspects like
867 -- Convention where the "expression" is simply an uninterpreted
868 -- identifier, and there is no issue of evaluating it and thus no
869 -- issue of delaying the evaluation. The second case is implementation
870 -- defined aspects where we have decided that we don't want to allow
871 -- delays (and for our own aspects we can do what we like).
874 -- These are the cases of representation aspects that are in general
875 -- delayed, and where there is a potential issue of derived types that
876 -- inherit delayed representation values.
878 -- Note: even if this table indicates that an aspect is delayed, we never
879 -- delay Boolean aspects that have a missing expression (taken as True),
880 -- or expressions for delayed rep items that consist of an integer literal
881 -- (most cases of Size etc. in practice), since in these cases we know we
882 -- can get the value of the expression without delay. Note that we still
883 -- need to delay Boolean aspects that are specifically set to True:
885 -- type R is array (0 .. 31) of Boolean
886 -- with Pack => True;
887 -- True : constant Boolean := False;
889 -- This is nonsense, but we need to make it work and result in R not
890 -- being packed, and if we have something like:
892 -- type R is array (0 .. 31) of Boolean
893 -- with Pack => True;
895 -- True : constant Boolean := False;
897 -- This is illegal because the visibility of True changes after the freeze
898 -- point, which is not allowed, and we need the delay mechanism to properly
899 -- diagnose this error.
901 Aspect_Delay
: constant array (Aspect_Id
) of Delay_Type
:=
902 (No_Aspect
=> Always_Delay
,
903 Aspect_Address
=> Always_Delay
,
904 Aspect_Aggregate
=> Always_Delay
,
905 Aspect_All_Calls_Remote
=> Always_Delay
,
906 Aspect_Asynchronous
=> Always_Delay
,
907 Aspect_Attach_Handler
=> Always_Delay
,
908 Aspect_Constant_Indexing
=> Always_Delay
,
909 Aspect_CPU
=> Always_Delay
,
910 Aspect_CUDA_Device
=> Always_Delay
,
911 Aspect_CUDA_Global
=> Always_Delay
,
912 Aspect_Default_Iterator
=> Always_Delay
,
913 Aspect_Default_Storage_Pool
=> Always_Delay
,
914 Aspect_Default_Value
=> Always_Delay
,
915 Aspect_Default_Component_Value
=> Always_Delay
,
916 Aspect_Designated_Storage_Model
=> Always_Delay
,
917 Aspect_Discard_Names
=> Always_Delay
,
918 Aspect_Dispatching_Domain
=> Always_Delay
,
919 Aspect_Dynamic_Predicate
=> Always_Delay
,
920 Aspect_Elaborate_Body
=> Always_Delay
,
921 Aspect_Exclusive_Functions
=> Always_Delay
,
922 Aspect_External_Name
=> Always_Delay
,
923 Aspect_External_Tag
=> Always_Delay
,
924 Aspect_Favor_Top_Level
=> Always_Delay
,
925 Aspect_Ghost_Predicate
=> Always_Delay
,
926 Aspect_Implicit_Dereference
=> Always_Delay
,
927 Aspect_Independent
=> Always_Delay
,
928 Aspect_Independent_Components
=> Always_Delay
,
929 Aspect_Inline
=> Always_Delay
,
930 Aspect_Inline_Always
=> Always_Delay
,
931 Aspect_Input
=> Always_Delay
,
932 Aspect_Integer_Literal
=> Always_Delay
,
933 Aspect_Interrupt_Handler
=> Always_Delay
,
934 Aspect_Interrupt_Priority
=> Always_Delay
,
935 Aspect_Invariant
=> Always_Delay
,
936 Aspect_Iterable
=> Always_Delay
,
937 Aspect_Iterator_Element
=> Always_Delay
,
938 Aspect_Link_Name
=> Always_Delay
,
939 Aspect_Linker_Section
=> Always_Delay
,
940 Aspect_Lock_Free
=> Always_Delay
,
941 Aspect_No_Inline
=> Always_Delay
,
942 Aspect_No_Return
=> Always_Delay
,
943 Aspect_Output
=> Always_Delay
,
944 Aspect_Persistent_BSS
=> Always_Delay
,
945 Aspect_Post
=> Always_Delay
,
946 Aspect_Postcondition
=> Always_Delay
,
947 Aspect_Pre
=> Always_Delay
,
948 Aspect_Precondition
=> Always_Delay
,
949 Aspect_Predicate
=> Always_Delay
,
950 Aspect_Predicate_Failure
=> Always_Delay
,
951 Aspect_Preelaborable_Initialization
=> Always_Delay
,
952 Aspect_Preelaborate
=> Always_Delay
,
953 Aspect_Priority
=> Always_Delay
,
954 Aspect_Pure
=> Always_Delay
,
955 Aspect_Pure_Function
=> Always_Delay
,
956 Aspect_Put_Image
=> Always_Delay
,
957 Aspect_Read
=> Always_Delay
,
958 Aspect_Real_Literal
=> Always_Delay
,
959 Aspect_Relative_Deadline
=> Always_Delay
,
960 Aspect_Remote_Access_Type
=> Always_Delay
,
961 Aspect_Remote_Call_Interface
=> Always_Delay
,
962 Aspect_Remote_Types
=> Always_Delay
,
963 Aspect_Secondary_Stack_Size
=> Always_Delay
,
964 Aspect_Shared
=> Always_Delay
,
965 Aspect_Shared_Passive
=> Always_Delay
,
966 Aspect_Simple_Storage_Pool
=> Always_Delay
,
967 Aspect_Simple_Storage_Pool_Type
=> Always_Delay
,
968 Aspect_Static_Predicate
=> Always_Delay
,
969 Aspect_Storage_Model_Type
=> Always_Delay
,
970 Aspect_Storage_Pool
=> Always_Delay
,
971 Aspect_Stream_Size
=> Always_Delay
,
972 Aspect_String_Literal
=> Always_Delay
,
973 Aspect_Suppress
=> Always_Delay
,
974 Aspect_Suppress_Debug_Info
=> Always_Delay
,
975 Aspect_Suppress_Initialization
=> Always_Delay
,
976 Aspect_Thread_Local_Storage
=> Always_Delay
,
977 Aspect_Type_Invariant
=> Always_Delay
,
978 Aspect_Unchecked_Union
=> Always_Delay
,
979 Aspect_Universal_Aliasing
=> Always_Delay
,
980 Aspect_Unmodified
=> Always_Delay
,
981 Aspect_Unreferenced
=> Always_Delay
,
982 Aspect_Unreferenced_Objects
=> Always_Delay
,
983 Aspect_Unsuppress
=> Always_Delay
,
984 Aspect_Variable_Indexing
=> Always_Delay
,
985 Aspect_Write
=> Always_Delay
,
987 Aspect_Abstract_State
=> Never_Delay
,
988 Aspect_Always_Terminates
=> Never_Delay
,
989 Aspect_Annotate
=> Never_Delay
,
990 Aspect_Async_Readers
=> Never_Delay
,
991 Aspect_Async_Writers
=> Never_Delay
,
992 Aspect_Constant_After_Elaboration
=> Never_Delay
,
993 Aspect_Contract_Cases
=> Never_Delay
,
994 Aspect_Convention
=> Never_Delay
,
995 Aspect_Default_Initial_Condition
=> Never_Delay
,
996 Aspect_Depends
=> Never_Delay
,
997 Aspect_Dimension
=> Never_Delay
,
998 Aspect_Dimension_System
=> Never_Delay
,
999 Aspect_Disable_Controlled
=> Never_Delay
,
1000 Aspect_Effective_Reads
=> Never_Delay
,
1001 Aspect_Effective_Writes
=> Never_Delay
,
1002 Aspect_Exceptional_Cases
=> Never_Delay
,
1003 Aspect_Export
=> Never_Delay
,
1004 Aspect_Extensions_Visible
=> Never_Delay
,
1005 Aspect_Ghost
=> Never_Delay
,
1006 Aspect_Global
=> Never_Delay
,
1007 Aspect_GNAT_Annotate
=> Never_Delay
,
1008 Aspect_Import
=> Never_Delay
,
1009 Aspect_Initial_Condition
=> Never_Delay
,
1010 Aspect_Initializes
=> Never_Delay
,
1011 Aspect_Max_Entry_Queue_Depth
=> Never_Delay
,
1012 Aspect_Max_Entry_Queue_Length
=> Never_Delay
,
1013 Aspect_Max_Queue_Length
=> Never_Delay
,
1014 Aspect_No_Caching
=> Never_Delay
,
1015 Aspect_No_Controlled_Parts
=> Never_Delay
,
1016 Aspect_No_Task_Parts
=> Never_Delay
,
1017 Aspect_No_Elaboration_Code_All
=> Never_Delay
,
1018 Aspect_No_Tagged_Streams
=> Never_Delay
,
1019 Aspect_Obsolescent
=> Never_Delay
,
1020 Aspect_Part_Of
=> Never_Delay
,
1021 Aspect_Refined_Depends
=> Never_Delay
,
1022 Aspect_Refined_Global
=> Never_Delay
,
1023 Aspect_Refined_Post
=> Never_Delay
,
1024 Aspect_Refined_State
=> Never_Delay
,
1025 Aspect_Relaxed_Initialization
=> Never_Delay
,
1026 Aspect_SPARK_Mode
=> Never_Delay
,
1027 Aspect_Stable_Properties
=> Always_Delay
,
1028 Aspect_Static
=> Never_Delay
,
1029 Aspect_Subprogram_Variant
=> Never_Delay
,
1030 Aspect_Synchronization
=> Never_Delay
,
1031 Aspect_Test_Case
=> Never_Delay
,
1032 Aspect_Unimplemented
=> Never_Delay
,
1033 Aspect_Volatile_Function
=> Never_Delay
,
1034 Aspect_Warnings
=> Never_Delay
,
1035 Aspect_Yield
=> Never_Delay
,
1037 Aspect_Alignment
=> Rep_Aspect
,
1038 Aspect_Atomic
=> Rep_Aspect
,
1039 Aspect_Atomic_Components
=> Rep_Aspect
,
1040 Aspect_Bit_Order
=> Rep_Aspect
,
1041 Aspect_Component_Size
=> Rep_Aspect
,
1042 Aspect_Full_Access_Only
=> Rep_Aspect
,
1043 Aspect_Machine_Radix
=> Rep_Aspect
,
1044 Aspect_Object_Size
=> Rep_Aspect
,
1045 Aspect_Pack
=> Rep_Aspect
,
1046 Aspect_Scalar_Storage_Order
=> Rep_Aspect
,
1047 Aspect_Size
=> Rep_Aspect
,
1048 Aspect_Small
=> Rep_Aspect
,
1049 Aspect_Storage_Size
=> Rep_Aspect
,
1050 Aspect_Value_Size
=> Rep_Aspect
,
1051 Aspect_Volatile
=> Rep_Aspect
,
1052 Aspect_Volatile_Components
=> Rep_Aspect
,
1053 Aspect_Volatile_Full_Access
=> Rep_Aspect
);
1055 ------------------------------------------------
1056 -- Handling of Aspect Specifications on Stubs --
1057 ------------------------------------------------
1059 -- Aspects that appear on the following stub nodes
1061 -- N_Package_Body_Stub
1062 -- N_Protected_Body_Stub
1063 -- N_Subprogram_Body_Stub
1066 -- are treated as if they apply to the corresponding proper body. Their
1067 -- analysis is postponed until the analysis of the proper body takes place
1068 -- (see Analyze_Proper_Body). The delay is required because the analysis
1069 -- may generate extra code which would be harder to relocate to the body.
1070 -- If the proper body is present, the aspect specifications are relocated
1071 -- to the corresponding body node:
1075 -- N_Subprogram_Body
1078 -- The subsequent analysis takes care of the aspect-to-pragma conversions
1079 -- and verification of pragma legality. In the case where the proper body
1080 -- is not available, the aspect specifications are analyzed on the spot
1081 -- (see Analyze_Proper_Body) to catch potential errors.
1083 -- The following table lists all aspects that can apply to a subprogram
1084 -- body [stub]. For instance, the following example is legal:
1086 -- package P with SPARK_Mode ...;
1087 -- package body P with SPARK_Mode is ...;
1089 -- The table should be synchronized with Pragma_On_Body_Or_Stub_OK in unit
1092 Aspect_On_Body_Or_Stub_OK
: constant array (Aspect_Id
) of Boolean :=
1093 (Aspect_Refined_Depends
=> True,
1094 Aspect_Refined_Global
=> True,
1095 Aspect_Refined_Post
=> True,
1096 Aspect_SPARK_Mode
=> True,
1097 Aspect_Warnings
=> True,
1100 -------------------------------------------------------------------
1101 -- Handling of Aspects Specifications on Single Concurrent Types --
1102 -------------------------------------------------------------------
1104 -- Certain aspects that appear on the following nodes
1106 -- N_Single_Protected_Declaration
1107 -- N_Single_Task_Declaration
1109 -- are treated as if they apply to the anonymous object produced by the
1110 -- analysis of a single concurrent type. The following table lists all
1111 -- aspects that should apply to the anonymous object. The table should
1112 -- be synchronized with Pragma_On_Anonymous_Object_OK in unit Sem_Prag.
1114 Aspect_On_Anonymous_Object_OK
: constant array (Aspect_Id
) of Boolean :=
1115 (Aspect_Depends
=> True,
1116 Aspect_Global
=> True,
1117 Aspect_Part_Of
=> True,
1120 ---------------------------------------------------
1121 -- Handling of Aspect Specifications in the Tree --
1122 ---------------------------------------------------
1124 -- Several kinds of declaration node permit aspect specifications in Ada
1125 -- 2012 mode. If there was room in all the corresponding declaration nodes,
1126 -- we could just have a field Aspect_Specifications pointing to a list of
1127 -- nodes for the aspects (N_Aspect_Specification nodes). But there isn't
1128 -- room, so we adopt a different approach.
1130 -- The following subprograms provide access to a specialized interface
1131 -- implemented internally with a hash table in the body, that provides
1132 -- access to aspect specifications.
1134 function Aspect_Specifications
(N
: Node_Id
) return List_Id
;
1135 -- Given a node N, returns the list of N_Aspect_Specification nodes that
1136 -- are attached to this declaration node. If the node is in the class of
1137 -- declaration nodes that permit aspect specifications, as defined by the
1138 -- predicate above, and if their Has_Aspects flag is set to True, then this
1139 -- will always be a non-empty list. If this flag is set to False, then
1140 -- No_List is returned. Normally, the only nodes that have Has_Aspects set
1141 -- True are the nodes for which Permits_Aspect_Specifications would return
1142 -- True (i.e. the declaration nodes defined in the RM as permitting the
1143 -- presence of Aspect_Specifications). However, it is possible for the
1144 -- flag Has_Aspects to be set on other nodes as a result of Rewrite and
1145 -- Replace calls, and this function may be used to retrieve the aspect
1146 -- specifications for the original rewritten node in such cases.
1148 function Aspects_On_Body_Or_Stub_OK
(N
: Node_Id
) return Boolean;
1149 -- N denotes a body [stub] with aspects. Determine whether all aspects of N
1150 -- are allowed to appear on a body [stub].
1152 procedure Exchange_Aspects
(N1
: Node_Id
; N2
: Node_Id
);
1153 -- Exchange the aspect specifications of two nodes. If either node lacks an
1154 -- aspect specification list, the routine has no effect. It is assumed that
1155 -- both nodes can support aspects.
1157 function Find_Aspect
(Id
: Entity_Id
;
1159 Class_Present
: Boolean := False;
1160 Or_Rep_Item
: Boolean := False) return Node_Id
;
1161 -- Find the aspect specification of aspect A (or A'Class if Class_Present)
1162 -- associated with entity I.
1163 -- If found, then return the aspect specification.
1164 -- If not found and Or_Rep_Item is true, then look for a representation
1165 -- item (as opposed to an N_Aspect_Specification node) which specifies
1166 -- the given aspect; if found, then return the representation item.
1167 -- [Currently only N_Attribute_Definition_Clause representation items
1168 -- are checked for, but support for detecting N_Pragma representation
1169 -- items could easily be added in the future if there is a need.]
1170 -- Otherwise, return Empty.
1172 function Find_Value_Of_Aspect
1175 Class_Present
: Boolean := False) return Node_Id
;
1176 -- Find the value of aspect A (or A'Class, if Class_Present) associated
1177 -- with entity Id. Return Empty if Id does not have the requested aspect.
1179 function Has_Aspect
(Id
: Entity_Id
;
1181 Class_Present
: Boolean := False) return Boolean;
1182 -- Determine whether entity Id has aspect A (or A'Class, if Class_Present)
1184 procedure Move_Aspects
(From
: Node_Id
; To
: Node_Id
);
1185 -- Relocate the aspect specifications of node From to node To. On entry it
1186 -- is assumed that To does not have aspect specifications. If From has no
1187 -- aspects, the routine has no effect.
1189 procedure Move_Or_Merge_Aspects
(From
: Node_Id
; To
: Node_Id
);
1190 -- Relocate the aspect specifications of node From to node To. If To has
1191 -- aspects, the aspects of From are appended to the aspects of To. If From
1192 -- has no aspects, the routine has no effect. Special behavior:
1193 -- * When node From denotes a subprogram body stub without a previous
1194 -- declaration, the only aspects relocated to node To are those found
1195 -- in table Aspect_On_Body_Or_Stub_OK.
1196 -- * When node From denotes a single synchronized type declaration, the
1197 -- only aspects relocated to node To are those found in table
1198 -- Aspect_On_Anonymous_Object_OK.
1200 function Permits_Aspect_Specifications
(N
: Node_Id
) return Boolean;
1201 -- Returns True if the node N is a declaration node that permits aspect
1202 -- specifications in the grammar. It is possible for other nodes to have
1203 -- aspect specifications as a result of Rewrite or Replace calls.
1205 procedure Remove_Aspects
(N
: Node_Id
);
1206 -- Delete the aspect specifications associated with node N. If the node has
1207 -- no aspects, the routine has no effect.
1209 function Same_Aspect
(A1
: Aspect_Id
; A2
: Aspect_Id
) return Boolean;
1210 -- Returns True if A1 and A2 are (essentially) the same aspect. This is not
1211 -- a simple equality test because e.g. Post and Postcondition are the same.
1212 -- This is used for detecting duplicate aspects.
1214 procedure Set_Aspect_Specifications
(N
: Node_Id
; L
: List_Id
);
1215 -- The node N must be in the class of declaration nodes that permit aspect
1216 -- specifications and the Has_Aspects flag must be False on entry. L must
1217 -- be a non-empty list of N_Aspect_Specification nodes. This procedure sets
1218 -- the Has_Aspects flag to True, and makes an entry that can be retrieved
1219 -- by a subsequent Aspect_Specifications call. It is an error to call this
1220 -- procedure with a node that does not permit aspect specifications, or a
1221 -- node that has its Has_Aspects flag set True on entry, or with L being an
1222 -- empty list or No_List.