aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch3.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2016-04-20 12:45:55 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2016-04-20 12:45:55 +0200
commit75a957f5dba310b73a1d040da70f6e4077379af4 (patch)
tree97ebf50af958de9b7d35ca951dc92ba8b70a8099 /gcc/ada/sem_ch3.adb
parentbc795e3e039342e74d2d2b0515dd190f7d24ec65 (diff)
downloadgcc-75a957f5dba310b73a1d040da70f6e4077379af4.zip
gcc-75a957f5dba310b73a1d040da70f6e4077379af4.tar.gz
gcc-75a957f5dba310b73a1d040da70f6e4077379af4.tar.bz2
[multiple changes]
2016-04-20 Hristian Kirtchev <kirtchev@adacore.com> * einfo.adb Flag286 is now used as Is_Exception_Handler. (Is_Exception_Handler): New routine. (Set_Is_Exception_Handler): New routine. (Write_Entity_Flags): Output the status of Is_Exception_Handler. * einfo.ads New attribute Is_Exception_Handler along with occurrences in entities. (Is_Exception_Handler): New routine along with pragma Inline. (Set_Is_Exception_Handler): New routine along with pragma Inline. * exp_ch7.adb (Make_Transient_Block): Ignore blocks generated for exception handlers with a choice parameter. * sem_ch11.adb (Analyze_Exception_Handlers): Mark the scope generated for a choice parameter as an exception handler. 2016-04-20 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Build_Derived_Access_Type): Remove dead code. (Constrain_Discriminated_Type): In an instance, if the type has unknown discriminants, use its full view. (Process_Subtype): Check that the base type is private before adding subtype to Private_Dependents list. 2016-04-20 Bob Duff <duff@adacore.com> * sem_ch13.adb: Minor comment fix. From-SVN: r235264
Diffstat (limited to 'gcc/ada/sem_ch3.adb')
-rw-r--r--gcc/ada/sem_ch3.adb31
1 files changed, 20 insertions, 11 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index f2e1115..cc82e71 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -5962,16 +5962,6 @@ package body Sem_Ch3 is
if Null_Exclusion_Present (Type_Definition (N)) then
Set_Can_Never_Be_Null (Derived_Type);
- -- What is with the "AND THEN FALSE" here ???
-
- if Can_Never_Be_Null (Parent_Type)
- and then False
- then
- Error_Msg_NE
- ("`NOT NULL` not allowed (& already excludes null)",
- N, Parent_Type);
- end if;
-
elsif Can_Never_Be_Null (Parent_Type) then
Set_Can_Never_Be_Null (Derived_Type);
end if;
@@ -5983,6 +5973,7 @@ package body Sem_Ch3 is
-- ??? THIS CODE SHOULD NOT BE HERE REALLY.
Desig_Type := Designated_Type (Derived_Type);
+
if Is_Composite_Type (Desig_Type)
and then (not Is_Array_Type (Desig_Type))
and then Has_Discriminants (Desig_Type)
@@ -13048,6 +13039,18 @@ package body Sem_Ch3 is
T := Designated_Type (T);
end if;
+ -- In an instance it may be necessary to retrieve the full view of a
+ -- type with unknown discriminants. In other contexts the constraint
+ -- is illegal.
+
+ if In_Instance
+ and then Is_Private_Type (T)
+ and then Has_Unknown_Discriminants (T)
+ and then Present (Full_View (T))
+ then
+ T := Full_View (T);
+ end if;
+
-- Ada 2005 (AI-412): Constrained incomplete subtypes are illegal.
-- Avoid generating an error for access-to-incomplete subtypes.
@@ -20745,7 +20748,13 @@ package body Sem_Ch3 is
when Private_Kind =>
Constrain_Discriminated_Type (Def_Id, S, Related_Nod);
- Set_Private_Dependents (Def_Id, New_Elmt_List);
+
+ -- The base type may be private but Def_Id may be a full view
+ -- in an instance.
+
+ if Is_Private_Type (Def_Id) then
+ Set_Private_Dependents (Def_Id, New_Elmt_List);
+ end if;
-- In case of an invalid constraint prevent further processing
-- since the type constructed is missing expected fields.