aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_ch13.adb
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2010-10-22 09:19:51 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2010-10-22 11:19:51 +0200
commit8110ee3b6349ae4b1a369996a25161dc6a0f067e (patch)
treefb2dd57e04140daa06885584791bb5dbdce45d10 /gcc/ada/exp_ch13.adb
parentca8e13e8554d22976e5afa8a73aab6531976486a (diff)
downloadgcc-8110ee3b6349ae4b1a369996a25161dc6a0f067e.zip
gcc-8110ee3b6349ae4b1a369996a25161dc6a0f067e.tar.gz
gcc-8110ee3b6349ae4b1a369996a25161dc6a0f067e.tar.bz2
checks.adb (Apply_Predicate_Check): Remove attempt at optimization when subtype is the same...
2010-10-22 Robert Dewar <dewar@adacore.com> * checks.adb (Apply_Predicate_Check): Remove attempt at optimization when subtype is the same, caused legitimate checks to be missed. * exp_ch13.adb (Build_Predicate_Function): Use Nearest_Ancestor to get inheritance from right entity. * freeze.adb (Freeze_Entity): Use Nearest_Ancestor to freeze in the derived type case if the ancestor type has predicates. * sem_aux.ads, sem_aux.adb (Nearest_Ancestor): New function. * sem_prag.adb (Check_Enabled): Minor code reorganization. From-SVN: r165807
Diffstat (limited to 'gcc/ada/exp_ch13.adb')
-rw-r--r--gcc/ada/exp_ch13.adb14
1 files changed, 3 insertions, 11 deletions
diff --git a/gcc/ada/exp_ch13.adb b/gcc/ada/exp_ch13.adb
index 8e9d2ca..4580ec2 100644
--- a/gcc/ada/exp_ch13.adb
+++ b/gcc/ada/exp_ch13.adb
@@ -152,7 +152,7 @@ package body Exp_Ch13 is
if Opt.List_Inherited_Aspects then
Error_Msg_Sloc := Sloc (Predicate_Function (T));
Error_Msg_Node_2 := T;
- Error_Msg_N ("?info: & inherits predicate from & at #", Typ);
+ Error_Msg_N ("?info: & inherits predicate from & #", Typ);
end if;
end if;
end Add_Call;
@@ -272,21 +272,13 @@ package body Exp_Ch13 is
Add_Predicates;
- -- Deal with ancestor subtype and parent type
+ -- Add predicates for ancestor if present
declare
- Atyp : constant Entity_Id := Ancestor_Subtype (Typ);
-
+ Atyp : constant Entity_Id := Nearest_Ancestor (Typ);
begin
- -- If ancestor subtype present, add its predicates
-
if Present (Atyp) then
Add_Call (Atyp);
-
- -- Else if this is derived, add predicates of parent type
-
- elsif Is_Derived_Type (Typ) then
- Add_Call (Etype (Base_Type (Typ)));
end if;
end;