aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_aggr.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2012-08-06 10:02:35 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2012-08-06 10:02:35 +0200
commita39a553eacce1f39fac4cffc0f5768bee425c1a1 (patch)
tree0ce70598eeda17f17973df3cf9483c742073238d /gcc/ada/exp_aggr.adb
parent5eeeed5e1a9ee8ea9fbff247c9cc6fd093fa5dcd (diff)
downloadgcc-a39a553eacce1f39fac4cffc0f5768bee425c1a1.zip
gcc-a39a553eacce1f39fac4cffc0f5768bee425c1a1.tar.gz
gcc-a39a553eacce1f39fac4cffc0f5768bee425c1a1.tar.bz2
[multiple changes]
2012-08-06 Hristian Kirtchev <kirtchev@adacore.com> * sem_mech.adb (Set_Mechanisms): OUT and IN OUT parameters are now unconditionally passed by reference. IN parameters subject to convention C_Pass_By_Copy are passed by copy, otherwise they are passed by reference. 2012-08-06 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Analyze_Object_Declaration): According to AI95-0303, protected objects with interrupt handlers can be declared in nested scopes. This is a binding interpretation, and thus applies to all versions of the compiler. 2012-08-06 Robert Dewar <dewar@adacore.com> * frontend.adb, exp_aggr.adb: Minor reformatting. 2012-08-06 Thomas Quinot <quinot@adacore.com> * par-endh.adb: Minor reformatting. From-SVN: r190162
Diffstat (limited to 'gcc/ada/exp_aggr.adb')
-rw-r--r--gcc/ada/exp_aggr.adb47
1 files changed, 24 insertions, 23 deletions
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 8504579..98070a9 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -5981,6 +5981,9 @@ package body Exp_Aggr is
-- Bounds are within 32-bit Int range
-- All bounds and values are static
+ -- Note: for now, in the 2-D case, we only handle component sizes of
+ -- 1, 2, 4 (cases where an integral number of elements occupies a byte).
+
function Packed_Array_Aggregate_Handled (N : Node_Id) return Boolean is
Loc : constant Source_Ptr := Sloc (N);
Typ : constant Entity_Id := Etype (N);
@@ -6302,7 +6305,8 @@ package body Exp_Aggr is
return False;
else
return Expr_Value (L1) /= Expr_Value (L2)
- or else Expr_Value (H1) /= Expr_Value (H2);
+ or else
+ Expr_Value (H1) /= Expr_Value (H2);
end if;
end if;
end Must_Slide;
@@ -6386,39 +6390,36 @@ package body Exp_Aggr is
-- Expression in original aggregate
One_Dim : Node_Id;
- -- one-dimensional subaggregate
+ -- One-dimensional subaggregate
begin
- -- For now, only deal with tight packing. The boolean case is the
- -- most common.
+ -- For now, only deal with cases where an integral number of elements
+ -- fit in a single byte. This includes the most common boolean case.
- if Comp_Size = 1
- or else Comp_Size = 2
- or else Comp_Size = 4
+ if not (Comp_Size = 1 or else
+ Comp_Size = 2 or else
+ Comp_Size = 4)
then
- null;
-
- else
return False;
end if;
Convert_To_Positional
(N, Max_Others_Replicate => 64, Handle_Bit_Packed => True);
- -- Verify that all components are static.
+ -- Verify that all components are static
if Nkind (N) = N_Aggregate
and then Compile_Time_Known_Aggregate (N)
then
null;
- -- The aggregate may have been re-analyzed and converted already.
+ -- The aggregate may have been re-analyzed and converted already
elsif Nkind (N) /= N_Aggregate then
return True;
- -- If component associations remain, the aggregate is not static.
+ -- If component associations remain, the aggregate is not static
elsif Present (Component_Associations (N)) then
return False;
@@ -6460,17 +6461,17 @@ package body Exp_Aggr is
Comp_Val : Uint;
-- integer value of component
- Incr : Int;
+ Incr : Int;
-- Step size for packing
Init_Shift : Int;
- -- endian-dependent start position for packing
+ -- Endian-dependent start position for packing
Shift : Int;
- -- current insertion position
+ -- Current insertion position
- Val : Int;
- -- component of packed array being assembled.
+ Val : Int;
+ -- Component of packed array being assembled.
begin
Comps := New_List;
@@ -6485,10 +6486,10 @@ package body Exp_Aggr is
xor Reverse_Storage_Order (Base_Type (Typ))
then
Init_Shift := Byte_Size - Comp_Size;
- Incr := -Comp_Size;
+ Incr := -Comp_Size;
else
Init_Shift := 0;
- Incr := +Comp_Size;
+ Incr := +Comp_Size;
end if;
Shift := Init_Shift;
@@ -6531,7 +6532,7 @@ package body Exp_Aggr is
if Packed_Num > 0 then
- -- Add final incomplete byte if present.
+ -- Add final incomplete byte if present
Append (Make_Integer_Literal (Sloc (One_Dim), Val), Comps);
end if;
@@ -6540,8 +6541,8 @@ package body Exp_Aggr is
Unchecked_Convert_To (Typ,
Make_Qualified_Expression (Loc,
Subtype_Mark => New_Occurrence_Of (Packed_Array, Loc),
- Expression =>
- Make_Aggregate (Loc, Expressions => Comps))));
+ Expression =>
+ Make_Aggregate (Loc, Expressions => Comps))));
Analyze_And_Resolve (N);
return True;
end;