aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2008-04-08 08:51:16 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2008-04-08 08:51:16 +0200
commit9cf50493b26f417dd358003ce0718315c7a262e2 (patch)
treea4e2ff3acf7498dca680bafe86bb3030a16a9ece
parent7f0b5314c46929b788c0d407038a8e2bf0767cca (diff)
downloadgcc-9cf50493b26f417dd358003ce0718315c7a262e2.zip
gcc-9cf50493b26f417dd358003ce0718315c7a262e2.tar.gz
gcc-9cf50493b26f417dd358003ce0718315c7a262e2.tar.bz2
exp_strm.adb (Build_Record_Or_Elementary_Input_Function): If this is an Input function for an access type...
2008-04-08 Ed Schonberg <schonberg@adacore.com> * exp_strm.adb (Build_Record_Or_Elementary_Input_Function): If this is an Input function for an access type, do not perform default initialization on the local variable that receives the value, to prevent spurious warnings when the type is null-excluding. From-SVN: r134032
-rw-r--r--gcc/ada/exp_strm.adb43
1 files changed, 25 insertions, 18 deletions
diff --git a/gcc/ada/exp_strm.adb b/gcc/ada/exp_strm.adb
index b2974dc..2ffa26a 100644
--- a/gcc/ada/exp_strm.adb
+++ b/gcc/ada/exp_strm.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2007, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2008, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -373,7 +373,7 @@ package body Exp_Strm is
-- array may be user-defined, and be frozen after the type for which
-- we are generating the stream subprogram. In that case, freeze the
-- stream attribute of the component type, whose declaration could not
- -- generate any additional freezing actions in any case. See 5509-003.
+ -- generate any additional freezing actions in any case.
if Nam = Name_Read then
RW := TSS (Base_Type (Ctyp), TSS_Stream_Read);
@@ -1092,13 +1092,14 @@ package body Exp_Strm is
Decl : out Node_Id;
Fnam : out Entity_Id)
is
- Cn : Name_Id;
- J : Pos;
- Decls : List_Id;
- Constr : List_Id;
- Stms : List_Id;
- Discr : Entity_Id;
- Odef : Node_Id;
+ Cn : Name_Id;
+ J : Pos;
+ Decls : List_Id;
+ Constr : List_Id;
+ Obj_Decl : Node_Id;
+ Stms : List_Id;
+ Discr : Entity_Id;
+ Odef : Node_Id;
begin
Decls := New_List;
@@ -1152,14 +1153,23 @@ package body Exp_Strm is
-- Perhaps we should just generate an extended return in all cases???
+ Obj_Decl :=
+ Make_Object_Declaration (Loc,
+ Defining_Identifier => Make_Defining_Identifier (Loc, Name_V),
+ Object_Definition => Odef);
+
+ -- If the type is an access type, do not perform default initialization.
+ -- The object 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 (Typ) then
+ Set_No_Initialization (Obj_Decl);
+ end if;
+
if Ada_Version >= Ada_05 then
Stms := New_List (
Make_Extended_Return_Statement (Loc,
- Return_Object_Declarations =>
- New_List (Make_Object_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc, Name_V),
- Object_Definition => Odef)),
+ Return_Object_Declarations => New_List (Obj_Decl),
Handled_Statement_Sequence =>
Make_Handled_Sequence_Of_Statements (Loc,
New_List (Make_Attribute_Reference (Loc,
@@ -1170,10 +1180,7 @@ package body Exp_Strm is
Make_Identifier (Loc, Name_V)))))));
else
- Append_To (Decls,
- Make_Object_Declaration (Loc,
- Defining_Identifier => Make_Defining_Identifier (Loc, Name_V),
- Object_Definition => Odef));
+ Append_To (Decls, Obj_Decl);
Stms := New_List (
Make_Attribute_Reference (Loc,