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] | |
Tested on i686-linux, committed on trunk
This patch completes the implementation of the local-raise-to-goto
transformation by generating appropriate warnings if the restriction
No_Exception_Propagation is active. Warnings are generates for implicit
and explicit raises of exceptions not covered by a local handler, and
for handlers that do not handle a local exception.
The following test program shows the warnings in action (text of
test program is appended below).
1. pragma Restrictions (No_Exception_Propagation);
2. procedure p (C : in out Natural) is
3. begin
4. begin
5. C := C - 1;
6. exception
7. when Constraint_Error =>
8. null;
9. when Tasking_Error =>
|
>>> warning: pragma Restrictions (No_Exception_Propagation) in effect
>>> warning: this handler can never be entered, and has been removed
10. null;
11. end;
12.
13. begin
14. C := C - 1;
|
>>> warning: pragma Restrictions (No_Exception_Propagation) in effect
>>> warning: "Constraint_Error" may result in unhandled exception
15. end;
16.
17. begin
18. raise Program_Error;
|
>>> warning: pragma Restrictions (No_Exception_Propagation) in effect
>>> warning: execution may raise unhandled exception
19. end;
20. end p;
pragma Restrictions (No_Exception_Propagation);
procedure p (C : in out Natural) is
begin
begin
C := C - 1;
exception
when Constraint_Error =>
null;
when Tasking_Error =>
null;
end;
begin
C := C - 1;
end;
begin
raise Program_Error;
end;
end p;
2007-06-06 Thomas Quinot <quinot@adacore.com>
Olivier Hainque <hainque@adacore.com>
Robert Dewar <dewar@adacore.com>
* a-except.ads, a-except.adb: (Rmsg_28): Fix description for E.4(18)
check.
(Raise_Current_Excep): Call Debug_Raise_Exception just before
propagation starts, to let debuggers know about the event in a reliable
fashion.
(Local_Raise): Moved to System.Exceptions
More convenient to have this as a separate unit
* s-except.adb, s-except.ads: New files.
* a-exextr.adb (Unhandled_Exception): Delete - replaced by
Debug_Unhandled_Exception in System.Exceptions where it belongs
together with a couple of other debug helpers.
(Notify_Unhandled_Exception): Use Debug_Unhandled_Exception instead of
the former Unhandled_Exception.
* exp_ch11.ads, exp_ch11.adb: (Possible_Local_Raise): New procedure
(Warn_No_Exception_Propagation): New procedure
(Warn_If_No_Propagation): Rewritten for new warning generation
(Expand_Exception_Handlers): New warning generation
(Expand_N_Raise_xxx_Error): Rewritten for new warnings
(Add_Exception_Label): Use Special_Exception_Package_Used for test
instead of Most_Recent_Exception_Used (accomodates Exception_Traces)
(Expand_Local_Exception_Handlers): Unconditionally add extra block wrap
even if restriction is set (makes life easier in Check_Returns)
(Expand_Local_Exception_Handlers): Follow renamed entity chain when
checking exception identities.
(Expand_Local_Exception_Handlers): Do not optimize when all others case
(Expand_Local_Exception_Handlers): Set Exception_Junk flag on generated
block for handler (used by Check_Returns)
(Expand_Local_Exception_Handlers): Local_Raise now takes an address
(Expand_N_Handled_Sequence_Of_Statements): Properly handle -gnatd.x to
remove all exception handlers when optimizing local raise statements.
(Find_Local_Handler): Use Get_Renamed_Entity
(Expand_N_Handled_Sequence_Of_Statements): If the handled sequence is
marked analyzed after expanding exception handlers, do not generate
redundant cleanup actions, because they have been constructed already.
Attachment:
difs
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |