Commit 9f0eed34 by Javier Miranda Committed by Arnaud Charlet

exp_strm.adb (Build_Stream_Attr_Profile, [...]): Add the null-excluding…

exp_strm.adb (Build_Stream_Attr_Profile, [...]): Add the null-excluding attribute to the first formal.

2005-11-14  Javier Miranda  <miranda@adacore.com>

	* exp_strm.adb (Build_Stream_Attr_Profile, Build_Stream_Function,
	Build_Stream_Procedure): Add the null-excluding attribute to the first
	formal.
	This has no semantic meaning under Ada95 mode but it is a
	requirement under Ada05 mode.

	* par-ch3.adb (P_Access_Definition): Addition of warning message if
	the null exclusion is used under Ada95 mode
	(P_Null_Exclusion): The qualifier has no semantic meaning in Ada 95.
	(P_Access_Definition): Remove assertion that forbids the use of
	the null-exclusion feature in Ada95.

From-SVN: r106977
parent 191cab8d
...@@ -1447,11 +1447,15 @@ package body Exp_Strm is ...@@ -1447,11 +1447,15 @@ package body Exp_Strm is
Profile : List_Id; Profile : List_Id;
begin begin
-- (Ada 2005: AI-441): Set the null-excluding attribute because it has
-- no semantic meaning in Ada 95 but it is a requirement in Ada2005.
Profile := New_List ( Profile := New_List (
Make_Parameter_Specification (Loc, Make_Parameter_Specification (Loc,
Defining_Identifier => Make_Defining_Identifier (Loc, Name_S), Defining_Identifier => Make_Defining_Identifier (Loc, Name_S),
Parameter_Type => Parameter_Type =>
Make_Access_Definition (Loc, Make_Access_Definition (Loc,
Null_Exclusion_Present => True,
Subtype_Mark => New_Reference_To ( Subtype_Mark => New_Reference_To (
Class_Wide_Type (RTE (RE_Root_Stream_Type)), Loc)))); Class_Wide_Type (RTE (RE_Root_Stream_Type)), Loc))));
...@@ -1483,6 +1487,9 @@ package body Exp_Strm is ...@@ -1483,6 +1487,9 @@ package body Exp_Strm is
begin begin
-- Construct function specification -- Construct function specification
-- (Ada 2005: AI-441): Set the null-excluding attribute because it has
-- no semantic meaning in Ada 95 but it is a requirement in Ada2005.
Spec := Spec :=
Make_Function_Specification (Loc, Make_Function_Specification (Loc,
Defining_Unit_Name => Fnam, Defining_Unit_Name => Fnam,
...@@ -1492,6 +1499,7 @@ package body Exp_Strm is ...@@ -1492,6 +1499,7 @@ package body Exp_Strm is
Defining_Identifier => Make_Defining_Identifier (Loc, Name_S), Defining_Identifier => Make_Defining_Identifier (Loc, Name_S),
Parameter_Type => Parameter_Type =>
Make_Access_Definition (Loc, Make_Access_Definition (Loc,
Null_Exclusion_Present => True,
Subtype_Mark => New_Reference_To ( Subtype_Mark => New_Reference_To (
Class_Wide_Type (RTE (RE_Root_Stream_Type)), Loc)))), Class_Wide_Type (RTE (RE_Root_Stream_Type)), Loc)))),
...@@ -1523,6 +1531,9 @@ package body Exp_Strm is ...@@ -1523,6 +1531,9 @@ package body Exp_Strm is
begin begin
-- Construct procedure specification -- Construct procedure specification
-- (Ada 2005: AI-441): Set the null-excluding attribute because it has
-- no semantic meaning in Ada 95 but it is a requirement in Ada2005.
Spec := Spec :=
Make_Procedure_Specification (Loc, Make_Procedure_Specification (Loc,
Defining_Unit_Name => Pnam, Defining_Unit_Name => Pnam,
...@@ -1532,6 +1543,7 @@ package body Exp_Strm is ...@@ -1532,6 +1543,7 @@ package body Exp_Strm is
Defining_Identifier => Make_Defining_Identifier (Loc, Name_S), Defining_Identifier => Make_Defining_Identifier (Loc, Name_S),
Parameter_Type => Parameter_Type =>
Make_Access_Definition (Loc, Make_Access_Definition (Loc,
Null_Exclusion_Present => True,
Subtype_Mark => New_Reference_To ( Subtype_Mark => New_Reference_To (
Class_Wide_Type (RTE (RE_Root_Stream_Type)), Loc))), Class_Wide_Type (RTE (RE_Root_Stream_Type)), Loc))),
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2005 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2005, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -914,10 +914,13 @@ package body Ch3 is ...@@ -914,10 +914,13 @@ package body Ch3 is
return False; return False;
else else
-- Ada 2005 (AI-441): The qualifier has no semantic meaning in Ada 95
-- (all access Parameters Are "not null" in Ada 95).
if Ada_Version < Ada_05 then if Ada_Version < Ada_05 then
Error_Msg_SP Error_Msg_SP
("null-excluding access is an Ada 2005 extension"); ("null-excluding access is an Ada 2005 extension?");
Error_Msg_SP ("\unit must be compiled with -gnat05 switch"); Error_Msg_SP ("\unit should be compiled with -gnat05 switch?");
end if; end if;
Scan; -- past NOT Scan; -- past NOT
...@@ -3813,11 +3816,6 @@ package body Ch3 is ...@@ -3813,11 +3816,6 @@ package body Ch3 is
-- Ada 95 -- Ada 95
else else
-- Ada 2005 (AI-254): The null-exclusion present is never present
-- in Ada 83 and Ada 95
pragma Assert (Null_Exclusion_Present = False);
Set_Null_Exclusion_Present (Def_Node, False); Set_Null_Exclusion_Present (Def_Node, False);
Set_Subtype_Mark (Def_Node, P_Subtype_Mark); Set_Subtype_Mark (Def_Node, P_Subtype_Mark);
No_Constraint; No_Constraint;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment