aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRobert Dewar <dewar@adacore.com>2008-08-01 12:44:17 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2008-08-01 12:44:17 +0200
commit20b40e7b4413bac4698d39675c32ce4b0eb61e45 (patch)
treefcb9750894d91c940bf8e42a64a8b194d9fff81f /gcc
parent2eee5152fa5975e91ff916630c43e850b4550155 (diff)
downloadgcc-20b40e7b4413bac4698d39675c32ce4b0eb61e45.zip
gcc-20b40e7b4413bac4698d39675c32ce4b0eb61e45.tar.gz
gcc-20b40e7b4413bac4698d39675c32ce4b0eb61e45.tar.bz2
par-ch3.adb (P_Defining_Identifier): Avoid repeated attempt to convert plain identifier into defining identifier.
2008-08-01 Robert Dewar <dewar@adacore.com> * par-ch3.adb (P_Defining_Identifier): Avoid repeated attempt to convert plain identifier into defining identifier. From-SVN: r138510
Diffstat (limited to 'gcc')
-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 87ea4007..9a5a8d3 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);