summaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2010-06-22 10:14:31 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2010-06-22 10:14:31 +0200
commit719aaf4d093d5dbde845a58b12a9fc8ac7d04f1f (patch)
treeb9732e84e542d2ca2db758a81c6a56807a4cc758 /gcc/ada
parent946db1e20e437ab14cf52a5414a46a2b772a6228 (diff)
downloadgcc-719aaf4d093d5dbde845a58b12a9fc8ac7d04f1f.tar.gz
[multiple changes]
2010-06-22 Ed Schonberg <schonberg@adacore.com> * sem_ch8.adb (Add_Implicit_Operator): If the context of the expanded name is a call, use the number of actuals to determine whether this is a binary or unary operator, rather than relying on later information to resolve the overload. 2010-06-22 Robert Dewar <dewar@adacore.com> * sem_ch10.adb, sem_aggr.adb: Minor reformatting. From-SVN: r161142
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog11
-rw-r--r--gcc/ada/sem_aggr.adb9
-rw-r--r--gcc/ada/sem_ch10.adb1
-rw-r--r--gcc/ada/sem_ch8.adb39
4 files changed, 50 insertions, 10 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index b6f14bcda95..61efea18bb3 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,14 @@
+2010-06-22 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch8.adb (Add_Implicit_Operator): If the context of the expanded
+ name is a call, use the number of actuals to determine whether this is
+ a binary or unary operator, rather than relying on later information
+ to resolve the overload.
+
+2010-06-22 Robert Dewar <dewar@adacore.com>
+
+ * sem_ch10.adb, sem_aggr.adb: Minor reformatting.
+
2010-06-22 Robert Dewar <dewar@adacore.com>
* sem_ch3.adb, sem_disp.adb: Minor code fixes.
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index be264dbad15..d487c442599 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -3503,8 +3503,8 @@ package body Sem_Aggr is
-- subaggregate is needed.
Capture_Discriminants : declare
- Loc : constant Source_Ptr := Sloc (N);
- Expr : Node_Id;
+ Loc : constant Source_Ptr := Sloc (N);
+ Expr : Node_Id;
procedure Add_Discriminant_Values
(New_Aggr : Node_Id;
@@ -3610,7 +3610,6 @@ package body Sem_Aggr is
New_Aggr : Node_Id;
begin
-
Inner_Comp := First_Component (Etype (Comp));
while Present (Inner_Comp) loop
Comp_Type := Etype (Inner_Comp);
@@ -3623,7 +3622,7 @@ package body Sem_Aggr is
Set_Etype (New_Aggr, Comp_Type);
Add_Association
(Inner_Comp, New_Aggr,
- Component_Associations (Aggr));
+ Component_Associations (Aggr));
-- Collect discriminant values and recurse
@@ -3673,7 +3672,7 @@ package body Sem_Aggr is
else
declare
- Comp : Entity_Id;
+ Comp : Entity_Id;
begin
-- If the type has additional components, create
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index cc47653da1c..8d0fa4739a4 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -2208,7 +2208,6 @@ package body Sem_Ch10 is
if Present (Enclosing_Child) then
Install_Siblings (Enclosing_Child, N);
end if;
-
end if;
Analyze (Proper_Body (Unit (N)));
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index c95b8e54d12..8a06f11e1e7 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -6029,12 +6029,43 @@ package body Sem_Ch8 is
Change_Selected_Component_To_Expanded_Name (N);
end if;
- Add_One_Interp (N, Predef_Op, T);
+ -- If the context is an unanalyzed function call, determine whether
+ -- a binary or unary interpretation is required.
- -- For operators with unary and binary interpretations, add both
+ if Nkind (Parent (N)) = N_Indexed_Component then
+ declare
+ Is_Binary_Call : constant Boolean
+ := Present (Next (First (Expressions (Parent (N)))));
+ Is_Binary_Op : constant Boolean
+ := First_Entity (Predef_Op) /= Last_Entity (Predef_Op);
+ Predef_Op2 : constant Entity_Id := Homonym (Predef_Op);
+
+ begin
+ if Is_Binary_Call then
+ if Is_Binary_Op then
+ Add_One_Interp (N, Predef_Op, T);
+ else
+ Add_One_Interp (N, Predef_Op2, T);
+ end if;
- if Present (Homonym (Predef_Op)) then
- Add_One_Interp (N, Homonym (Predef_Op), T);
+ else
+ if not Is_Binary_Op then
+ Add_One_Interp (N, Predef_Op, T);
+ else
+ Add_One_Interp (N, Predef_Op2, T);
+ end if;
+ end if;
+ end;
+
+ else
+ Add_One_Interp (N, Predef_Op, T);
+
+ -- For operators with unary and binary interpretations, if
+ -- context is not a call, add both
+
+ if Present (Homonym (Predef_Op)) then
+ Add_One_Interp (N, Homonym (Predef_Op), T);
+ end if;
end if;
-- The node is a reference to a predefined operator, and