aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2007-08-14 10:48:56 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2007-08-14 10:48:56 +0200
commit4210c97522243841b6537f1e65dbcea5a726ef46 (patch)
tree5ebe182878d7cdfd5165787aac415d6d8252647a /gcc
parentb63e38373ac562255170a83368a892ddfb77c98e (diff)
downloadgcc-4210c97522243841b6537f1e65dbcea5a726ef46.zip
gcc-4210c97522243841b6537f1e65dbcea5a726ef46.tar.gz
gcc-4210c97522243841b6537f1e65dbcea5a726ef46.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/par-ch6.adb29
1 files changed, 21 insertions, 8 deletions
diff --git a/gcc/ada/par-ch6.adb b/gcc/ada/par-ch6.adb
index 903cc4e..a5262f4 100644
--- a/gcc/ada/par-ch6.adb
+++ b/gcc/ada/par-ch6.adb
@@ -6,7 +6,7 @@
-- --
-- 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 --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -989,6 +989,7 @@ package body Ch6 is
Ident : Nat;
Ident_Sloc : Source_Ptr;
Not_Null_Present : Boolean := False;
+ Not_Null_Sloc : Source_Ptr;
Idents : array (Int range 1 .. 4096) of Entity_Id;
-- This array holds the list of defining identifiers. The upper bound
@@ -1087,6 +1088,7 @@ package body Ch6 is
-- Scan possible NOT NULL for Ada 2005 (AI-231, AI-447)
+ Not_Null_Sloc := Token_Ptr;
Not_Null_Present :=
P_Null_Exclusion (Allow_Anonymous_In_95 => True);
@@ -1109,8 +1111,19 @@ package body Ch6 is
else
if Token = Tok_In or else Token = Tok_Out then
if Not_Null_Present then
- Error_Msg_SC
- ("ACCESS must be placed after the parameter mode");
+ Error_Msg
+ ("`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;
P_Mode (Specification_Node);
@@ -1454,14 +1467,14 @@ package body Ch6 is
begin
Scan; -- past RETURN
- -- Simple_return_statement, no expression, return an N_Return_Statement
- -- node with the expression field left Empty.
+ -- Simple_return_statement, no expression, return an
+ -- N_Simple_Return_Statement node with the expression field left Empty.
if Token = Tok_Semicolon then
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
-- Simple_return_statement with expression
@@ -1471,7 +1484,7 @@ package body Ch6 is
-- message is probably that we have a missing semicolon.
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
Set_Expression (Return_Node, P_Expression_No_Right_Paren);