411 REFERENCE · Wikibooks
Ada Programming/Aspects
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Aspects
__TOC__
When entities like variables or subprograms are declared, certain properties thereof normally are left to the compiler to specify (like the size or the address of a variable, the calling convention of a subprogram). Properties which may be queried are called Attributes; those which may be specified are called Aspects. Some aspects correspond with attributes which then have the same name. Aspects and attributes are defined in the Ada Reference Manual K Language-Defined Aspects and Attributes, pragmas in L Language-Defined Pragmas.
Description
Aspects are certain properties of an entity that may be specified, depending on the kind of entity, by an aspect specification as part of its declaration or by a separate attribute definition clause or pragma declaration.
Aspect_Specification ::=
with Aspect_Name [ => Aspect_Definition] {,
Aspect_Name [ => Aspect_Definition] } ;
Attribute_Definition_Clause ::=
for entity_name'attribute_designator use expression;
| for entity_name'attribute_designator use name;
pragma Name (Parameter_List);
If an aspect is not specified, it depends on the aspect itself whether its value is left to the compiler or prescribed in the Ada RM.
The specification of a Boolean valued aspect may omit the aspect definition, which then has the value True.
Examples of such properties are the size of a type, i.e. the number of bits a stand-alone object of that type will use; or that a subprogram will not return from its call: aspect No_Return. This latter one is an example of an aspect that has a Boolean value.
List of language defined aspects
If not marked otherwise, an aspect is specified by an Aspect_Specification.
An aspect marked Ada 2012 is an Ada 2012 language functionality not available in previous Ada generations.
An aspect marked Ada 2022 is an Ada 2022 language functionality not available in previous Ada generations.
Aspects not so marked, were previously defined via pragmas or attribute definition clauses.
This is still possible, but deprecated.
A – D
Aggregate (Ada 2022; Aspect_Specification)
Address (Attribute_Definition_Clause, Aspect_Specification)
Alignment (Attribute_Definition_Clause)
All_Calls_Remote (Pragma)
Allows_Exit (Ada 2022; Aspect_Specification)
Asynchronous
Atomic
Atomic_Components
Attach_Handler
Bit_Order (Attribute_Definition_Clause)
Coding (Enumeration_Representation_Clause)
Component_Size (Attribute_Definition_Clause)
Constant_Indexing (Ada 2012)
Convention
CPU (Ada 2012)
Default_Component_Value (Ada 2012)
Default_Initial_Condition (Ada 2022; Aspect_Specification)
Default_Iterator (Ada 2012)
Default_Storage_Pool (Ada 2012; Pragma)
Default_Value (Ada 2012)
Dispatching (Ada 2022; Aspect_Specification)
Dispatching_Domain (Ada 2012)
Discard_Names (Ada 2012; Aspect_Specification, Pragma)
Dynamic_Predicate (Ada 2012)
E – O
Elaborate_Body (Pragma)
Exclusive_Functions (Ada 2012)
Export
External_Name
External_Tag (Attribute_Definition_Clause)
Full_Access_Only (Ada 2022; Aspect_Specification)
Global (Ada 2022; Aspect_Specification)
Global'Class (Ada 2022; Aspect_Specification)
Implicit_Dereference (Ada 2012)
Import
Independent (Ada 2012)
Independent_Components (Ada 2012)
Inline
Input (Attribute_Definition_Clause)
Input'Class (Ada 2012; Attribute_Definition_Clause)
Integer_Literal (Ada 2022; Aspect_Specification)
Interrupt_Handler
Interrupt_Priority
Iterator_Element (Ada 2012)
Iterator_View (Ada 2022; Aspect_Specification)
Layout (Record_Representation_Clause)
Link_Name
Machine_Radix (Attribute_Definition_Clause)
Max_Entry_Queue_Length (Ada 2022; Aspect_Specification)
No_Controlled_Parts (Ada 2022; Aspect_Specification)
No_Return
Nonblocking (Ada 2022; Aspect_Specification)
Output (Attribute_Definition_Clause)
Output'Class (Ada 2012; Attribute_Definition_Clause)
P – Z
Pack
Parallel_Calls (Ada 2022; Aspect_Specification)
Parallel_Iterator (Ada 2022; Aspect_Specification)
Post (Ada 2012)
Post'Class (Ada 2012)
Pre (Ada 2012)
Pre'Class (Ada 2012)
Predicate_Failure (Ada 2012)
Preelaborate (Pragma)
Preelaborable_Initialization (Ada 2022; Aspect_Specification)
Priority
Pure (Pragma)
Put_Image (Ada 2022; Aspect_Specification)
Read (Attribute_Definition_Clause)
Read'Class (Ada 2012; Attribute_Definition_Clause)
Real_Literal (Ada 2022; Aspect_Specification)
Relative_Deadline (Ada 2022; Aspect_Specification)
Remote_Call_Interface (Pragma)
Remote_Types (Pragma)
Shared_Passive (Pragma)
Size (Attribute_Definition_Clause)
Small (Attribute_Definition_Clause)
Stable_Properties (Ada 2022; Aspect_Specification)
Stable_Properties'Class (Ada 2022; Aspect_Specification)
Static (Ada 2022; Aspect_Specification)
Static_Predicate (Ada 2012)
Storage_Pool (Attribute_Definition_Clause)
Storage_Size (Attribute_Definition_Clause)
Stream_Size (Attribute_Definition_Clause)
String_Literal (Ada 2022; Aspect_Specification)
Synchronization (Ada 2012)
Type_Invariant (Ada 2012)
Type_Invariant'Class (Ada 2012)
Unchecked_Union (Ada 2022; Aspect_Specification)
Use_Formal (Ada 2022; Aspect_Specification)
Variable_Indexing (Ada 2012)
Volatile
Volatile_Components
Write (Attribute_Definition_Clause)
Write'Class (Ada 2012; Attribute_Definition_Clause)
Yield (Ada 2022; Aspect_Specification)
List of implementation defined aspects
The following pragmas are not available in all Ada compilers, only in those that had implemented them.
Currently, there are only listed the implementation-defined pragmas of a few compilers. You can help Wikibooks adding specific aspects of other compilers:
GNAT Implementation defined aspect of the GNAT compiler from AdaCore and FSF.
Ada_2005 (GNAT)
Ada_2012 (GNAT)
Favor_Top_Level (GNAT)
Inline_Always (GNAT)
Object_Size (GNAT)
Persistent_BSS (GNAT)
Pure_Function (GNAT)
Remote_Access_Type (GNAT)
Shared (GNAT)
Suppress_Debug_Info (GNAT)
Test_Case (GNAT)
Universal_Aliasing (GNAT)
Unmodified (GNAT)
Unreferenced (GNAT)
Unreferenced_Objects (GNAT)
Value_Size (GNAT)
Warnings (GNAT)
See also
Wikibook
Ada Programming
Ada Programming/Attributes
Ada Programming/Keywords
Ada Programming/Pragmas
Ada Reference Manual
Ada 2012
13 1 1 Aspect Specifications
K 1 Language-Defined Aspects
J 15 Aspect-related Pragmas
Ada 2022
13.1.1: Aspect Specifications
K.1: Language-Defined Aspects
J.15: Aspect-related Pragmas
References
Aspects