This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Fix BC1202A - "compilation abandoned" with -gnatq


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.

*** sem_ch12.adb	2001/10/07 17:30:26	1.785
--- sem_ch12.adb	2001/10/08 04:19:13	1.786
***************
*** 1705,1710 ****
--- 1705,1714 ----
        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;
***************
*** 1861,1905 ****
        --  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_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_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_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_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_Access_To_Object_Definition |
!               N_Access_Function_Definition  |
!               N_Access_Procedure_Definition
!                         => Analyze_Generic_Access_Type (T, Def);
  
!          when others =>
              raise Program_Error;
  
        end case;
  
        Set_Is_Generic_Type (T);
- 
     end Analyze_Formal_Type_Declaration;
  
     ------------------------------------
--- 1865,1911 ----
        --  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_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_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_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_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_Access_To_Object_Definition            |
!               N_Access_Function_Definition             |
!               N_Access_Procedure_Definition            =>
!             Analyze_Generic_Access_Type (T, Def);
  
!          when N_Error                                  =>
!             null;
! 
!          when others                                   =>
              raise Program_Error;
  
        end case;
  
        Set_Is_Generic_Type (T);
     end Analyze_Formal_Type_Declaration;
  
     ------------------------------------

*** par-ch12.adb	2001/10/18 15:18:57	1.47
--- par-ch12.adb	2001/10/19 15:22:18	1.48
***************
*** 454,460 ****
--- 454,466 ----
           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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]