summaryrefslogtreecommitdiff
path: root/gcc/ada/exp_dist.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-06 08:20:13 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-05-06 08:20:13 +0000
commit54a42417b09d11ad07c34e5368e01ca6538a54ac (patch)
tree68816ebed1f63a3a00cbb546a6855dff039baed7 /gcc/ada/exp_dist.adb
parent38b9cc41f84542f78353a1f9919a471ff1ff1002 (diff)
downloadgcc-54a42417b09d11ad07c34e5368e01ca6538a54ac.tar.gz
2009-05-06 Ed Schonberg <schonberg@adacore.com>
* sem_aggr.adb (Resolve_Record_Aggregate): If a defaulted component of an aggregate with box default is of a discriminated private type, do not build a subaggregate for it. A proper call to the initialization procedure is generated for it. 2009-05-06 Thomas Quinot <quinot@adacore.com> * rtsfind.adb, rtsfind.ads, exp_dist.adb, exp_dist.ads (Exp_Dist.Build_TC_Call, Build_From_Any_Call, Build_To_Any_Call): Use PolyORB strings to represent Ada.Strings.Unbounded_String value; use standard array code for Standard.String. (Exp_Dist): Bump PolyORB s-parint API version to 3. (Rtsfind): New entities TA_Std_String, Unbounded_String. 2009-05-06 Robert Dewar <dewar@adacore.com> * g-comlin.ads: Minor reformatting * xoscons.adb: Minor reformatting git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147149 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_dist.adb')
-rw-r--r--gcc/ada/exp_dist.adb35
1 files changed, 26 insertions, 9 deletions
diff --git a/gcc/ada/exp_dist.adb b/gcc/ada/exp_dist.adb
index 04a2187c8ce..75b400d2644 100644
--- a/gcc/ada/exp_dist.adb
+++ b/gcc/ada/exp_dist.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -6630,13 +6630,13 @@ package body Exp_Dist is
Make_Function_Call (Loc,
Name =>
New_Occurrence_Of
- (RTE (RE_TA_String), Loc),
+ (RTE (RE_TA_Std_String), Loc),
Parameter_Associations => New_List (
Make_String_Literal (Loc, Name_String))),
Make_Function_Call (Loc,
Name =>
New_Occurrence_Of
- (RTE (RE_TA_String), Loc),
+ (RTE (RE_TA_Std_String), Loc),
Parameter_Associations => New_List (
Make_String_Literal (Loc,
Strval => Repo_Id_String))))))))))));
@@ -8465,7 +8465,7 @@ package body Exp_Dist is
elsif U_Type = RTE (RE_Long_Long_Unsigned) then
Lib_RE := RE_FA_LLU;
- elsif U_Type = Standard_String then
+ elsif Is_RTE (U_Type, RE_Unbounded_String) then
Lib_RE := RE_FA_String;
-- Special DSA types
@@ -8970,7 +8970,11 @@ package body Exp_Dist is
for J in 1 .. Ndim loop
Lnam := New_External_Name ('L', J);
Hnam := New_External_Name ('H', J);
- Indt := Etype (Indx);
+
+ -- Note, for empty arrays bounds may be out of
+ -- the range of Etype (Indx).
+
+ Indt := Base_Type (Etype (Indx));
Append_To (Decls,
Make_Object_Declaration (Loc,
@@ -9288,6 +9292,7 @@ package body Exp_Dist is
Typ : Entity_Id := Etype (N);
U_Type : Entity_Id;
+ C_Type : Entity_Id;
Fnam : Entity_Id := Empty;
Lib_RE : RE_Id := RE_Null;
@@ -9383,7 +9388,7 @@ package body Exp_Dist is
elsif U_Type = RTE (RE_Long_Long_Unsigned) then
Lib_RE := RE_TA_LLU;
- elsif U_Type = Standard_String then
+ elsif Is_RTE (U_Type, RE_Unbounded_String) then
Lib_RE := RE_TA_String;
-- Special DSA types
@@ -9416,11 +9421,23 @@ package body Exp_Dist is
Fnam := RTE (Lib_RE);
end if;
+ -- If Fnam is already analyzed, find the proper expected type,
+ -- else we have a newly constructed To_Any function and we know
+ -- that the expected type of its parameter is U_Type.
+
+ if Ekind (Fnam) = E_Function
+ and then Present (First_Formal (Fnam))
+ then
+ C_Type := Etype (First_Formal (Fnam));
+ else
+ C_Type := U_Type;
+ end if;
+
return
Make_Function_Call (Loc,
Name => New_Occurrence_Of (Fnam, Loc),
Parameter_Associations =>
- New_List (Unchecked_Convert_To (U_Type, N)));
+ New_List (OK_Convert_To (C_Type, N)));
end Build_To_Any_Call;
---------------------------
@@ -10153,7 +10170,7 @@ package body Exp_Dist is
elsif U_Type = RTE (RE_Long_Long_Unsigned) then
Lib_RE := RE_TC_LLU;
- elsif U_Type = Standard_String then
+ elsif Is_RTE (U_Type, RE_Unbounded_String) then
Lib_RE := RE_TC_String;
-- Special DSA types
@@ -10253,7 +10270,7 @@ package body Exp_Dist is
begin
Append_To (Parameter_List,
Make_Function_Call (Loc,
- Name => New_Occurrence_Of (RTE (RE_TA_String), Loc),
+ Name => New_Occurrence_Of (RTE (RE_TA_Std_String), Loc),
Parameter_Associations => New_List (
Make_String_Literal (Loc, S))));
end Add_String_Parameter;