summaryrefslogtreecommitdiff
path: root/gcc/ada/freeze.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-11 17:46:23 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2009-07-11 17:46:23 +0000
commitd3931fdc9c478060e2557375de89797dee3416e7 (patch)
tree13c0dad3daf6e336511830c555284e910bf763db /gcc/ada/freeze.adb
parent04ef4ca62f1e94e47a2b93a195399b40f2c75cf8 (diff)
downloadgcc-d3931fdc9c478060e2557375de89797dee3416e7.tar.gz
2009-07-11 Thomas Quinot <quinot@adacore.com>
* sem_util.adb, sem_res.adb, sem_warn.adb: Minor comment editing: Lvalue -> lvalue * exp_ch6.adb: Minor reformatting 2009-07-11 Ed Schonberg <schonberg@adacore.com> * freeze.adb (Expand_Atomic_Aggregate): Clean up code, take into account possible type qualification to determine whether aggregate needs a target temporary to respect atomic type or object. * exp_aggr.adb (Expand_Record_Aggregate): Use new version of Expand_Atomic_Aggregate. 2009-07-11 Emmanuel Briot <briot@adacore.com> * prj.adb, prj.ads, prj-nmsc.adb (Mark_Excluded_Sources): Speed up algorithm. (Excluded_Sources_Htable): No longer a global table. Change error message to indicate which files are illegal in the list of excluded files, as opposed to only the location in the project file. (Find_Source): New subprogram. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149515 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/freeze.adb')
-rw-r--r--gcc/ada/freeze.adb31
1 files changed, 24 insertions, 7 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index e66dc14f101..f464f19b2ef 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -1115,15 +1115,27 @@ package body Freeze is
-- Expand_Atomic_Aggregate --
-----------------------------
- procedure Expand_Atomic_Aggregate (E : Entity_Id; Typ : Entity_Id) is
+ function Expand_Atomic_Aggregate
+ (E : Entity_Id;
+ Typ : Entity_Id) return Boolean
+ is
Loc : constant Source_Ptr := Sloc (E);
New_N : Node_Id;
+ Par : Node_Id;
Temp : Entity_Id;
begin
- if (Nkind (Parent (E)) = N_Object_Declaration
- or else Nkind (Parent (E)) = N_Assignment_Statement)
- and then Comes_From_Source (Parent (E))
+ Par := Parent (E);
+
+ -- Array may be qualified, so find outer context.
+
+ if Nkind (Par) = N_Qualified_Expression then
+ Par := Parent (Par);
+ end if;
+
+ if (Nkind (Par) = N_Object_Declaration
+ or else Nkind (Par) = N_Assignment_Statement)
+ and then Comes_From_Source (Par)
then
Temp :=
Make_Defining_Identifier (Loc,
@@ -1134,11 +1146,14 @@ package body Freeze is
Defining_Identifier => Temp,
Object_Definition => New_Occurrence_Of (Typ, Loc),
Expression => Relocate_Node (E));
- Insert_Before (Parent (E), New_N);
+ Insert_Before (Par, New_N);
Analyze (New_N);
- Set_Expression (Parent (E), New_Occurrence_Of (Temp, Loc));
+ Set_Expression (Par, New_Occurrence_Of (Temp, Loc));
+ return True;
+ else
+ return False;
end if;
end Expand_Atomic_Aggregate;
@@ -2351,8 +2366,10 @@ package body Freeze is
and then Nkind (Parent (E)) = N_Object_Declaration
and then Present (Expression (Parent (E)))
and then Nkind (Expression (Parent (E))) = N_Aggregate
+ and then
+ Expand_Atomic_Aggregate (Expression (Parent (E)), Etype (E))
then
- Expand_Atomic_Aggregate (Expression (Parent (E)), Etype (E));
+ null;
end if;
-- For a subprogram, freeze all parameter types and also the return