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