aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch11.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2017-04-25 14:00:46 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2017-04-25 14:00:46 +0200
commit321c24f75dde674402481f1df0025c8169aa9cdd (patch)
tree60c389a4af1d5a6dcd6d295987bda6a9f9a76fcc /gcc/ada/sem_ch11.adb
parent6948bc18f0a5bd5cfca40f6d18131b0673f05541 (diff)
downloadgcc-321c24f75dde674402481f1df0025c8169aa9cdd.zip
gcc-321c24f75dde674402481f1df0025c8169aa9cdd.tar.gz
gcc-321c24f75dde674402481f1df0025c8169aa9cdd.tar.bz2
[multiple changes]
2017-04-25 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Add_Internal_Interface_Entities): Move Has_Non_Trivial_Precondition to sem_util. for use elsewhere. Improve error message on operations that inherit non-conforming classwide preconditions from ancestor and progenitor. * sem_util.ads, sem_util.adb (Has_Non_Trivial_Precondition): moved here from sem_ch3. * sem_ch8.adb (Analyze_Subprogram_Renaming): Implement legality check given in RM 6.1.1 (17) concerning renamings of overriding operations that inherits class-wide preconditions from ancestor or progenitor. 2017-04-25 Hristian Kirtchev <kirtchev@adacore.com> * exp_ch7.adb (Build_Adjust_Or_Finalize_Statements): Code cleanup. (Build_Adjust_Statements): Code cleanup. (Build_Finalizer): Update the initialization of Exceptions_OK. (Build_Finalize_Statements): Code cleanup. (Build_Initialize_Statements): Code cleanup. (Make_Deep_Array_Body): Update the initialization of Exceptions_OK. (Make_Deep_Record_Body): Update the initialization of Exceptions_OK. (Process_Object_Declaration): Generate a null exception handler only when exceptions are allowed. (Process_Transients_In_Scope): Update the initialization of Exceptions_OK. * exp_util.ads, exp_util.adb (Exceptions_In_Finalization_OK): New routine. * sem_ch11.adb (Analyze_Exception_Handlers): Do not check any restrictions when the handler is internally generated and the mode is warnings. 2017-04-25 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Has_Non_Trivial_Precondition): New predicate to enforce legality rule on classwide preconditions inherited from both an ancestor and a progenitor (RM 6.1.1 (10-13). * sem_disp.adb (Check_Dispatching_Context): A call to an abstract subprogram need not be dispatching if it appears in a precondition for an abstract or null subprogram. 2017-04-25 Gary Dismukes <dismukes@adacore.com> * sem_ch10.adb: Minor typo fix. From-SVN: r247192
Diffstat (limited to 'gcc/ada/sem_ch11.adb')
-rw-r--r--gcc/ada/sem_ch11.adb20
1 files changed, 18 insertions, 2 deletions
diff --git a/gcc/ada/sem_ch11.adb b/gcc/ada/sem_ch11.adb
index 3e71b54..13ba280 100644
--- a/gcc/ada/sem_ch11.adb
+++ b/gcc/ada/sem_ch11.adb
@@ -165,8 +165,24 @@ package body Sem_Ch11 is
begin
Handler := First (L);
- Check_Restriction (No_Exceptions, Handler);
- Check_Restriction (No_Exception_Handlers, Handler);
+
+ -- Pragma Restriction_Warnings has more related semantics than pragma
+ -- Restrictions in that it flags exception handlers as violators. Note
+ -- that the compiler must still generate handlers for certain critical
+ -- scenarios such as finalization. As a result, these handlers should
+ -- not be subjected to the restriction check when in warnings mode.
+
+ if not Comes_From_Source (Handler)
+ and then (Restriction_Warnings (No_Exception_Handlers)
+ or else Restriction_Warnings (No_Exception_Propagation)
+ or else Restriction_Warnings (No_Exceptions))
+ then
+ null;
+
+ else
+ Check_Restriction (No_Exceptions, Handler);
+ Check_Restriction (No_Exception_Handlers, Handler);
+ end if;
-- Kill current remembered values, since we don't know where we were
-- when the exception was raised.