summaryrefslogtreecommitdiff
path: root/gcc/ada/freeze.adb
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-05-27 19:20:19 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-05-27 19:20:19 +0000
commit488133ac66acbad4fbb7177438c6a651c3de8a07 (patch)
treef502522737a39b8803377a20fa7f25073cbd16d1 /gcc/ada/freeze.adb
parent5ed3bd072fbadb6e5dbac35a56dd35e94827b04d (diff)
downloadgcc-488133ac66acbad4fbb7177438c6a651c3de8a07.tar.gz
2008-05-27 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r136046 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@136051 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/freeze.adb')
-rw-r--r--gcc/ada/freeze.adb25
1 files changed, 24 insertions, 1 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 21b1ad5884c..31f93985c44 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -29,7 +29,9 @@ with Debug; use Debug;
with Einfo; use Einfo;
with Elists; use Elists;
with Errout; use Errout;
+with Exp_Ch3; use Exp_Ch3;
with Exp_Ch7; use Exp_Ch7;
+with Exp_Disp; use Exp_Disp;
with Exp_Pakd; use Exp_Pakd;
with Exp_Util; use Exp_Util;
with Exp_Tss; use Exp_Tss;
@@ -2650,10 +2652,31 @@ package body Freeze is
Validate_Object_Declaration (Declaration_Node (E));
- -- If there is an address clause, check it is valid
+ -- If there is an address clause, check that it is valid
Check_Address_Clause (E);
+ -- If the object needs any kind of default initialization, an
+ -- error must be issued if No_Default_Initialization applies.
+ -- The check doesn't apply to imported objects, which are not
+ -- ever default initialized, and is why the check is deferred
+ -- until freezing, at which point we know if Import applies.
+
+ if not Is_Imported (E)
+ and then not Has_Init_Expression (Declaration_Node (E))
+ and then
+ ((Has_Non_Null_Base_Init_Proc (Etype (E))
+ and then not No_Initialization (Declaration_Node (E))
+ and then not Is_Value_Type (Etype (E))
+ and then not Suppress_Init_Proc (Etype (E)))
+ or else
+ (Needs_Simple_Initialization (Etype (E))
+ and then not Is_Internal (E)))
+ then
+ Check_Restriction
+ (No_Default_Initialization, Declaration_Node (E));
+ end if;
+
-- For imported objects, set Is_Public unless there is also an
-- address clause, which means that there is no external symbol
-- needed for the Import (Is_Public may still be set for other