summaryrefslogtreecommitdiff
path: root/gcc/ada/par-ch3.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-29 16:17:40 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-29 16:17:40 +0000
commite4bc3fb7236e050e6e3dba70ded5d9cf8b89a5c2 (patch)
tree1dfe244a348131643907bb281728ba59f495d509 /gcc/ada/par-ch3.adb
parent651597463775d688e0f2336e85f263e1931f7c6e (diff)
downloadgcc-e4bc3fb7236e050e6e3dba70ded5d9cf8b89a5c2.tar.gz
2005-03-29 Robert Dewar <dewar@adacore.com>
* par-ch3.adb (P_Type_Declaration): Fix bad error recovery after missing TYPE Improve the error message generated when compiling a limited interface in Ada83 or Ada95 mode. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97178 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/par-ch3.adb')
-rw-r--r--gcc/ada/par-ch3.adb34
1 files changed, 31 insertions, 3 deletions
diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb
index d28f1a9a07d..0c02ff7d035 100644
--- a/gcc/ada/par-ch3.adb
+++ b/gcc/ada/par-ch3.adb
@@ -279,8 +279,29 @@ package body Ch3 is
begin
Type_Loc := Token_Ptr;
Type_Start_Col := Start_Column;
- T_Type;
- Ident_Node := P_Defining_Identifier (C_Is);
+
+ -- If we have TYPE, then proceed ahead and scan identifier
+
+ if Token = Tok_Type then
+ Scan; -- past TYPE
+ Ident_Node := P_Defining_Identifier (C_Is);
+
+ -- Otherwise this is an error case, and we may already have converted
+ -- the current token to a defining identifier, so don't do it again!
+
+ else
+ T_Type;
+
+ if Token = Tok_Identifier
+ and then Nkind (Token_Node) = N_Defining_Identifier
+ then
+ Ident_Node := Token_Node;
+ Scan; -- past defining identifier
+ else
+ Ident_Node := P_Defining_Identifier (C_Is);
+ end if;
+ end if;
+
Discr_Sloc := Token_Ptr;
if P_Unknown_Discriminant_Part_Opt then
@@ -586,7 +607,14 @@ package body Ch3 is
-- Ada 2005 (AI-251): LIMITED INTERFACE
- elsif Token = Tok_Interface then
+ -- If we are compiling in Ada 83 or Ada 95 mode, "interface"
+ -- is not a reserved word but we force its analysis to
+ -- generate the corresponding usage error.
+
+ elsif Token = Tok_Interface
+ or else (Token = Tok_Identifier
+ and then Chars (Token_Node) = Name_Interface)
+ then
Typedef_Node := P_Interface_Type_Definition
(Is_Synchronized => False);
Abstract_Present := True;