Commit 5c736541 by Robert Dewar Committed by Geert Bosch

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
parent a153ae15
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) 2001-10-08 Richard Kenner (kenner@gnat.com)
* misc.c (gnat_expand_expr, case UNCHECKED_CONVERT_EXPR): * misc.c (gnat_expand_expr, case UNCHECKED_CONVERT_EXPR):
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- $Revision: 1.205 $ -- $Revision$
-- -- -- --
-- Copyright (C) 1992-2001, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
-- -- -- --
...@@ -842,13 +842,17 @@ package body Atree is ...@@ -842,13 +842,17 @@ package body Atree is
Dummy : Node_Id; Dummy : Node_Id;
begin begin
-- Allocate Empty and Error nodes -- Allocate Empty node
Dummy := New_Node (N_Empty, No_Location); Dummy := New_Node (N_Empty, No_Location);
Set_Name1 (Empty, No_Name); 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); Dummy := New_Node (N_Error, No_Location);
Set_Name1 (Error, Error_Name); Set_Name1 (Error, Error_Name);
Set_Error_Posted (Error, True);
end Initialize; end Initialize;
-------------------------- --------------------------
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- $Revision: 1.213 $ -- $Revision$
-- -- -- --
-- Copyright (C) 1992-2001 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
-- -- -- --
...@@ -1216,6 +1216,9 @@ package body CStand is ...@@ -1216,6 +1216,9 @@ package body CStand is
Last_Standard_Node_Id := Last_Node_Id; Last_Standard_Node_Id := Last_Node_Id;
Last_Standard_List_Id := Last_List_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; end Create_Standard;
------------------------------------ ------------------------------------
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- $Revision: 1.61 $ -- $Revision$
-- -- -- --
-- Copyright (C) 1992-2001, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
-- -- -- --
...@@ -791,7 +791,7 @@ package body Endh is ...@@ -791,7 +791,7 @@ package body Endh is
-- Suppress message if error was posted on opening label -- 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) and then Error_Posted (Error_Msg_Node_1)
then then
return; return;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- $Revision: 1.126 $ -- $Revision$
-- -- -- --
-- Copyright (C) 1992-2001 Free Software Foundation, Inc. -- -- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
-- -- -- --
...@@ -396,6 +396,7 @@ function Par (Configuration_Pragmas : Boolean) return List_Id is ...@@ -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. -- 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, -- 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. -- 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; Decl : List_Id;
-- Points to the list of declarations (i.e. the declarative part) -- Points to the list of declarations (i.e. the declarative part)
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- $Revision: 1.717 $ -- $Revision$
-- -- -- --
-- Copyright (C) 1992-2001, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
-- -- -- --
...@@ -1327,6 +1327,10 @@ package body Sem_Res is ...@@ -1327,6 +1327,10 @@ package body Sem_Res is
-- Start of processing for Resolve -- Start of processing for Resolve
begin begin
if N = Error then
return;
end if;
-- Access attribute on remote subprogram cannot be used for -- Access attribute on remote subprogram cannot be used for
-- a non-remote access-to-subprogram type. -- a non-remote access-to-subprogram type.
...@@ -3496,6 +3500,11 @@ package body Sem_Res is ...@@ -3496,6 +3500,11 @@ package body Sem_Res is
else else
R := Range_Expression (Constraint (N)); R := Range_Expression (Constraint (N));
if R = Error then
return;
end if;
Analyze (R); Analyze (R);
if Base_Type (S) /= Base_Type (Typ) then if Base_Type (S) /= Base_Type (Typ) then
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- $Revision: 1.430 $ -- $Revision: 1.1 $
-- -- -- --
-- Copyright (C) 1992-2001, Free Software Foundation, Inc. -- -- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
-- -- -- --
...@@ -6210,18 +6210,23 @@ package Sinfo is ...@@ -6210,18 +6210,23 @@ package Sinfo is
-- Empty -- -- Empty --
----------- -----------
-- N_Empty
-- Chars (Name1) is set to No_Name
-- Used as the contents of the Nkind field of the dummy Empty node -- Used as the contents of the Nkind field of the dummy Empty node
-- and in some other situations to indicate an uninitialized value. -- and in some other situations to indicate an uninitialized value.
-- N_Empty
-- Chars (Name1) is set to No_Name
----------- -----------
-- Error -- -- 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 -- N_Error
-- Chars (Name1) is set to Error_Name -- 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 -- -- Node Type Definition --
...@@ -6248,10 +6253,12 @@ package Sinfo is ...@@ -6248,10 +6253,12 @@ package Sinfo is
-- N_Has_Chars -- N_Has_Chars
N_Empty, N_Empty,
N_Error,
N_Pragma, N_Pragma,
N_Pragma_Argument_Association, N_Pragma_Argument_Association,
-- N_Has_Etype
N_Error,
-- N_Entity, N_Has_Etype, N_Has_Chars -- N_Entity, N_Has_Etype, N_Has_Chars
N_Defining_Character_Literal, N_Defining_Character_Literal,
N_Defining_Identifier, N_Defining_Identifier,
...@@ -6587,7 +6594,7 @@ package Sinfo is ...@@ -6587,7 +6594,7 @@ package Sinfo is
-- Warning: DOES NOT INCLUDE N_Freeze_Entity! -- Warning: DOES NOT INCLUDE N_Freeze_Entity!
subtype N_Has_Etype is Node_Kind range subtype N_Has_Etype is Node_Kind range
N_Defining_Character_Literal .. N_Error ..
N_Subtype_Indication; N_Subtype_Indication;
subtype N_Later_Decl_Item is Node_Kind range subtype N_Later_Decl_Item is Node_Kind range
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment