* 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
This commit is contained in:
Robert Dewar 2001-12-05 02:36:13 +00:00 committed by Geert Bosch
parent d61bd65a64
commit f311e16612
3 changed files with 45 additions and 24 deletions

View File

@ -1,3 +1,12 @@
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>
* bindgen.adb:

View File

@ -454,8 +454,14 @@ package body Ch12 is
TF_Semicolon;
else
Decl_Node := Error;
if Token = Tok_Semicolon then
-- Avoid further cascaded errors.
Scan;
end if;
end if;
return Decl_Node;
end P_Formal_Type_Declaration;

View File

@ -1702,6 +1702,10 @@ package body Sem_Ch12 is
Subp : Entity_Id;
begin
if Nam = Error then
return;
end if;
if Nkind (Nam) = N_Defining_Program_Unit_Name then
Error_Msg_N ("name of formal subprogram must be a direct name", Nam);
return;
@ -1858,45 +1862,47 @@ package body Sem_Ch12 is
-- Enter the new name, and branch to specific routine.
case Nkind (Def) is
when N_Formal_Private_Type_Definition
=> Analyze_Formal_Private_Type (N, T, Def);
when N_Formal_Private_Type_Definition =>
Analyze_Formal_Private_Type (N, T, Def);
when N_Formal_Derived_Type_Definition
=> Analyze_Formal_Derived_Type (N, T, Def);
when N_Formal_Derived_Type_Definition =>
Analyze_Formal_Derived_Type (N, T, Def);
when N_Formal_Discrete_Type_Definition
=> Analyze_Formal_Discrete_Type (T, Def);
when N_Formal_Discrete_Type_Definition =>
Analyze_Formal_Discrete_Type (T, Def);
when N_Formal_Signed_Integer_Type_Definition
=> Analyze_Formal_Signed_Integer_Type (T, Def);
when N_Formal_Signed_Integer_Type_Definition =>
Analyze_Formal_Signed_Integer_Type (T, Def);
when N_Formal_Modular_Type_Definition
=> Analyze_Formal_Modular_Type (T, Def);
when N_Formal_Modular_Type_Definition =>
Analyze_Formal_Modular_Type (T, Def);
when N_Formal_Floating_Point_Definition
=> Analyze_Formal_Floating_Type (T, Def);
when N_Formal_Floating_Point_Definition =>
Analyze_Formal_Floating_Type (T, Def);
when N_Formal_Ordinary_Fixed_Point_Definition
=> Analyze_Formal_Ordinary_Fixed_Point_Type (T, Def);
when N_Formal_Ordinary_Fixed_Point_Definition =>
Analyze_Formal_Ordinary_Fixed_Point_Type (T, Def);
when N_Formal_Decimal_Fixed_Point_Definition
=> Analyze_Formal_Decimal_Fixed_Point_Type (T, Def);
when N_Formal_Decimal_Fixed_Point_Definition =>
Analyze_Formal_Decimal_Fixed_Point_Type (T, Def);
when N_Array_Type_Definition
=> Analyze_Formal_Array_Type (T, Def);
when N_Array_Type_Definition =>
Analyze_Formal_Array_Type (T, Def);
when N_Access_To_Object_Definition |
N_Access_Function_Definition |
N_Access_Procedure_Definition
=> Analyze_Generic_Access_Type (T, Def);
when N_Access_To_Object_Definition |
N_Access_Function_Definition |
N_Access_Procedure_Definition =>
Analyze_Generic_Access_Type (T, Def);
when others =>
when N_Error =>
null;
when others =>
raise Program_Error;
end case;
Set_Is_Generic_Type (T);
end Analyze_Formal_Type_Declaration;
------------------------------------