summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch4.adb
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2007-08-31 12:24:10 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2007-08-31 12:24:10 +0200
commit9c5108032251ba012f8671abaf40a6a58d83efc5 (patch)
tree0d6a52ff3b47753a1b7d93ce02531ac9dca15f43 /gcc/ada/sem_ch4.adb
parentc19d161545bb1c8c58dbc23b6f708b12403193f3 (diff)
downloadgcc-9c5108032251ba012f8671abaf40a6a58d83efc5.tar.gz
sem_ch3.adb: The predicate Is_Descendent_Of_Address is now an entity flag, for effiency.
2007-08-31 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb: The predicate Is_Descendent_Of_Address is now an entity flag, for effiency. It is called when analyzing arithmetic operators and also for actuals in calls that are universal_integers. The flag is set for the predefined type address, and for any type or subtype derived from it. * sem_ch4.adb (Analyze_One_Call): Reject an actual that is a Universal_Integer, when the formal is a descendent of address and the call appears in user code. (Analyze_Selected_Component): if the prefix is a private extension, the tag component is visible. * sem_util.ads, sem_util.adb: Remove Is_Descendent_Of_Address, now an entity flag. From-SVN: r127980
Diffstat (limited to 'gcc/ada/sem_ch4.adb')
-rw-r--r--gcc/ada/sem_ch4.adb32
1 files changed, 28 insertions, 4 deletions
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 6530cb4a1ac..3eec997f240 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -2136,6 +2136,8 @@ package body Sem_Ch4 is
-- of the analysis of the call with the user-defined operation,
-- because the parameter names may be wrong and yet the hiding
-- takes place. Fixes b34014o.
+ -- The abstract operations on address do not hide the predefined
+ -- operator (this is the purpose of making them abstract).
if Is_Overloaded (Name (N)) then
declare
@@ -2146,6 +2148,11 @@ package body Sem_Ch4 is
Get_First_Interp (Name (N), I, It);
while Present (It.Nam) loop
if Ekind (It.Nam) /= E_Operator
+ and then not
+ (Is_Abstract_Subprogram (It.Nam)
+ and then
+ Is_Descendent_Of_Address
+ (Etype (First_Formal (It.Nam))))
and then Hides_Op (It.Nam, Nam)
and then
Has_Compatible_Type
@@ -2196,7 +2203,21 @@ package body Sem_Ch4 is
if Nkind (Parent (Actual)) /= N_Parameter_Association
or else Chars (Selector_Name (Parent (Actual))) = Chars (Formal)
then
- if Has_Compatible_Type (Actual, Etype (Formal)) then
+ -- The actual can be compatible with the formal, but we must
+ -- also check that the context is not an address type that is
+ -- visibly an integer type, as is the case in VMS_64. In this
+ -- case the use of literals is illegal, except in the body of
+ -- descendents of system, where arithmetic operations on
+ -- address are of course used.
+
+ if Has_Compatible_Type (Actual, Etype (Formal))
+ and then
+ (Etype (Actual) /= Universal_Integer
+ or else not Is_Descendent_Of_Address (Etype (Formal))
+ or else
+ Is_Predefined_File_Name
+ (Unit_File_Name (Get_Source_Unit (N))))
+ then
Next_Actual (Actual);
Next_Formal (Formal);
@@ -2889,9 +2910,12 @@ package body Sem_Ch4 is
end if;
-- If the prefix is a private extension, check only the visible
- -- components of the partial view.
+ -- components of the partial view. This must include the tag,
+ -- wich can appear in expanded code in a tag check.
- if Ekind (Type_To_Use) = E_Record_Type_With_Private then
+ if Ekind (Type_To_Use) = E_Record_Type_With_Private
+ and then Chars (Selector_Name (N)) /= Name_uTag
+ then
exit when Comp = Last_Entity (Type_To_Use);
end if;
@@ -4855,7 +4879,7 @@ package body Sem_Ch4 is
exit;
-- In Ada 2005, this operation does not participate in Overload
- -- resolution. If the operation is defined in in a predefined
+ -- resolution. If the operation is defined in a predefined
-- unit, it is one of the operations declared abstract in some
-- variants of System, and it must be removed as well.