This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Ada] Fix compilation abandoned message
- To: gcc-patches at gcc dot gnu dot org
- Subject: [Ada] Fix compilation abandoned message
- From: Geert Bosch <bosch at gnat dot com>
- Date: Mon, 8 Oct 2001 12:16:33 -0400 (EDT)
I applied this patch fixes "compilation abandoned" message while compiling
ACVC test B36171F with -gnatq. Tested on x86/GNU Linux.
-Geert
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).
*** atree.adb 2001/09/05 09:39:27 1.205
--- atree.adb 2001/10/07 15:18:23 1.206
***************
*** 842,854 ****
Dummy : Node_Id;
begin
! -- Allocate Empty and Error nodes
Dummy := New_Node (N_Empty, No_Location);
Set_Name1 (Empty, No_Name);
Dummy := New_Node (N_Error, No_Location);
Set_Name1 (Error, Error_Name);
!
end Initialize;
--------------------------
--- 842,858 ----
Dummy : Node_Id;
begin
! -- 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;
--------------------------
*** par-endh.adb 2001/09/22 14:46:11 1.61
--- par-endh.adb 2001/10/07 15:18:34 1.62
***************
*** 791,797 ****
-- Suppress message if error was posted on opening label
! if Present (Error_Msg_Node_1)
and then Error_Posted (Error_Msg_Node_1)
then
return;
--- 791,797 ----
-- Suppress message if error was posted on opening label
! if Error_Msg_Node_1 > Empty_Or_Error
and then Error_Posted (Error_Msg_Node_1)
then
return;
*** cstand.adb 2001/06/25 23:21:17 1.213
--- cstand.adb 2001/10/07 15:19:09 1.214
***************
*** 1216,1221 ****
--- 1216,1224 ----
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;
------------------------------------
*** par.adb 2001/06/20 17:36:11 1.126
--- par.adb 2001/10/07 15:19:18 1.127
***************
*** 396,401 ****
--- 396,402 ----
-- 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)
*** sem_res.adb 2001/09/27 01:05:43 1.719
--- sem_res.adb 2001/10/07 15:19:30 1.720
***************
*** 1327,1332 ****
--- 1327,1336 ----
-- 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.
***************
*** 3508,3513 ****
--- 3512,3522 ----
else
R := Range_Expression (Constraint (N));
+
+ if R = Error then
+ return;
+ end if;
+
Analyze (R);
if Base_Type (S) /= Base_Type (Typ) then
*** sinfo.ads 2001/10/06 19:43:06 1.431
--- sinfo.ads 2001/10/07 15:19:42 1.432
***************
*** 6229,6246 ****
-- 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.
-----------
-- Error --
-----------
-- N_Error
-- Chars (Name1) is set to Error_Name
! -- Used as the contents of the Nkind field of the dummy Error node
--------------------------
-- Node Type Definition --
--- 6229,6251 ----
-- Empty --
-----------
-- 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
! -- Etype (Node5-Sem)
--------------------------
-- Node Type Definition --
***************
*** 6267,6276 ****
-- N_Has_Chars
N_Empty,
- N_Error,
N_Pragma,
N_Pragma_Argument_Association,
-- N_Entity, N_Has_Etype, N_Has_Chars
N_Defining_Character_Literal,
N_Defining_Identifier,
--- 6272,6283 ----
-- N_Has_Chars
N_Empty,
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,
***************
*** 6606,6612 ****
-- Warning: DOES NOT INCLUDE N_Freeze_Entity!
subtype N_Has_Etype is Node_Kind range
! N_Defining_Character_Literal ..
N_Subtype_Indication;
subtype N_Later_Decl_Item is Node_Kind range
--- 6613,6619 ----
-- Warning: DOES NOT INCLUDE N_Freeze_Entity!
subtype N_Has_Etype is Node_Kind range
! N_Error ..
N_Subtype_Indication;
subtype N_Later_Decl_Item is Node_Kind range