diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-05 08:17:02 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-05 08:17:02 +0000 |
commit | 5c0eef98965db4d159f8c35f3d04d181ae497370 (patch) | |
tree | 8c92330f2a89cee6944ab3774f564f21052acea5 /gcc/ada/exp_strm.adb | |
parent | 4c3bd32a4e803db91fd9d1b046b2dba1cedd7763 (diff) | |
download | gcc-5c0eef98965db4d159f8c35f3d04d181ae497370.tar.gz |
2008-08-05 Ed Schonberg <schonberg@adacore.com>
* exp_strm.adb (Build_Record_Or_Elementary_Input_Function): For access
discriminants, indicate that the corresponding object declaration has
no initialization, to prevent spurious warnings when the access type is
null-excluding.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138671 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_strm.adb')
-rw-r--r-- | gcc/ada/exp_strm.adb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/ada/exp_strm.adb b/gcc/ada/exp_strm.adb index 2ffa26a4cf9..9c4befb5d24 100644 --- a/gcc/ada/exp_strm.adb +++ b/gcc/ada/exp_strm.adb @@ -1113,12 +1113,22 @@ package body Exp_Strm is while Present (Discr) loop Cn := New_External_Name ('C', J); - Append_To (Decls, + Decl := Make_Object_Declaration (Loc, Defining_Identifier => Make_Defining_Identifier (Loc, Cn), Object_Definition => - New_Occurrence_Of (Etype (Discr), Loc))); + New_Occurrence_Of (Etype (Discr), Loc)); + + -- If the this is an access discriminant, do not perform default + -- initialization. The discriminant is about to get its value + -- from Read, and if the type is null excluding we do not want + -- spurious warnings on an initial null. + + if Is_Access_Type (Etype (Discr)) then + Set_No_Initialization (Decl); + end if; + Append_To (Decls, Decl); Append_To (Decls, Make_Attribute_Reference (Loc, Prefix => New_Occurrence_Of (Etype (Discr), Loc), |