aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRobert Dewar <dewar@gnat.com>2001-10-08 16:15:06 +0000
committerGeert Bosch <bosch@gcc.gnu.org>2001-10-08 18:15:06 +0200
commit5c7365415f4e2ca35b9ddd05d05888210cd55d4b (patch)
tree4fa6043235cf58bee6726c72dce924b1b6e8327f /gcc
parenta153ae15978eb73d04afcf141aaac12b7c6e9356 (diff)
downloadgcc-5c7365415f4e2ca35b9ddd05d05888210cd55d4b.zip
gcc-5c7365415f4e2ca35b9ddd05d05888210cd55d4b.tar.gz
gcc-5c7365415f4e2ca35b9ddd05d05888210cd55d4b.tar.bz2
atree.adb: Set Error_Posted in Error node, helps error recovery.
* atree.adb: Set Error_Posted in Error node, helps error recovery. * par-endh.adb (Output_End_Expected): We should also not test Error_Posted on the Error node, since now it is always set. * cstand.adb (Create_Standard): Set Etype of Error to Any_Type to help error recovery. Part of general work on 9407-004. * par.adb: Add ??? for misuse of error * sem_res.adb: (Resolve): Defend against Error, fixes 9407-003. (Resolve_Discrete_Subtype_Indication): Defend against Error. * sinfo.ads (N_Error): Now has Etype field (which will be set to Any_Type to help error recovery). From-SVN: r46077
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog19
-rw-r--r--gcc/ada/atree.adb10
-rw-r--r--gcc/ada/cstand.adb5
-rw-r--r--gcc/ada/par-endh.adb4
-rw-r--r--gcc/ada/par.adb3
-rw-r--r--gcc/ada/sem_res.adb11
-rw-r--r--gcc/ada/sinfo.ads19
7 files changed, 57 insertions, 14 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 013a8f2..8801866 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,22 @@
+2001-10-08 Robert Dewar <dewar@gnat.com>
+
+ * atree.adb: Set Error_Posted in Error node, helps error recovery.
+
+ * par-endh.adb (Output_End_Expected): We should also not test
+ Error_Posted on the Error node, since now it is always set.
+
+ * cstand.adb (Create_Standard): Set Etype of Error to Any_Type
+ to help error recovery. Part of general work on 9407-004.
+
+ * par.adb: Add ??? for misuse of error
+
+ * sem_res.adb:
+ (Resolve): Defend against Error, fixes 9407-003.
+ (Resolve_Discrete_Subtype_Indication): Defend against Error.
+
+ * sinfo.ads (N_Error): Now has Etype field (which will be set
+ to Any_Type to help error recovery).
+
2001-10-08 Richard Kenner (kenner@gnat.com)
* misc.c (gnat_expand_expr, case UNCHECKED_CONVERT_EXPR):
diff --git a/gcc/ada/atree.adb b/gcc/ada/atree.adb
index d7b1af1..7bfff10 100644
--- a/gcc/ada/atree.adb
+++ b/gcc/ada/atree.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- $Revision: 1.205 $
+-- $Revision$
-- --
-- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
-- --
@@ -842,13 +842,17 @@ package body Atree is
Dummy : Node_Id;
begin
- -- Allocate Empty and Error nodes
+ -- Allocate Empty node
Dummy := New_Node (N_Empty, No_Location);
Set_Name1 (Empty, No_Name);
+
+ -- Allocate Error node, and set Error_Posted, since we certainly
+ -- only generate an Error node if we do post some kind of error!
+
Dummy := New_Node (N_Error, No_Location);
Set_Name1 (Error, Error_Name);
-
+ Set_Error_Posted (Error, True);
end Initialize;
--------------------------
diff --git a/gcc/ada/cstand.adb b/gcc/ada/cstand.adb
index 5f167fb..5ca383d 100644
--- a/gcc/ada/cstand.adb
+++ b/gcc/ada/cstand.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- $Revision: 1.213 $
+-- $Revision$
-- --
-- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
-- --
@@ -1216,6 +1216,9 @@ package body CStand is
Last_Standard_Node_Id := Last_Node_Id;
Last_Standard_List_Id := Last_List_Id;
+ -- The Error node has an Etype of Any_Type to help error recovery
+
+ Set_Etype (Error, Any_Type);
end Create_Standard;
------------------------------------
diff --git a/gcc/ada/par-endh.adb b/gcc/ada/par-endh.adb
index fa5b8c2..dfbe46c 100644
--- a/gcc/ada/par-endh.adb
+++ b/gcc/ada/par-endh.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- $Revision: 1.61 $
+-- $Revision$
-- --
-- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
-- --
@@ -791,7 +791,7 @@ package body Endh is
-- Suppress message if error was posted on opening label
- if Present (Error_Msg_Node_1)
+ if Error_Msg_Node_1 > Empty_Or_Error
and then Error_Posted (Error_Msg_Node_1)
then
return;
diff --git a/gcc/ada/par.adb b/gcc/ada/par.adb
index f45a83b..958a8a7 100644
--- a/gcc/ada/par.adb
+++ b/gcc/ada/par.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- $Revision: 1.126 $
+-- $Revision$
-- --
-- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
-- --
@@ -396,6 +396,7 @@ function Par (Configuration_Pragmas : Boolean) return List_Id is
-- field references an N_Defining_Program_Unit_Name node for the name.
-- For cases other than LOOP or BEGIN, the Label field is set to Error,
-- indicating that it is an error to have a label on the end line.
+ -- (this is really a misuse of Error since there is no Error ???)
Decl : List_Id;
-- Points to the list of declarations (i.e. the declarative part)
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 641b120..ae2b97c 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- $Revision: 1.717 $
+-- $Revision$
-- --
-- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
-- --
@@ -1327,6 +1327,10 @@ package body Sem_Res is
-- Start of processing for Resolve
begin
+ if N = Error then
+ return;
+ end if;
+
-- Access attribute on remote subprogram cannot be used for
-- a non-remote access-to-subprogram type.
@@ -3496,6 +3500,11 @@ package body Sem_Res is
else
R := Range_Expression (Constraint (N));
+
+ if R = Error then
+ return;
+ end if;
+
Analyze (R);
if Base_Type (S) /= Base_Type (Typ) then
diff --git a/gcc/ada/sinfo.ads b/gcc/ada/sinfo.ads
index 335f9fa..d6eca70 100644
--- a/gcc/ada/sinfo.ads
+++ b/gcc/ada/sinfo.ads
@@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
--- $Revision: 1.430 $
+-- $Revision: 1.1 $
-- --
-- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
-- --
@@ -6210,18 +6210,23 @@ package Sinfo is
-- Empty --
-----------
- -- N_Empty
- -- Chars (Name1) is set to No_Name
-- Used as the contents of the Nkind field of the dummy Empty node
-- and in some other situations to indicate an uninitialized value.
+ -- N_Empty
+ -- Chars (Name1) is set to No_Name
+
-----------
-- Error --
-----------
+ -- Used as the contents of the Nkind field of the dummy Error node.
+ -- Has an Etype field, which gets set to Any_Type later on, to help
+ -- error recovery (Error_Posted is also set in the Error node).
+
-- N_Error
-- Chars (Name1) is set to Error_Name
- -- Used as the contents of the Nkind field of the dummy Error node
+ -- Etype (Node5-Sem)
--------------------------
-- Node Type Definition --
@@ -6248,10 +6253,12 @@ package Sinfo is
-- N_Has_Chars
N_Empty,
- N_Error,
N_Pragma,
N_Pragma_Argument_Association,
+ -- N_Has_Etype
+ N_Error,
+
-- N_Entity, N_Has_Etype, N_Has_Chars
N_Defining_Character_Literal,
N_Defining_Identifier,
@@ -6587,7 +6594,7 @@ package Sinfo is
-- Warning: DOES NOT INCLUDE N_Freeze_Entity!
subtype N_Has_Etype is Node_Kind range
- N_Defining_Character_Literal ..
+ N_Error ..
N_Subtype_Indication;
subtype N_Later_Decl_Item is Node_Kind range