From: Ed Schonberg Date: Tue, 5 Aug 2008 08:17:02 +0000 (+0200) Subject: exp_strm.adb (Build_Record_Or_Elementary_Input_Function): For access discriminants... X-Git-Tag: releases/gcc-4.4.0~3383 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=864f786316a358dd59e5ba30c128a3e8bb479942;p=thirdparty%2Fgcc.git exp_strm.adb (Build_Record_Or_Elementary_Input_Function): For access discriminants... 2008-08-05 Ed Schonberg * 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. From-SVN: r138671 --- diff --git a/gcc/ada/exp_strm.adb b/gcc/ada/exp_strm.adb index 2ffa26a4cf9c..9c4befb5d24c 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),