]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* sem_ch12.adb:
authorRobert Dewar <dewar@gnat.com>
Wed, 5 Dec 2001 02:36:13 +0000 (02:36 +0000)
committerGeert Bosch <bosch@gcc.gnu.org>
Wed, 5 Dec 2001 02:36:13 +0000 (03:36 +0100)
(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

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

index a1f08e2d18d3c1fe5b989c07487bd416d13403f4..3153721082247b0cbf9d7e3040b2d3c70100ea67 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 5d5dded4d30a740757931d663185e5a393f92551..5a8b9e34a3b555e9b25592e7faad20276f9b674b 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 a345a41550ead009de9ab381834866c49cbdc9d3..bf6892d55c0891b493952519b2293afbac9c50de 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;
 
    ------------------------------------