aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2008-08-20 15:24:40 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2008-08-20 15:24:40 +0200
commit8b4261b38284ef8b2f9f9c0a0f5f6c1b4f1d9dc7 (patch)
tree2b1f23a26019d8dbfdf61ba37592947bdd47120a
parentb2c4d56de258bc49da7f7349bedadd38af003a93 (diff)
downloadgcc-8b4261b38284ef8b2f9f9c0a0f5f6c1b4f1d9dc7.zip
gcc-8b4261b38284ef8b2f9f9c0a0f5f6c1b4f1d9dc7.tar.gz
gcc-8b4261b38284ef8b2f9f9c0a0f5f6c1b4f1d9dc7.tar.bz2
2008-08-20 Gary Dismukes <dismukes@adacore.com>
* 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
-rw-r--r--gcc/ada/ChangeLog14
-rw-r--r--gcc/ada/exp_ch11.adb24
2 files changed, 31 insertions, 7 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index d23dc16..b868744 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,17 @@
+2008-08-20 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch8.adb (Analyze_Subprogram_Renaming): Inherit Is_Imported flag.
+
+2008-08-20 Gary Dismukes <dismukes@adacore.com>
+
+ * 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 <dewar@adacore.com>
* 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 a8219fe..7ad1881 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;