OSDN Git Service

* sem_ch12.adb:
authorbosch <bosch@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 5 Dec 2001 02:36:13 +0000 (02:36 +0000)
committerbosch <bosch@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 5 Dec 2001 02:36:13 +0000 (02:36 +0000)
(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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@47652 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/par-ch12.adb
gcc/ada/sem_ch12.adb

index a1f08e2..3153721 100644 (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:
index 5d5dded..5a8b9e3 100644 (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;
 
index a345a41..bf6892d 100644 (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;
 
    ------------------------------------