Commit 4210c975 by Javier Miranda Committed by Arnaud Charlet

par-ch6.adb (P_Formal_Part): Fix wrong error message associated with null-excluding access types.

2007-08-14  Javier Miranda  <miranda@adacore.com>

	* par-ch6.adb (P_Formal_Part): Fix wrong error message associated with
	null-excluding access types.

From-SVN: r127457
parent b63e3837
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 1992-2006, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2007, 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- --
...@@ -989,6 +989,7 @@ package body Ch6 is ...@@ -989,6 +989,7 @@ package body Ch6 is
Ident : Nat; Ident : Nat;
Ident_Sloc : Source_Ptr; Ident_Sloc : Source_Ptr;
Not_Null_Present : Boolean := False; Not_Null_Present : Boolean := False;
Not_Null_Sloc : Source_Ptr;
Idents : array (Int range 1 .. 4096) of Entity_Id; Idents : array (Int range 1 .. 4096) of Entity_Id;
-- This array holds the list of defining identifiers. The upper bound -- This array holds the list of defining identifiers. The upper bound
...@@ -1087,6 +1088,7 @@ package body Ch6 is ...@@ -1087,6 +1088,7 @@ package body Ch6 is
-- Scan possible NOT NULL for Ada 2005 (AI-231, AI-447) -- Scan possible NOT NULL for Ada 2005 (AI-231, AI-447)
Not_Null_Sloc := Token_Ptr;
Not_Null_Present := Not_Null_Present :=
P_Null_Exclusion (Allow_Anonymous_In_95 => True); P_Null_Exclusion (Allow_Anonymous_In_95 => True);
...@@ -1109,8 +1111,19 @@ package body Ch6 is ...@@ -1109,8 +1111,19 @@ package body Ch6 is
else else
if Token = Tok_In or else Token = Tok_Out then if Token = Tok_In or else Token = Tok_Out then
if Not_Null_Present then if Not_Null_Present then
Error_Msg_SC Error_Msg
("ACCESS must be placed after the parameter mode"); ("`NOT NULL` can only be used with `ACCESS`",
Not_Null_Sloc);
if Token = Tok_In then
Error_Msg
("\`IN` not allowed together with `ACCESS`",
Not_Null_Sloc);
else
Error_Msg
("\`OUT` not allowed together with `ACCESS`",
Not_Null_Sloc);
end if;
end if; end if;
P_Mode (Specification_Node); P_Mode (Specification_Node);
...@@ -1454,14 +1467,14 @@ package body Ch6 is ...@@ -1454,14 +1467,14 @@ package body Ch6 is
begin begin
Scan; -- past RETURN Scan; -- past RETURN
-- Simple_return_statement, no expression, return an N_Return_Statement -- Simple_return_statement, no expression, return an
-- node with the expression field left Empty. -- N_Simple_Return_Statement node with the expression field left Empty.
if Token = Tok_Semicolon then if Token = Tok_Semicolon then
Scan; -- past ; Scan; -- past ;
Return_Node := New_Node (N_Return_Statement, Return_Sloc); Return_Node := New_Node (N_Simple_Return_Statement, Return_Sloc);
-- Non-simple case -- Non-trivial case
else else
-- Simple_return_statement with expression -- Simple_return_statement with expression
...@@ -1471,7 +1484,7 @@ package body Ch6 is ...@@ -1471,7 +1484,7 @@ package body Ch6 is
-- message is probably that we have a missing semicolon. -- message is probably that we have a missing semicolon.
if Is_Simple then if Is_Simple then
Return_Node := New_Node (N_Return_Statement, Return_Sloc); Return_Node := New_Node (N_Simple_Return_Statement, Return_Sloc);
if Token not in Token_Class_Eterm then if Token not in Token_Class_Eterm then
Set_Expression (Return_Node, P_Expression_No_Right_Paren); Set_Expression (Return_Node, P_Expression_No_Right_Paren);
......
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