From 8b4261b38284ef8b2f9f9c0a0f5f6c1b4f1d9dc7 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 20 Aug 2008 15:24:40 +0200 Subject: [PATCH] 2008-08-20 Gary Dismukes * exp_ch11.adb: (Expand_Exception_Handlers): Call Make_Exception_Handler instead of Make_Implicit_Exception_Handler when rewriting an exception handler with a choice parameter, and pass the handler's Sloc instead of that of the handled sequence of statements. Make_Implicit_Exception_Handler sets the Sloc to No_Location (unless debugging generated code), which we don't want for the case of a user handler. From-SVN: r139291 --- gcc/ada/ChangeLog | 14 ++++++++++++++ gcc/ada/exp_ch11.adb | 24 +++++++++++++++++------- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index d23dc1676b3..b868744fae0 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,17 @@ +2008-08-20 Ed Schonberg + + * sem_ch8.adb (Analyze_Subprogram_Renaming): Inherit Is_Imported flag. + +2008-08-20 Gary Dismukes + + * exp_ch11.adb: + (Expand_Exception_Handlers): Call Make_Exception_Handler instead of + Make_Implicit_Exception_Handler when rewriting an exception handler with + a choice parameter, and pass the handler's Sloc instead of that of the + handled sequence of statements. Make_Implicit_Exception_Handler sets the + Sloc to No_Location (unless debugging generated code), which we don't + want for the case of a user handler. + 2008-08-20 Robert Dewar * freeze.adb (Freeze_Record_Type): Improve msg for non-contiguous field diff --git a/gcc/ada/exp_ch11.adb b/gcc/ada/exp_ch11.adb index a8219fe7c9f..7ad1881151a 100644 --- a/gcc/ada/exp_ch11.adb +++ b/gcc/ada/exp_ch11.adb @@ -1011,7 +1011,8 @@ package body Exp_Ch11 is if Present (Choice_Parameter (Handler)) then declare Cparm : constant Entity_Id := Choice_Parameter (Handler); - Clc : constant Source_Ptr := Sloc (Cparm); + Cloc : constant Source_Ptr := Sloc (Cparm); + Hloc : constant Source_Ptr := Sloc (Handler); Save : Node_Id; begin @@ -1020,7 +1021,7 @@ package body Exp_Ch11 is Name => New_Occurrence_Of (RTE (RE_Save_Occurrence), Loc), Parameter_Associations => New_List ( - New_Occurrence_Of (Cparm, Clc), + New_Occurrence_Of (Cparm, Cloc), Make_Explicit_Dereference (Loc, Make_Function_Call (Loc, Name => Make_Explicit_Dereference (Loc, @@ -1032,24 +1033,33 @@ package body Exp_Ch11 is Obj_Decl := Make_Object_Declaration - (Clc, + (Cloc, Defining_Identifier => Cparm, Object_Definition => New_Occurrence_Of - (RTE (RE_Exception_Occurrence), Clc)); + (RTE (RE_Exception_Occurrence), Cloc)); Set_No_Initialization (Obj_Decl, True); Rewrite (Handler, - Make_Implicit_Exception_Handler (Loc, + Make_Exception_Handler (Hloc, + Choice_Parameter => Empty, Exception_Choices => Exception_Choices (Handler), Statements => New_List ( - Make_Block_Statement (Loc, + Make_Block_Statement (Hloc, Declarations => New_List (Obj_Decl), Handled_Statement_Sequence => - Make_Handled_Sequence_Of_Statements (Loc, + Make_Handled_Sequence_Of_Statements (Hloc, Statements => Statements (Handler)))))); + -- Local raise statements can't occur, since exception + -- handlers with choice parameters are not allowed when + -- No_Exception_Propagation applies, so set attributes + -- accordingly. + + Set_Local_Raise_Statements (Handler, No_Elist); + Set_Local_Raise_Not_OK (Handler); + Analyze_List (Statements (Handler), Suppress => All_Checks); end;