diff options
author | Gary Dismukes <dismukes@adacore.com> | 2021-09-01 19:58:14 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-10-04 08:45:11 +0000 |
commit | 70aec3a1b8efd09a951e4d52f396345a740879d3 (patch) | |
tree | 2dec51ef1ec0b7acd1175728e9707c96cdd4a4fd /gcc/ada/libgnat | |
parent | a5740f2b7285f950e68d7790c37e28a5b768b4e8 (diff) | |
download | gcc-70aec3a1b8efd09a951e4d52f396345a740879d3.zip gcc-70aec3a1b8efd09a951e4d52f396345a740879d3.tar.gz gcc-70aec3a1b8efd09a951e4d52f396345a740879d3.tar.bz2 |
[Ada] Completion of support for AI12-0409 (attribute Preelaborable_Initialization)
gcc/ada/
* sem_ch7.adb (Analyze_Package_Specification): For types marked
as Must_Have_Preelab_Init, we now check for the presence of a
Preelaborable_Initialization aspect on the type, and pass the
aspect's expression (if any) on the call to
Has_Preelaborable_Initialization (or pass Empty if the type has
no such aspect or the aspect has no associated expression).
* sem_util.ads (Has_Preelaborable_Initialization): Change
Boolean formal parameter Formal_Types_Have_Preelab_Init to
instead be a formal of type Node_Id (named Preelab_Init_Expr),
to allow passing an expression that may be a conjunction of
Preelaborable_Initialization aspects. Revise spec comment
accordingly (and remove ??? comment).
* sem_util.adb (Type_Named_In_Preelab_Init_Expression): New
nested function with a result indicating whether a given type is
named as the prefix of a Preelaborable_Initialization attribute
in the expression of a corresponding P_I aspect.
(Has_Preelaborable_Initialization): For generic formal derived
and private types, test whether the type is named in the
expression Preelab_Init_Expr (by calling
Type_Named_In_Preelab_Init_Expression), and if so, treat the
formal type as having preelaborable initialization (returning
True).
* libgnat/a-cobove.ads (Vector): Replace pragma
Preelaborable_Initialization with the aspect, specifying its
value as Element_Type'Preelaborable_Initialization.
(Cursor): Replace pragma P_I with the aspect (defaulting to
True).
* libgnat/a-cbdlli.ads (List): Replace pragma
Preelaborable_Initialization with the aspect, specifying its
value as Element_Type'Preelaborable_Initialization.
(Cursor): Replace pragma P_I with the aspect (defaulting to
True).
* libgnat/a-cbhama.ads (Map): Replace pragma
Preelaborable_Initialization with the aspect, specifying its
value as (Element_Type'Preelaborable_Initialization and
Key_Type'Preelaborable_Initialization).
(Cursor): Replace pragma P_I with the aspect (defaulting to
True).
* libgnat/a-cborma.ads (Map): Replace pragma
Preelaborable_Initialization with the aspect, specifying its
value as (Element_Type'Preelaborable_Initialization and
Key_Type'Preelaborable_Initialization).
(Cursor): Replace pragma P_I with the aspect (defaulting to
True).
* libgnat/a-cbhase.ads (Set): Replace pragma
Preelaborable_Initialization with the aspect, specifying its
value as Element_Type'Preelaborable_Initialization.
(Cursor): Replace pragma P_I with the aspect (defaulting to
True).
* libgnat/a-cborse.ads (Set): Replace pragma
Preelaborable_Initialization with the aspect, specifying its
value as Element_Type'Preelaborable_Initialization.
(Cursor): Replace pragma P_I with the aspect (defaulting to
True).
* libgnat/a-cbmutr.ads (Tree): Replace pragma
Preelaborable_Initialization with the aspect, specifying its
value as Element_Type'Preelaborable_Initialization.
(Cursor): Replace pragma P_I with the aspect (defaulting to
True).
* libgnat/a-coboho.ads (Holder): Replace pragma
Preelaborable_Initialization with the aspect, specifying its
value as Element_Type'Preelaborable_Initialization.
(Cursor): Replace pragma P_I with the aspect (defaulting to
True).
Diffstat (limited to 'gcc/ada/libgnat')
-rw-r--r-- | gcc/ada/libgnat/a-cbdlli.ads | 8 | ||||
-rw-r--r-- | gcc/ada/libgnat/a-cbhama.ads | 11 | ||||
-rw-r--r-- | gcc/ada/libgnat/a-cbhase.ads | 9 | ||||
-rw-r--r-- | gcc/ada/libgnat/a-cbmutr.ads | 8 | ||||
-rw-r--r-- | gcc/ada/libgnat/a-cborma.ads | 11 | ||||
-rw-r--r-- | gcc/ada/libgnat/a-cborse.ads | 9 | ||||
-rw-r--r-- | gcc/ada/libgnat/a-coboho.ads | 4 | ||||
-rw-r--r-- | gcc/ada/libgnat/a-cobove.ads | 9 |
8 files changed, 35 insertions, 34 deletions
diff --git a/gcc/ada/libgnat/a-cbdlli.ads b/gcc/ada/libgnat/a-cbdlli.ads index ab55086..f4086ea 100644 --- a/gcc/ada/libgnat/a-cbdlli.ads +++ b/gcc/ada/libgnat/a-cbdlli.ads @@ -57,11 +57,11 @@ is Default_Iterator => Iterate, Iterator_Element => Element_Type, Aggregate => (Empty => Empty, - Add_Unnamed => Append); - pragma Preelaborable_Initialization (List); + Add_Unnamed => Append), + Preelaborable_Initialization + => Element_Type'Preelaborable_Initialization; - type Cursor is private; - pragma Preelaborable_Initialization (Cursor); + type Cursor is private with Preelaborable_Initialization; Empty_List : constant List; diff --git a/gcc/ada/libgnat/a-cbhama.ads b/gcc/ada/libgnat/a-cbhama.ads index 8be64c8..cdd4135 100644 --- a/gcc/ada/libgnat/a-cbhama.ads +++ b/gcc/ada/libgnat/a-cbhama.ads @@ -59,12 +59,13 @@ is Default_Iterator => Iterate, Iterator_Element => Element_Type, Aggregate => (Empty => Empty, - Add_Named => Insert); + Add_Named => Insert), + Preelaborable_Initialization + => Element_Type'Preelaborable_Initialization + and + Key_Type'Preelaborable_Initialization; - pragma Preelaborable_Initialization (Map); - - type Cursor is private; - pragma Preelaborable_Initialization (Cursor); + type Cursor is private with Preelaborable_Initialization; Empty_Map : constant Map; -- Map objects declared without an initialization expression are diff --git a/gcc/ada/libgnat/a-cbhase.ads b/gcc/ada/libgnat/a-cbhase.ads index 92926c1..78b31cf 100644 --- a/gcc/ada/libgnat/a-cbhase.ads +++ b/gcc/ada/libgnat/a-cbhase.ads @@ -61,12 +61,11 @@ is Default_Iterator => Iterate, Iterator_Element => Element_Type, Aggregate => (Empty => Empty, - Add_Unnamed => Include); + Add_Unnamed => Include), + Preelaborable_Initialization + => Element_Type'Preelaborable_Initialization; - pragma Preelaborable_Initialization (Set); - - type Cursor is private; - pragma Preelaborable_Initialization (Cursor); + type Cursor is private with Preelaborable_Initialization; Empty_Set : constant Set; -- Set objects declared without an initialization expression are diff --git a/gcc/ada/libgnat/a-cbmutr.ads b/gcc/ada/libgnat/a-cbmutr.ads index c7e221a..3712039 100644 --- a/gcc/ada/libgnat/a-cbmutr.ads +++ b/gcc/ada/libgnat/a-cbmutr.ads @@ -53,11 +53,11 @@ is with Constant_Indexing => Constant_Reference, Variable_Indexing => Reference, Default_Iterator => Iterate, - Iterator_Element => Element_Type; - pragma Preelaborable_Initialization (Tree); + Iterator_Element => Element_Type, + Preelaborable_Initialization + => Element_Type'Preelaborable_Initialization; - type Cursor is private; - pragma Preelaborable_Initialization (Cursor); + type Cursor is private with Preelaborable_Initialization; Empty_Tree : constant Tree; diff --git a/gcc/ada/libgnat/a-cborma.ads b/gcc/ada/libgnat/a-cborma.ads index f87522a..9d40a51 100644 --- a/gcc/ada/libgnat/a-cborma.ads +++ b/gcc/ada/libgnat/a-cborma.ads @@ -60,12 +60,13 @@ is Default_Iterator => Iterate, Iterator_Element => Element_Type, Aggregate => (Empty => Empty, - Add_Named => Insert); + Add_Named => Insert), + Preelaborable_Initialization + => Element_Type'Preelaborable_Initialization + and + Key_Type'Preelaborable_Initialization; - pragma Preelaborable_Initialization (Map); - - type Cursor is private; - pragma Preelaborable_Initialization (Cursor); + type Cursor is private with Preelaborable_Initialization; Empty_Map : constant Map; diff --git a/gcc/ada/libgnat/a-cborse.ads b/gcc/ada/libgnat/a-cborse.ads index 06bd20f..31b8b91 100644 --- a/gcc/ada/libgnat/a-cborse.ads +++ b/gcc/ada/libgnat/a-cborse.ads @@ -59,12 +59,11 @@ is Default_Iterator => Iterate, Iterator_Element => Element_Type, Aggregate => (Empty => Empty, - Add_Unnamed => Include); + Add_Unnamed => Include), + Preelaborable_Initialization + => Element_Type'Preelaborable_Initialization; - pragma Preelaborable_Initialization (Set); - - type Cursor is private; - pragma Preelaborable_Initialization (Cursor); + type Cursor is private with Preelaborable_Initialization; Empty_Set : constant Set; diff --git a/gcc/ada/libgnat/a-coboho.ads b/gcc/ada/libgnat/a-coboho.ads index 086f194..44269f0 100644 --- a/gcc/ada/libgnat/a-coboho.ads +++ b/gcc/ada/libgnat/a-coboho.ads @@ -70,7 +70,9 @@ package Ada.Containers.Bounded_Holders is -- System.Storage_Unit; e.g. creating Holders from 5-bit objects won't -- work. - type Holder is private; + type Holder is private + with Preelaborable_Initialization + => Element_Type'Preelaborable_Initialization; function "=" (Left, Right : Holder) return Boolean; diff --git a/gcc/ada/libgnat/a-cobove.ads b/gcc/ada/libgnat/a-cobove.ads index 67c4419..5f3e1a7 100644 --- a/gcc/ada/libgnat/a-cobove.ads +++ b/gcc/ada/libgnat/a-cobove.ads @@ -63,12 +63,11 @@ package Ada.Containers.Bounded_Vectors is Aggregate => (Empty => Empty, Add_Unnamed => Append, New_Indexed => New_Vector, - Assign_Indexed => Replace_Element); + Assign_Indexed => Replace_Element), + Preelaborable_Initialization + => Element_Type'Preelaborable_Initialization; - pragma Preelaborable_Initialization (Vector); - - type Cursor is private; - pragma Preelaborable_Initialization (Cursor); + type Cursor is private with Preelaborable_Initialization; Empty_Vector : constant Vector; |