Commit f311e166 by Robert Dewar Committed by Geert Bosch

* sem_ch12.adb:

	(Analyze_Formal_Type_Definition): Defend against Error.
	(Analyze_Formal_Subprogram): Defend against Error.

	* par-ch12.adb (F_Formal_Type_Declaration): In case of error,
	remove following semicolon if present. Removes cascaded error.

From-SVN: r47652
parent d61bd65a
2001-12-04 Robert Dewar <dewar@gnat.com>
* sem_ch12.adb:
(Analyze_Formal_Type_Definition): Defend against Error.
(Analyze_Formal_Subprogram): Defend against Error.
* par-ch12.adb (F_Formal_Type_Declaration): In case of error,
remove following semicolon if present. Removes cascaded error.
2001-12-04 Douglas B. Rupp <rupp@gnat.com> 2001-12-04 Douglas B. Rupp <rupp@gnat.com>
* bindgen.adb: * bindgen.adb:
......
...@@ -454,8 +454,14 @@ package body Ch12 is ...@@ -454,8 +454,14 @@ package body Ch12 is
TF_Semicolon; TF_Semicolon;
else else
Decl_Node := Error; Decl_Node := Error;
if Token = Tok_Semicolon then
-- Avoid further cascaded errors.
Scan;
end if;
end if; end if;
return Decl_Node; return Decl_Node;
end P_Formal_Type_Declaration; end P_Formal_Type_Declaration;
......
...@@ -1702,6 +1702,10 @@ package body Sem_Ch12 is ...@@ -1702,6 +1702,10 @@ package body Sem_Ch12 is
Subp : Entity_Id; Subp : Entity_Id;
begin begin
if Nam = Error then
return;
end if;
if Nkind (Nam) = N_Defining_Program_Unit_Name then if Nkind (Nam) = N_Defining_Program_Unit_Name then
Error_Msg_N ("name of formal subprogram must be a direct name", Nam); Error_Msg_N ("name of formal subprogram must be a direct name", Nam);
return; return;
...@@ -1858,45 +1862,47 @@ package body Sem_Ch12 is ...@@ -1858,45 +1862,47 @@ package body Sem_Ch12 is
-- Enter the new name, and branch to specific routine. -- Enter the new name, and branch to specific routine.
case Nkind (Def) is case Nkind (Def) is
when N_Formal_Private_Type_Definition when N_Formal_Private_Type_Definition =>
=> Analyze_Formal_Private_Type (N, T, Def); Analyze_Formal_Private_Type (N, T, Def);
when N_Formal_Derived_Type_Definition when N_Formal_Derived_Type_Definition =>
=> Analyze_Formal_Derived_Type (N, T, Def); Analyze_Formal_Derived_Type (N, T, Def);
when N_Formal_Discrete_Type_Definition when N_Formal_Discrete_Type_Definition =>
=> Analyze_Formal_Discrete_Type (T, Def); Analyze_Formal_Discrete_Type (T, Def);
when N_Formal_Signed_Integer_Type_Definition when N_Formal_Signed_Integer_Type_Definition =>
=> Analyze_Formal_Signed_Integer_Type (T, Def); Analyze_Formal_Signed_Integer_Type (T, Def);
when N_Formal_Modular_Type_Definition when N_Formal_Modular_Type_Definition =>
=> Analyze_Formal_Modular_Type (T, Def); Analyze_Formal_Modular_Type (T, Def);
when N_Formal_Floating_Point_Definition when N_Formal_Floating_Point_Definition =>
=> Analyze_Formal_Floating_Type (T, Def); Analyze_Formal_Floating_Type (T, Def);
when N_Formal_Ordinary_Fixed_Point_Definition when N_Formal_Ordinary_Fixed_Point_Definition =>
=> Analyze_Formal_Ordinary_Fixed_Point_Type (T, Def); Analyze_Formal_Ordinary_Fixed_Point_Type (T, Def);
when N_Formal_Decimal_Fixed_Point_Definition when N_Formal_Decimal_Fixed_Point_Definition =>
=> Analyze_Formal_Decimal_Fixed_Point_Type (T, Def); Analyze_Formal_Decimal_Fixed_Point_Type (T, Def);
when N_Array_Type_Definition when N_Array_Type_Definition =>
=> Analyze_Formal_Array_Type (T, Def); Analyze_Formal_Array_Type (T, Def);
when N_Access_To_Object_Definition | when N_Access_To_Object_Definition |
N_Access_Function_Definition | N_Access_Function_Definition |
N_Access_Procedure_Definition N_Access_Procedure_Definition =>
=> Analyze_Generic_Access_Type (T, Def); Analyze_Generic_Access_Type (T, Def);
when others => when N_Error =>
null;
when others =>
raise Program_Error; raise Program_Error;
end case; end case;
Set_Is_Generic_Type (T); Set_Is_Generic_Type (T);
end Analyze_Formal_Type_Declaration; end Analyze_Formal_Type_Declaration;
------------------------------------ ------------------------------------
......
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