aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/cstand.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2014-07-29 15:20:26 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2014-07-29 15:20:26 +0200
commitf8c79ade9e03c5278cb4858d6e46695683e1c1ff (patch)
tree0c0fb55c2de502e6ce69b8951a0c875da3b4a644 /gcc/ada/cstand.adb
parentb329a739f8026e4d1ace1e7113c96b99e3193e17 (diff)
downloadgcc-f8c79ade9e03c5278cb4858d6e46695683e1c1ff.zip
gcc-f8c79ade9e03c5278cb4858d6e46695683e1c1ff.tar.gz
gcc-f8c79ade9e03c5278cb4858d6e46695683e1c1ff.tar.bz2
[multiple changes]
2014-07-29 Olivier Hainque <hainque@adacore.com> * g-debpoo.adb (Default_Alignment): Rename as Storage_Alignment. This is not a "default" that can be overriden. Augment comment to clarify intent and document why we need to manage alignment padding. (Header_Offset): Set to Header'Object_Size instead of 'Size rounded up to Storage_Alignment. Storage_Alignment on the allocation header is not required by our internals so was overkill. 'Object_Size is enough to ensure proper alignment of the header address when substracted from a storage address aligned on Storage_Alignment. (Minimum_Allocation): Rename as Extra_Allocation, conveying that this is always added on top of the incoming allocation requests. (Align): New function, to perform alignment rounding operations. (Allocate): Add comments on the Storage_Address computation scheme and adjust so that the alignment padding applies to that (Storage_Address) only. 2014-07-29 Robert Dewar <dewar@adacore.com> * exp_ch3.adb (Default_Initialize_Object): Remove incorrect pragma Unreferenced. * cstand.adb (Create_Standard): Use E_Array_Type for standard string types. Make sure index of Any_String/Any_Array is in a list. * errout.adb: Minor reformatting. From-SVN: r213169
Diffstat (limited to 'gcc/ada/cstand.adb')
-rw-r--r--gcc/ada/cstand.adb63
1 files changed, 40 insertions, 23 deletions
diff --git a/gcc/ada/cstand.adb b/gcc/ada/cstand.adb
index 4099a7d..0bb0d84 100644
--- a/gcc/ada/cstand.adb
+++ b/gcc/ada/cstand.adb
@@ -450,6 +450,9 @@ package body CStand is
-- Creates entities for all predefined floating point types, and
-- adds these to the Predefined_Float_Types list in package Standard.
+ procedure Make_Dummy_Index (E : Entity_Id);
+ -- Called to provide a dummy index field value for Any_Array/Any_String
+
procedure Pack_String_Type (String_Type : Entity_Id);
-- Generate proper tree for pragma Pack that applies to given type, and
-- mark type as having the pragma.
@@ -554,6 +557,27 @@ package body CStand is
end Create_Float_Types;
----------------------
+ -- Make_Dummy_Index --
+ ----------------------
+
+ procedure Make_Dummy_Index (E : Entity_Id) is
+ Index : Node_Id;
+ Dummy : List_Id;
+
+ begin
+ Index :=
+ Make_Range (Sloc (E),
+ Low_Bound => Make_Integer (Uint_0),
+ High_Bound => Make_Integer (Uint_2 ** Standard_Integer_Size));
+ Set_Etype (Index, Standard_Integer);
+ Set_First_Index (E, Index);
+
+ -- Make sure Index is a list as required, so Next_Index is Empty
+
+ Dummy := New_List (Index);
+ end Make_Dummy_Index;
+
+ ----------------------
-- Pack_String_Type --
----------------------
@@ -907,7 +931,7 @@ package body CStand is
Append (Identifier_For (S_Positive), Subtype_Marks (Tdef_Node));
Set_Type_Definition (Parent (Standard_String), Tdef_Node);
- Set_Ekind (Standard_String, E_String_Type);
+ Set_Ekind (Standard_String, E_Array_Type);
Set_Etype (Standard_String, Standard_String);
Set_Component_Type (Standard_String, Standard_Character);
Set_Component_Size (Standard_String, Uint_8);
@@ -926,8 +950,8 @@ package body CStand is
-- Set index type of String
- E_Id := First
- (Subtype_Marks (Type_Definition (Parent (Standard_String))));
+ E_Id :=
+ First (Subtype_Marks (Type_Definition (Parent (Standard_String))));
Set_First_Index (Standard_String, E_Id);
Set_Entity (E_Id, Standard_Positive);
Set_Etype (E_Id, Standard_Positive);
@@ -951,7 +975,7 @@ package body CStand is
Append (Identifier_For (S_Positive), Subtype_Marks (Tdef_Node));
Set_Type_Definition (Parent (Standard_Wide_String), Tdef_Node);
- Set_Ekind (Standard_Wide_String, E_String_Type);
+ Set_Ekind (Standard_Wide_String, E_Array_Type);
Set_Etype (Standard_Wide_String, Standard_Wide_String);
Set_Component_Type (Standard_Wide_String, Standard_Wide_Character);
Set_Component_Size (Standard_Wide_String, Uint_16);
@@ -960,8 +984,9 @@ package body CStand is
-- Set index type of Wide_String
- E_Id := First
- (Subtype_Marks (Type_Definition (Parent (Standard_Wide_String))));
+ E_Id :=
+ First
+ (Subtype_Marks (Type_Definition (Parent (Standard_Wide_String))));
Set_First_Index (Standard_Wide_String, E_Id);
Set_Entity (E_Id, Standard_Positive);
Set_Etype (E_Id, Standard_Positive);
@@ -985,7 +1010,7 @@ package body CStand is
Append (Identifier_For (S_Positive), Subtype_Marks (Tdef_Node));
Set_Type_Definition (Parent (Standard_Wide_Wide_String), Tdef_Node);
- Set_Ekind (Standard_Wide_Wide_String, E_String_Type);
+ Set_Ekind (Standard_Wide_Wide_String, E_Array_Type);
Set_Etype (Standard_Wide_Wide_String,
Standard_Wide_Wide_String);
Set_Component_Type (Standard_Wide_Wide_String,
@@ -997,8 +1022,10 @@ package body CStand is
-- Set index type of Wide_Wide_String
- E_Id := First
- (Subtype_Marks (Type_Definition (Parent (Standard_Wide_Wide_String))));
+ E_Id :=
+ First
+ (Subtype_Marks
+ (Type_Definition (Parent (Standard_Wide_Wide_String))));
Set_First_Index (Standard_Wide_Wide_String, E_Id);
Set_Entity (E_Id, Standard_Positive);
Set_Etype (E_Id, Standard_Positive);
@@ -1213,12 +1240,13 @@ package body CStand is
Make_Name (Any_Character, "a character type");
Any_Array := New_Standard_Entity;
- Set_Ekind (Any_Array, E_String_Type);
+ Set_Ekind (Any_Array, E_Array_Type);
Set_Scope (Any_Array, Standard_Standard);
Set_Etype (Any_Array, Any_Array);
Set_Component_Type (Any_Array, Any_Character);
Init_Size_Align (Any_Array);
Make_Name (Any_Array, "an array type");
+ Make_Dummy_Index (Any_Array);
Any_Boolean := New_Standard_Entity;
Set_Ekind (Any_Boolean, E_Enumeration_Type);
@@ -1305,24 +1333,13 @@ package body CStand is
Make_Name (Any_Scalar, "a scalar type");
Any_String := New_Standard_Entity;
- Set_Ekind (Any_String, E_String_Type);
+ Set_Ekind (Any_String, E_Array_Type);
Set_Scope (Any_String, Standard_Standard);
Set_Etype (Any_String, Any_String);
Set_Component_Type (Any_String, Any_Character);
Init_Size_Align (Any_String);
Make_Name (Any_String, "a string type");
-
- declare
- Index : Node_Id;
-
- begin
- Index :=
- Make_Range (Stloc,
- Low_Bound => Make_Integer (Uint_0),
- High_Bound => Make_Integer (Uint_2 ** Standard_Integer_Size));
- Set_Etype (Index, Standard_Integer);
- Set_First_Index (Any_String, Index);
- end;
+ Make_Dummy_Index (Any_String);
Raise_Type := New_Standard_Entity;
Decl := New_Node (N_Full_Type_Declaration, Stloc);