summaryrefslogtreecommitdiff
path: root/gcc/ada/par-ch3.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-01 10:44:17 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-01 10:44:17 +0000
commitacf8ff3cc74bf973aa3e4f2a4cde891af96a3c75 (patch)
treefcb9750894d91c940bf8e42a64a8b194d9fff81f /gcc/ada/par-ch3.adb
parent915e412789c55d34e1809deae9a39c6a9fc5543e (diff)
downloadgcc-acf8ff3cc74bf973aa3e4f2a4cde891af96a3c75.tar.gz
2008-08-01 Robert Dewar <dewar@adacore.com>
* par-ch3.adb (P_Defining_Identifier): Avoid repeated attempt to convert plain identifier into defining identifier. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138510 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/par-ch3.adb')
-rw-r--r--gcc/ada/par-ch3.adb16
1 files changed, 13 insertions, 3 deletions
diff --git a/gcc/ada/par-ch3.adb b/gcc/ada/par-ch3.adb
index 87ea4007d47..9a5a8d39345 100644
--- a/gcc/ada/par-ch3.adb
+++ b/gcc/ada/par-ch3.adb
@@ -206,6 +206,18 @@ package body Ch3 is
Ident_Node := Token_Node;
Scan; -- past the reserved identifier
+ -- If we already have a defining identifier, clean it out and make
+ -- a new clean identifier. This situation arises in some error cases
+ -- and we need to fix it.
+
+ if Nkind (Ident_Node) = N_Defining_Identifier then
+ Ident_Node :=
+ Make_Identifier (Sloc (Ident_Node),
+ Chars => Chars (Ident_Node));
+ end if;
+
+ -- Change identifier to defining identifier if not in error
+
if Ident_Node /= Error then
Change_Identifier_To_Defining_Identifier (Ident_Node);
end if;
@@ -290,8 +302,7 @@ package body Ch3 is
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!
+ -- Otherwise this is an error case
else
T_Type;
@@ -1349,7 +1360,6 @@ package body Ch3 is
-- If we have a comma, then scan out the list of identifiers
elsif Token = Tok_Comma then
-
while Comma_Present loop
Num_Idents := Num_Idents + 1;
Idents (Num_Idents) := P_Defining_Identifier (C_Comma_Colon);